httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1671396 - /httpd/httpd/trunk/modules/generators/mod_status.c
Date Sun, 05 Apr 2015 13:34:02 GMT
Author: rjung
Date: Sun Apr  5 13:34:01 2015
New Revision: 1671396

URL: http://svn.apache.org/r1671396
Log:
Add more data to "?auto" view of server-status.

Although mod_status source code calls this the
"short_report", the docs and the API flag call
it "Machine Readable" resp. "STAT_OPT_AUTO".
So IMHO the data shown should be on par with
the html version.

Modified:
    httpd/httpd/trunk/modules/generators/mod_status.c

Modified: httpd/httpd/trunk/modules/generators/mod_status.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_status.c?rev=1671396&r1=1671395&r2=1671396&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_status.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_status.c Sun Apr  5 13:34:01 2015
@@ -126,7 +126,7 @@ static void format_kbyte_out(request_rec
         ap_rprintf(r, "%.1f GB", (float) kbytes / MBYTE);
 }
 
-static void show_time(request_rec *r, apr_interval_time_t tsecs)
+static void show_time(request_rec *r, apr_uint32_t tsecs)
 {
     int days, hrs, mins, secs;
 
@@ -183,7 +183,8 @@ static int status_handler(request_rec *r
 {
     const char *loc;
     apr_time_t nowtime;
-    apr_interval_time_t up_time;
+    apr_uint32_t up_time;
+    ap_loadavg_t t;
     int j, i, res, written;
     int ready;
     int busy;
@@ -391,10 +392,9 @@ static int status_handler(request_rec *r
     /* up_time in seconds */
     up_time = (apr_uint32_t) apr_time_sec(nowtime -
                                ap_scoreboard_image->global->restart_time);
+    ap_get_loadavg(&t);
 
     if (!short_report) {
-        ap_loadavg_t t;
-
         ap_rputs(DOCTYPE_HTML_3_2
                  "<html><head>\n"
                  "<title>Apache Status</title>\n"
@@ -424,10 +424,38 @@ static int status_handler(request_rec *r
         ap_rputs("<dt>Server uptime: ", r);
         show_time(r, up_time);
         ap_rputs("</dt>\n", r);
-        ap_get_loadavg(&t);
         ap_rprintf(r, "<dt>Server load: %.2f %.2f %.2f</dt>\n",
                    t.loadavg, t.loadavg5, t.loadavg15);
     }
+    else {
+        ap_rvputs(r, ap_get_server_name(r), "\n", NULL);
+        ap_rvputs(r, "ServerVersion: ",
+                  ap_get_server_description(), "\n", NULL);
+        ap_rvputs(r, "ServerMPM: ",
+                  ap_show_mpm(), "\n", NULL);
+        ap_rvputs(r, "Server Built: ",
+                  ap_get_server_built(), "\n", NULL);
+        ap_rvputs(r, "CurrentTime: ",
+                  ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0),
+                             "\n", NULL);
+        ap_rvputs(r, "RestartTime: ",
+                  ap_ht_time(r->pool,
+                             ap_scoreboard_image->global->restart_time,
+                             DEFAULT_TIME_FORMAT, 0),
+                  "\n", NULL);
+        ap_rprintf(r, "ParentServerConfigGeneration: %d\n",
+                   ap_state_query(AP_SQ_CONFIG_GEN));
+        ap_rprintf(r, "ParentServerMPMGeneration: %d\n",
+                   (int)mpm_generation);
+        ap_rputs("ServerUptimeSeconds: ", r);
+        ap_rprintf(r, "ServerUptimeSeconds: %u\n",
+                   up_time);
+        ap_rputs("ServerUptime:", r);
+        show_time(r, up_time);
+        ap_rputs("\n", r);
+        ap_rprintf(r, "Load1: %.2f\nLoad5: %.2f\nLoad15: %.2f\n",
+                   t.loadavg, t.loadavg5, t.loadavg15);
+    }
 
     if (ap_extended_status) {
         if (short_report) {
@@ -437,6 +465,9 @@ static int status_handler(request_rec *r
 
 #ifdef HAVE_TIMES
             /* Allow for OS/2 not having CPU stats */
+            ap_rprintf(r, "CPUUser: %g\nCPUSystem: %g\nCPUChildrenUser: %g\nCPUChildrenSystem:
%g",
+                       tu / tick, ts / tick, tcu / tick, tcs / tick);
+
             if (ts || tu || tcu || tcs)
                 ap_rprintf(r, "CPULoad: %g\n",
                            (tu + ts + tcu + tcs) / tick / up_time * 100.);



Mime
View raw message