| 1 | Index: server/mpm/experimental/peruser/peruser.c |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- server/mpm/experimental/peruser/peruser.c (revision 60) |
|---|
| 4 | +++ server/mpm/experimental/peruser/peruser.c (working copy) |
|---|
| 5 | @@ -2629,6 +2629,7 @@ |
|---|
| 6 | } |
|---|
| 7 | |
|---|
| 8 | perform_idle_server_maintenance(pconf); |
|---|
| 9 | + |
|---|
| 10 | #ifdef TPF |
|---|
| 11 | shutdown_pending = os_check_server(tpf_server_name); |
|---|
| 12 | ap_check_signals(); |
|---|
| 13 | @@ -3204,45 +3205,57 @@ |
|---|
| 14 | |
|---|
| 15 | if (flags & AP_STATUS_SHORT) |
|---|
| 16 | return OK; |
|---|
| 17 | - |
|---|
| 18 | + |
|---|
| 19 | + |
|---|
| 20 | + if (flags & AP_STATUS_STATS) { |
|---|
| 21 | + ap_rputs("<h3>Processors statistics:</h3><table border=\"0\"><tr><th>Processor</th><th>Pss</th><th>503's</th><th>Avail</th></tr>", r); |
|---|
| 22 | + |
|---|
| 23 | + /* just a mockup to se what data will be usefull here will put code layter, yes I know we need to iterate ON ENV[] NUM_ENV times */ |
|---|
| 24 | + for (x = 1; x < NUM_CHILDS; x++) |
|---|
| 25 | + { |
|---|
| 26 | + senv = CHILD_INFO_TABLE[x].senv; |
|---|
| 27 | + ap_rprintf(r, "<tr><td nowrap>%s</td><td nowrap>%d/%d/%d</td>" |
|---|
| 28 | + "<td>%d</td><td>%d%%</td></tr>", |
|---|
| 29 | + senv == NULL ? NULL : ( senv->name == NULL ? "" : senv->name ), |
|---|
| 30 | + idle_processors(x), total_processors(x), senv == NULL ? 0 : CHILD_INFO_TABLE[x].senv->max_processors, |
|---|
| 31 | + 0, senv == NULL ? 0 : CHILD_INFO_TABLE[x].senv->availability ); |
|---|
| 32 | + } |
|---|
| 33 | + ap_rputs("</table><tr/>", r); |
|---|
| 34 | + }else { |
|---|
| 35 | ap_rputs("<hr>\n", r); |
|---|
| 36 | - ap_rputs("<h2>peruser status</h2>\n", r); |
|---|
| 37 | + ap_rputs("<h3>peruser status</h3>\n", r); |
|---|
| 38 | ap_rputs("<table border=\"0\">\n", r); |
|---|
| 39 | - ap_rputs("<tr><td>ID</td><td>PID</td><td>STATUS</td><td>SB STATUS</td><td>TYPE</td><td>UID</td>" |
|---|
| 40 | - "<td>GID</td><td>CHROOT</td><td>NICE</td><td>INPUT</td>" |
|---|
| 41 | - "<td>OUTPUT</td><td>SOCK_FD</td>" |
|---|
| 42 | - "<td>TOTAL PROCESSORS</td><td>MAX PROCESSORS</td>" |
|---|
| 43 | - "<td>IDLE PROCESSORS</td><td>MIN FREE PROCESSORS</td>" |
|---|
| 44 | - "<td>AVAIL</td>" |
|---|
| 45 | + ap_rputs("<tr><th>ID</th><th>PID</th><th>STATUS</th><th>SB STATUS</th><th>Type</th><th>Processor</th>" |
|---|
| 46 | + "<th>Pss</th>" |
|---|
| 47 | + "<th>AVAIL</th>" |
|---|
| 48 | "</tr>\n", r); |
|---|
| 49 | for (x = 0; x < NUM_CHILDS; x++) |
|---|
| 50 | { |
|---|
| 51 | senv = CHILD_INFO_TABLE[x].senv; |
|---|
| 52 | - ap_rprintf(r, "<tr><td>%3d</td><td>%5d</td><td>%8s</td><td>%8s</td><td>%12s</td>" |
|---|
| 53 | - "<td>%4d</td><td>%4d</td><td>%25s</td><td>%3d</td><td>%5d</td>" |
|---|
| 54 | - "<td>%6d</td><td>%7d</td><td>%d</td><td>%d</td>" |
|---|
| 55 | - "<td>%d</td><td>%d</td><td>%3d</td></tr>\n", |
|---|
| 56 | + ap_rprintf(r, "<tr><td>%3d</td><td>%5d</td><td>%8s</td><td>%8s</td><td>%12s</td><td nowrap>%48s</td>" |
|---|
| 57 | + "<td>%d/%d/%d</td>" |
|---|
| 58 | + "<td>%3d%%</td></tr>\n", |
|---|
| 59 | CHILD_INFO_TABLE[x].id, |
|---|
| 60 | CHILD_INFO_TABLE[x].pid, |
|---|
| 61 | child_status_string(CHILD_INFO_TABLE[x].status), |
|---|
| 62 | scoreboard_status_string(SCOREBOARD_STATUS(x)), |
|---|
| 63 | child_type_string(CHILD_INFO_TABLE[x].type), |
|---|
| 64 | - senv == NULL ? -1 : senv->uid, |
|---|
| 65 | - senv == NULL ? -1 : senv->gid, |
|---|
| 66 | - senv == NULL ? NULL : senv->chroot, |
|---|
| 67 | - senv == NULL ? 0 : senv->nice_lvl, |
|---|
| 68 | - senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->input, |
|---|
| 69 | - senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->output, |
|---|
| 70 | - CHILD_INFO_TABLE[x].sock_fd, |
|---|
| 71 | + senv == NULL ? NULL : ( senv->name == NULL ? "" : senv->name ), |
|---|
| 72 | + idle_processors(x), |
|---|
| 73 | total_processors(x), |
|---|
| 74 | - senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->max_processors, |
|---|
| 75 | - idle_processors(x), |
|---|
| 76 | - senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->min_free_processors, |
|---|
| 77 | - senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->availability |
|---|
| 78 | + senv == NULL ? 0 : CHILD_INFO_TABLE[x].senv->max_processors, |
|---|
| 79 | + senv == NULL ? 0 : CHILD_INFO_TABLE[x].senv->availability |
|---|
| 80 | ); |
|---|
| 81 | } |
|---|
| 82 | ap_rputs("</table>\n", r); |
|---|
| 83 | - |
|---|
| 84 | + |
|---|
| 85 | + ap_rputs("<hr/><table>" |
|---|
| 86 | + "<tr><th>STATUS</th><td>Processor status</td></tr>" |
|---|
| 87 | + "<tr><th>XXX</th><td>XXX</td></tr>" |
|---|
| 88 | + "<tr><th>Pss</th><td>Number of processors idle/total/max</td></tr>" |
|---|
| 89 | + "</table><hr/>",r); |
|---|
| 90 | + } |
|---|
| 91 | + |
|---|
| 92 | if (grace_children > 0) { |
|---|
| 93 | ap_rputs("<h2>peruser graceful children status</h2>\n", r); |
|---|
| 94 | ap_rprintf(r, "%d of total %d still living<br />\n", grace_children_alive, grace_children); |
|---|
| 95 | @@ -3592,7 +3605,11 @@ |
|---|
| 96 | |
|---|
| 97 | if (ap_check_cmd_context(cmd, NOT_IN_VIRTUALHOST) != NULL) { |
|---|
| 98 | sconf = PERUSER_SERVER_CONF(cmd->server->module_config); |
|---|
| 99 | - sconf->senv->min_processors = min_procs; |
|---|
| 100 | + if(sconf->senv != NULL) |
|---|
| 101 | + sconf->senv->min_processors = min_procs; |
|---|
| 102 | + else |
|---|
| 103 | + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, |
|---|
| 104 | + "WARNING: MinProcessors must be set after ServerEnvironment to take effect"); |
|---|
| 105 | } |
|---|
| 106 | else { |
|---|
| 107 | ap_min_processors = min_procs; |
|---|
| 108 | @@ -3621,7 +3638,11 @@ |
|---|
| 109 | |
|---|
| 110 | if (ap_check_cmd_context(cmd, NOT_IN_VIRTUALHOST) != NULL) { |
|---|
| 111 | sconf = PERUSER_SERVER_CONF(cmd->server->module_config); |
|---|
| 112 | - sconf->senv->min_free_processors = min_free_procs; |
|---|
| 113 | + if(sconf->senv != NULL) |
|---|
| 114 | + sconf->senv->min_free_processors = min_free_procs; |
|---|
| 115 | + else |
|---|
| 116 | + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, |
|---|
| 117 | + "WARNING: MinSpareProcessors must be set after ServerEnvironment to take effect"); |
|---|
| 118 | } |
|---|
| 119 | else { |
|---|
| 120 | ap_min_free_processors = min_free_procs; |
|---|
| 121 | @@ -3650,7 +3671,11 @@ |
|---|
| 122 | |
|---|
| 123 | if (ap_check_cmd_context(cmd, NOT_IN_VIRTUALHOST) != NULL) { |
|---|
| 124 | sconf = PERUSER_SERVER_CONF(cmd->server->module_config); |
|---|
| 125 | - sconf->senv->max_free_processors = max_free_procs; |
|---|
| 126 | + if(sconf!=NULL) |
|---|
| 127 | + sconf->senv->max_free_processors = max_free_procs; |
|---|
| 128 | + else |
|---|
| 129 | + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, |
|---|
| 130 | + "WARNING: MaxSpareProcessors must be set after ServerEnvironment to take effect"); |
|---|
| 131 | } |
|---|
| 132 | else { |
|---|
| 133 | ap_max_free_processors = max_free_procs; |
|---|
| 134 | @@ -3679,7 +3704,11 @@ |
|---|
| 135 | |
|---|
| 136 | if (ap_check_cmd_context(cmd, NOT_IN_VIRTUALHOST) != NULL) { |
|---|
| 137 | sconf = PERUSER_SERVER_CONF(cmd->server->module_config); |
|---|
| 138 | - sconf->senv->max_processors = max_procs; |
|---|
| 139 | + if(sconf->senv != NULL) |
|---|
| 140 | + sconf->senv->max_processors = max_procs; |
|---|
| 141 | + else |
|---|
| 142 | + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, |
|---|
| 143 | + "WARNING: MaxProcessors must be set after ServerEnvironment to take effect"); |
|---|
| 144 | } |
|---|
| 145 | else { |
|---|
| 146 | ap_max_processors = max_procs; |
|---|
| 147 | Index: modules/generators/mod_status.c |
|---|
| 148 | =================================================================== |
|---|
| 149 | --- modules/generators/mod_status.c (revision 60) |
|---|
| 150 | +++ modules/generators/mod_status.c (working copy) |
|---|
| 151 | @@ -205,6 +205,7 @@ |
|---|
| 152 | #define STAT_OPT_REFRESH 0 |
|---|
| 153 | #define STAT_OPT_NOTABLE 1 |
|---|
| 154 | #define STAT_OPT_AUTO 2 |
|---|
| 155 | +#define STAT_OPT_STATS 3 |
|---|
| 156 | |
|---|
| 157 | struct stat_opt { |
|---|
| 158 | int id; |
|---|
| 159 | @@ -217,6 +218,7 @@ |
|---|
| 160 | {STAT_OPT_REFRESH, "refresh", "Refresh"}, |
|---|
| 161 | {STAT_OPT_NOTABLE, "notable", NULL}, |
|---|
| 162 | {STAT_OPT_AUTO, "auto", NULL}, |
|---|
| 163 | + {STAT_OPT_STATS, "stats", NULL}, |
|---|
| 164 | {STAT_OPT_END, NULL, NULL} |
|---|
| 165 | }; |
|---|
| 166 | |
|---|
| 167 | @@ -241,6 +243,7 @@ |
|---|
| 168 | #endif |
|---|
| 169 | int short_report; |
|---|
| 170 | int no_table_report; |
|---|
| 171 | + int stats_report; |
|---|
| 172 | worker_score *ws_record; |
|---|
| 173 | process_score *ps_record; |
|---|
| 174 | char *stat_buffer; |
|---|
| 175 | @@ -268,7 +271,8 @@ |
|---|
| 176 | kbcount = 0; |
|---|
| 177 | short_report = 0; |
|---|
| 178 | no_table_report = 0; |
|---|
| 179 | - |
|---|
| 180 | + stats_report=0; |
|---|
| 181 | + |
|---|
| 182 | pid_buffer = apr_palloc(r->pool, server_limit * sizeof(pid_t)); |
|---|
| 183 | stat_buffer = apr_palloc(r->pool, server_limit * thread_limit * sizeof(char)); |
|---|
| 184 | |
|---|
| 185 | @@ -312,6 +316,9 @@ |
|---|
| 186 | case STAT_OPT_NOTABLE: |
|---|
| 187 | no_table_report = 1; |
|---|
| 188 | break; |
|---|
| 189 | + case STAT_OPT_STATS: |
|---|
| 190 | + stats_report = 1; |
|---|
| 191 | + break; |
|---|
| 192 | case STAT_OPT_AUTO: |
|---|
| 193 | ap_set_content_type(r, "text/plain; charset=ISO-8859-1"); |
|---|
| 194 | short_report = 1; |
|---|
| 195 | @@ -819,8 +826,8 @@ |
|---|
| 196 | int flags = |
|---|
| 197 | (short_report ? AP_STATUS_SHORT : 0) | |
|---|
| 198 | (no_table_report ? AP_STATUS_NOTABLE : 0) | |
|---|
| 199 | - (ap_extended_status ? AP_STATUS_EXTENDED : 0); |
|---|
| 200 | - |
|---|
| 201 | + (ap_extended_status ? AP_STATUS_EXTENDED : 0) | |
|---|
| 202 | + (stats_report ? AP_STATUS_STATS : 0); |
|---|
| 203 | ap_run_status_hook(r, flags); |
|---|
| 204 | } |
|---|
| 205 | |
|---|
| 206 | Index: modules/generators/mod_status.h |
|---|
| 207 | =================================================================== |
|---|
| 208 | --- modules/generators/mod_status.h (revision 60) |
|---|
| 209 | +++ modules/generators/mod_status.h (working copy) |
|---|
| 210 | @@ -32,6 +32,7 @@ |
|---|
| 211 | #define AP_STATUS_SHORT (0x1) /* short, non-HTML report requested */ |
|---|
| 212 | #define AP_STATUS_NOTABLE (0x2) /* HTML report without tables */ |
|---|
| 213 | #define AP_STATUS_EXTENDED (0x4) /* detailed report */ |
|---|
| 214 | +#define AP_STATUS_STATS (0x8) /* extended user statistics report */ |
|---|
| 215 | |
|---|
| 216 | #if !defined(WIN32) |
|---|
| 217 | #define STATUS_DECLARE(type) type |
|---|