diff options
Diffstat (limited to 'mwrap_httpd.h')
-rw-r--r-- | mwrap_httpd.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/mwrap_httpd.h b/mwrap_httpd.h index f5c3e1b..e5790aa 100644 --- a/mwrap_httpd.h +++ b/mwrap_httpd.h @@ -505,11 +505,14 @@ static struct h1_src_loc *accumulate(unsigned long min, size_t *hslc, FILE *lp) return hslv; } -static void show_age(FILE *fp) +static void show_stats(FILE *fp) { size_t dec = uatomic_read(&total_bytes_dec); size_t inc = uatomic_read(&total_bytes_inc); - fprintf(fp, "<p>Current age: %zu (live: %zu)", inc , inc - dec); + fprintf(fp, "<p>Current age: %zu (live: %zu) " + "/ files: %zu / locations: %zu", + inc , inc - dec, + uatomic_read(&nr_file), uatomic_read(&nr_src_loc)); } /* /$PID/at/$LOCATION endpoint */ @@ -542,7 +545,7 @@ static enum mw_qev each_at(struct mw_h1 *h1, struct mw_h1req *h1r) else fputc(' ', fp); write_html(fp, lb.ptr, lb.len); - show_age(fp); + show_stats(fp); FPUTS("<table><tr><th>size</th><th>generation</th>" "<th>address</th></tr>", fp); @@ -595,9 +598,10 @@ static enum mw_qev each_gt(struct mw_h1 *h1, struct mw_h1req *h1r, if (!fp) return h1_close(h1); fprintf(fp, "<html><head><title>mwrap each >%lu" "</title></head><body><p>mwrap each >%lu " - "(change `%lu' in URL to adjust filtering)", min, min, min); + "(change `%lu' in URL to adjust filtering) - MWRAP=bt:%u", + min, min, min, (unsigned)bt_req_depth); - show_age(fp); + show_stats(fp); if (bt_req_depth) /* need borders to distinguish multi-level traces */ FPUTS("<table\nborder=1><tr>", fp); else /* save screen space if only tracing one line */ @@ -651,11 +655,12 @@ static enum mw_qev pid_root(struct mw_h1 *h1, struct mw_h1req *h1r) if (!fp) return h1_close(h1); #define default_min "2000" - FPUTS("<html><head><title>mwrap demo" - "</title></head><body><p><a\n" - "href=\"each/" default_min "\">allocations >" - default_min " bytes</a><p><a\nhref=\"" - URL "\">" URL "</a></body></html>", fp); + FPUTS("<html><head><title>mwrap demo</title></head><body>" + "<p>mwrap demo", fp); + show_stats(fp); + FPUTS("<p><a\nhref=\"each/" default_min "\">allocations >" + default_min " bytes</a>" + "<p><a\nhref=\"" URL "\">" URL "</a></body></html>", fp); return h1_200(h1, &html); #undef default_min } |