about summary refs log tree commit homepage
path: root/httpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'httpd.h')
-rw-r--r--httpd.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/httpd.h b/httpd.h
index 89e366e..ef4d83c 100644
--- a/httpd.h
+++ b/httpd.h
@@ -38,7 +38,11 @@
 #include "picohttpparser_c.h"
 #include <pthread.h>
 #include <stdbool.h>
-#define URL "https://80x24.org/mwrap-perl.git/about"
+#if MWRAP_PERL
+#        define URL "https://80x24.org/mwrap-perl.git/"
+#else
+#        define URL "https://80x24.org/mwrap.git/"
+#endif
 #define TYPE_HTML "text/html; charset=UTF-8"
 #define TYPE_CSV "text/csv"
 #define TYPE_PLAIN "text/plain"
@@ -548,6 +552,9 @@ static void show_stats(FILE *fp)
                 "/ files: %zu / locations: %zu",
                 inc , inc - dec,
                 uatomic_read(&nr_file), uatomic_read(&nr_src_loc));
+#if MWRAP_RUBY
+        fprintf(fp, " / GC: %zu", uatomic_read(&last_gc_count));
+#endif
 }
 
 /* /$PID/at/$LOCATION endpoint */
@@ -593,7 +600,12 @@ static enum mw_qev each_at(struct mw_h1 *h1, struct mw_h1req *h1r)
                                 size, h->as.live.gen, h->real);
         }
         rcu_read_unlock();
-        FPUTS("</table></body></html>", fp);
+        FPUTS("</table><pre>\nNotes:\n"
+"* 16344-byte (64-bit) or 16344-byte (32-bit) allocations in\n"
+"  Ruby &lt;= 3.0 aligned to 0x4000 are likely for object heap slots.\n"
+"* 4080-byte allocations in Perl 5 are likely for arenas\n"
+"  (set via the PERL_ARENA_SIZE compile-time macro)"
+"</pre></body></html>", fp);
         return h1_200(h1, &html, TYPE_HTML);
 }
 
@@ -602,8 +614,13 @@ static enum mw_qev each_gt(struct mw_h1 *h1, struct mw_h1req *h1r,
                                 unsigned long min, bool csv)
 {
         static const char default_sort[] = "bytes";
-        const char *sort = default_sort;
-        size_t sort_len = sizeof(default_sort) - 1;
+        const char *sort;
+        size_t sort_len = 0;
+
+        if (!csv) {
+                sort = default_sort;
+                sort_len = sizeof(default_sort) - 1;
+        }
 
         if (h1r->qstr && h1r->qlen > 5 && !memcmp(h1r->qstr, "sort=", 5)) {
                 sort = h1r->qstr + 5;
@@ -637,7 +654,8 @@ static enum mw_qev each_gt(struct mw_h1 *h1, struct mw_h1req *h1r,
                 fprintf(fp, "<html><head><title>mwrap each &gt;%lu"
                         "</title></head><body><p>mwrap each &gt;%lu "
                         "(change `%lu' in URL to adjust filtering) - "
-                        "MWRAP=bt:%u", min, min, min, depth);
+                        "MWRAP=bt:%u <a href=\"%lu.csv\">.csv</a>",
+                        min, min, min, depth, min);
                 show_stats(fp);
                 /* need borders to distinguish multi-level traces */
                 if (depth)
@@ -1145,7 +1163,7 @@ static void h1d_unlink(struct mw_h1d *h1d, bool do_close)
 static int h1d_init(struct mw_h1d *h1d, const char *menv)
 {
         union mw_sockaddr sa = { .un = { .sun_family = AF_UNIX } };
-#ifdef HAS_SOCKADDR_SA_LEN
+#if defined(HAS_SOCKADDR_SA_LEN) || defined(HAVE_STRUCT_SOCKADDR_UN_SUN_LEN)
         sa.un.sun_len = (unsigned char)sizeof(struct sockaddr_un);
 #endif
         const char *env = strstr(menv, "socket_dir:");