Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] Output of fiber.info will contain only non-idle fibers
@ 2019-07-23 18:00 Maria K
  2019-07-23 19:56 ` [tarantool-patches] " Konstantin Osipov
  0 siblings, 1 reply; 7+ messages in thread
From: Maria K @ 2019-07-23 18:00 UTC (permalink / raw)
  To: tarantool-patches; +Cc: georgy

[-- Attachment #1: Type: text/plain, Size: 1731 bytes --]

The output used to be too cluttered due to idle ones.

Closes #4235
---
 src/lib/core/fiber.c      |  3 ++-
 src/lib/core/fiber.h      | 10 ++++++++++
 src/lib/core/fiber_pool.c |  2 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
index ce90f930c..b1d7a5be2 100644
--- a/src/lib/core/fiber.c
+++ b/src/lib/core/fiber.c
@@ -1411,7 +1411,8 @@ int fiber_stat(fiber_stat_cb cb, void *cb_ctx)
  struct cord *cord = cord();
  int res;
  rlist_foreach_entry(fiber, &cord->alive, link) {
- res = cb(fiber, cb_ctx);
+ if (!fiber_is_idle(fiber))
+ res = cb(fiber, cb_ctx);
  if (res != 0)
  return res;
  }
diff --git a/src/lib/core/fiber.h b/src/lib/core/fiber.h
index fb168e25e..d05132a8d 100644
--- a/src/lib/core/fiber.h
+++ b/src/lib/core/fiber.h
@@ -97,6 +97,10 @@ enum {
  * This flag is set when fiber uses custom stack size.
  */
  FIBER_CUSTOM_STACK = 1 << 5,
+ /*
+ *
+ */
+ FIBER_IS_IDLE = 1 << 6,
  FIBER_DEFAULT_FLAGS = FIBER_IS_CANCELLABLE
 };

@@ -620,6 +624,12 @@ fiber_is_dead(struct fiber *f)
  return f->flags & FIBER_IS_DEAD;
 }

+static inline bool
+fiber_is_idle(struct fiber *f)
+{
+ return f->flags & FIBER_IS_IDLE;
+}
+
 typedef int (*fiber_stat_cb)(struct fiber *f, void *ctx);

 int
diff --git a/src/lib/core/fiber_pool.c b/src/lib/core/fiber_pool.c
index 77f89c9fa..c04141e63 100644
--- a/src/lib/core/fiber_pool.c
+++ b/src/lib/core/fiber_pool.c
@@ -72,8 +72,10 @@ restart:
  * Add the fiber to the front of the list, so that
  * it is most likely to get scheduled again.
  */
+ f->flags |= FIBER_IS_IDLE;
  rlist_add_entry(&pool->idle, fiber(), state);
  fiber_yield();
+ f->flags &= ~FIBER_IS_IDLE;
  goto restart;
  }
  pool->size--;
-- 
2.21.0

[-- Attachment #2: Type: text/html, Size: 2073 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-25 13:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 18:00 [tarantool-patches] [PATCH] Output of fiber.info will contain only non-idle fibers Maria K
2019-07-23 19:56 ` [tarantool-patches] " Konstantin Osipov
2019-07-24  8:00   ` Kirill Yukhin
2019-07-24 15:11     ` Konstantin Osipov
2019-07-25  6:14   ` Георгий Кириченко
2019-07-25  9:26     ` Konstantin Osipov
2019-07-25 13:02       ` Георгий Кириченко

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox