| 286 | } |
| 287 | |
| 288 | static void socache_mc_status(ap_socache_instance_t *ctx, request_rec *r, int flags) |
| 289 | { |
| 290 | apr_memcache_t *rc = ctx->mc; |
| 291 | int i; |
| 292 | |
| 293 | for (i = 0; i < rc->ntotal; i++) { |
| 294 | apr_memcache_server_t *ms; |
| 295 | apr_memcache_stats_t *stats; |
| 296 | apr_status_t rv; |
| 297 | char *br = (!(flags & AP_STATUS_SHORT) ? "<br />" : ""); |
| 298 | |
| 299 | ms = rc->live_servers[i]; |
| 300 | |
| 301 | ap_rprintf(r, "Memcached server: %s:%d [%s]%s\n", ms->host, (int)ms->port, |
| 302 | (ms->status == APR_MC_SERVER_LIVE) ? "Up" : "Down", |
| 303 | br); |
| 304 | rv = apr_memcache_stats(ms, r->pool, &stats); |
| 305 | if (rv != APR_SUCCESS) |
| 306 | continue; |
| 307 | if (!(flags & AP_STATUS_SHORT)) { |
| 308 | ap_rprintf(r, "<b>Version:</b> <i>%s</i> [%u bits], PID: <i>%u</i>, Uptime: <i>%u hrs</i> <br />\n", |
| 309 | stats->version , stats->pointer_size, stats->pid, stats->uptime/3600); |
| 310 | ap_rprintf(r, "<b>Clients::</b> Structures: <i>%u</i>, Total: <i>%u</i>, Current: <i>%u</i> <br />\n", |
| 311 | stats->connection_structures, stats->total_connections, stats->curr_connections); |
| 312 | ap_rprintf(r, "<b>Storage::</b> Total Items: <i>%u</i>, Current Items: <i>%u</i>, Bytes: <i>%" APR_UINT64_T_FMT "</i> <br />\n", |
| 313 | stats->total_items, stats->curr_items, stats->bytes); |
| 314 | ap_rprintf(r, "<b>CPU::</b> System: <i>%u</i>, User: <i>%u</i> <br />\n", |
| 315 | (unsigned)stats->rusage_system, (unsigned)stats->rusage_user ); |
| 316 | ap_rprintf(r, "<b>Cache::</b> Gets: <i>%u</i>, Sets: <i>%u</i>, Hits: <i>%u</i>, Misses: <i>%u</i> <br />\n", |
| 317 | stats->cmd_get, stats->cmd_set, stats->get_hits, stats->get_misses); |
| 318 | ap_rprintf(r, "<b>Net::</b> Input bytes: <i>%" APR_UINT64_T_FMT "</i>, Output bytes: <i>%" APR_UINT64_T_FMT "</i> <br />\n", |
| 319 | stats->bytes_read, stats->bytes_written); |
| 320 | ap_rprintf(r, "<b>Misc::</b> Evictions: <i>%" APR_UINT64_T_FMT "</i>, MaxMem: <i>%u</i>, Threads: <i>%u</i> <br />\n", |
| 321 | stats->evictions, stats->limit_maxbytes, stats->threads); |
| 322 | ap_rputs("<hr><br />\n", r); |
| 323 | } |
| 324 | else { |
| 325 | ap_rprintf(r, "Version: %s [%u bits], PID: %u, Uptime: %u hrs %s\n", |
| 326 | stats->version , stats->pointer_size, stats->pid, stats->uptime/3600, br); |
| 327 | ap_rprintf(r, "Clients:: Structures: %d, Total: %d, Current: %u %s\n", |
| 328 | stats->connection_structures, stats->total_connections, stats->curr_connections, br); |
| 329 | ap_rprintf(r, "Storage:: Total Items: %u, Current Items: %u, Bytes: %" APR_UINT64_T_FMT " %s\n", |
| 330 | stats->total_items, stats->curr_items, stats->bytes, br); |
| 331 | ap_rprintf(r, "CPU:: System: %u, User: %u %s\n", |
| 332 | (unsigned)stats->rusage_system, (unsigned)stats->rusage_user , br); |
| 333 | ap_rprintf(r, "Cache:: Gets: %u, Sets: %u, Hits: %u, Misses: %u %s\n", |
| 334 | stats->cmd_get, stats->cmd_set, stats->get_hits, stats->get_misses, br); |
| 335 | ap_rprintf(r, "Net:: Input bytes: %" APR_UINT64_T_FMT ", Output bytes: %" APR_UINT64_T_FMT " %s\n", |
| 336 | stats->bytes_read, stats->bytes_written, br); |
| 337 | ap_rprintf(r, "Misc:: Evictions: %" APR_UINT64_T_FMT ", MaxMem: %u, Threads: %u %s\n", |
| 338 | stats->evictions, stats->limit_maxbytes, stats->threads, br); |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | } |
| 343 | |
| 344 | static apr_status_t socache_mc_iterate(ap_socache_instance_t *instance, |
| 345 | server_rec *s, void *userctx, |
nothing calls this directly
no test coverage detected