mwrap user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] tweak hpb stats destructor output
@ 2018-08-11  3:53 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2018-08-11  3:53 UTC (permalink / raw)
  To: mwrap-public; +Cc: Eric Wong

Including the last rb_gc_count() call would be useful, and
avoid showing giant SIZE_MAX initializers for acc.min fields.
---
 ext/mwrap/mwrap.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/ext/mwrap/mwrap.c b/ext/mwrap/mwrap.c
index 138384d..b60c21d 100644
--- a/ext/mwrap/mwrap.c
+++ b/ext/mwrap/mwrap.c
@@ -1351,21 +1351,26 @@ static void dump_hpb(FILE *fp, unsigned flags)
 	if (flags & DUMP_HPB_STATS) {
 		fprintf(fp,
 			"lifespan_max: %zu\n"
-			"lifespan_min: %zu\n"
+			"lifespan_min:%s%zu\n"
 			"lifespan_mean: %0.3f\n"
 			"lifespan_stddev: %0.3f\n"
 			"deathspan_max: %zu\n"
-			"deathspan_min: %zu\n"
+			"deathspan_min:%s%zu\n"
 			"deathspan_mean: %0.3f\n"
-			"deathspan_stddev: %0.3f\n",
+			"deathspan_stddev: %0.3f\n"
+			"gc_count: %zu\n",
 			hpb_stats.alive.max,
+			hpb_stats.alive.min == SIZE_MAX ? " -" : " ",
 			hpb_stats.alive.min,
 			hpb_stats.alive.mean,
 			acc_stddev_dbl(&hpb_stats.alive),
 			hpb_stats.reborn.max,
+			hpb_stats.reborn.min == SIZE_MAX ? " -" : " ",
 			hpb_stats.reborn.min,
 			hpb_stats.reborn.mean,
-			acc_stddev_dbl(&hpb_stats.reborn));
+			acc_stddev_dbl(&hpb_stats.reborn),
+			/* n.b.: unsafe to call rb_gc_count() in destructor */
+			generation);
 	}
 	if (flags & DUMP_HPB_EACH) {
 		struct alloc_hdr *h;
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-08-11  3:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-11  3:53 [PATCH] tweak hpb stats destructor output Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mwrap.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).