stat.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* DEBUG: section 18 Cache Manager Statistics */
10 
11 #include "squid.h"
12 #include "CacheDigest.h"
13 #include "CachePeer.h"
14 #include "client_side.h"
15 #include "client_side_request.h"
16 #include "comm/Connection.h"
17 #include "comm/Loops.h"
18 #include "event.h"
19 #include "fde.h"
20 #include "format/Token.h"
21 #include "globals.h"
22 #include "http/Stream.h"
23 #include "HttpRequest.h"
24 #include "IoStats.h"
25 #include "mem/Pool.h"
26 #include "mem_node.h"
27 #include "MemBuf.h"
28 #include "MemObject.h"
29 #include "mgr/CountersAction.h"
30 #include "mgr/FunAction.h"
31 #include "mgr/InfoAction.h"
32 #include "mgr/IntervalAction.h"
33 #include "mgr/IoAction.h"
34 #include "mgr/Registration.h"
35 #include "mgr/ServiceTimesAction.h"
36 #include "neighbors.h"
37 #include "PeerDigest.h"
38 #include "SquidConfig.h"
39 #include "SquidMath.h"
40 #include "SquidTime.h"
41 #include "stat.h"
42 #include "StatCounters.h"
43 #include "Store.h"
44 #include "store_digest.h"
45 #include "StoreClient.h"
46 #include "tools.h"
47 // for tvSubDsec() which should be in SquidTime.h
48 #include "util.h"
49 #if USE_AUTH
50 #include "auth/UserRequest.h"
51 #endif
52 #if USE_DELAY_POOLS
53 #include "DelayId.h"
54 #endif
55 #if USE_OPENSSL
56 #include "ssl/support.h"
57 #endif
58 
59 /* these are included because they expose stats calls */
60 /* TODO: provide a self registration mechanism for those classes
61  * to use during static construction
62  */
63 #include "comm.h"
64 #include "StoreSearch.h"
65 
66 #define DEBUG_OPENFD 1
67 
68 typedef int STOBJFLT(const StoreEntry *);
69 
71 {
73 
74 public:
78 };
79 
80 /* LOCALS */
81 static const char *describeStatuses(const StoreEntry *);
82 static void statAvgTick(void *notused);
83 static void statAvgDump(StoreEntry *, int minutes, int hours);
84 #if STAT_GRAPHS
85 static void statGraphDump(StoreEntry *);
86 #endif
87 static void statCountersInit(StatCounters *);
89 static void statCountersClean(StatCounters *);
90 static void statCountersCopy(StatCounters * dest, const StatCounters * orig);
91 static double statPctileSvc(double, int, int);
92 static void statStoreEntry(MemBuf * mb, StoreEntry * e);
93 static double statCPUUsage(int minutes);
96 #if DEBUG_OPENFD
98 #endif
106 void GetAvgStat(Mgr::IntervalActionData& stats, int minutes, int hours);
110 void DumpMallocStatistics(StoreEntry* sentry);
117 
118 #if XMALLOC_STATISTICS
119 static void info_get_mallstat(int, int, int, void *);
120 static double xm_time;
121 static double xm_deltat;
122 #endif
123 
125 static int NCountHist = 0;
126 static StatCounters CountHourHist[N_COUNT_HOUR_HIST];
127 static int NCountHourHist = 0;
129 
130 extern unsigned int mem_pool_alloc_calls;
131 extern unsigned int mem_pool_free_calls;
132 
133 static void
135 {
136  storeAppendPrintf(e, "Cache Utilisation:\n");
137  storeAppendPrintf(e, "\n");
138  storeAppendPrintf(e, "Last 5 minutes:\n");
139 
140  if (NCountHist >= 5)
141  statAvgDump(e, 5, 0);
142  else
143  storeAppendPrintf(e, "(no values recorded yet)\n");
144 
145  storeAppendPrintf(e, "\n");
146 
147  storeAppendPrintf(e, "Last 15 minutes:\n");
148 
149  if (NCountHist >= 15)
150  statAvgDump(e, 15, 0);
151  else
152  storeAppendPrintf(e, "(no values recorded yet)\n");
153 
154  storeAppendPrintf(e, "\n");
155 
156  storeAppendPrintf(e, "Last hour:\n");
157 
158  if (NCountHist >= 60)
159  statAvgDump(e, 60, 0);
160  else
161  storeAppendPrintf(e, "(no values recorded yet)\n");
162 
163  storeAppendPrintf(e, "\n");
164 
165  storeAppendPrintf(e, "Last 8 hours:\n");
166 
167  if (NCountHourHist >= 8)
168  statAvgDump(e, 0, 8);
169  else
170  storeAppendPrintf(e, "(no values recorded yet)\n");
171 
172  storeAppendPrintf(e, "\n");
173 
174  storeAppendPrintf(e, "Last day:\n");
175 
176  if (NCountHourHist >= 24)
177  statAvgDump(e, 0, 24);
178  else
179  storeAppendPrintf(e, "(no values recorded yet)\n");
180 
181  storeAppendPrintf(e, "\n");
182 
183  storeAppendPrintf(e, "Last 3 days:\n");
184 
185  if (NCountHourHist >= 72)
186  statAvgDump(e, 0, 72);
187  else
188  storeAppendPrintf(e, "(no values recorded yet)\n");
189 
190  storeAppendPrintf(e, "\n");
191 
192  storeAppendPrintf(e, "Totals since cache startup:\n");
193 
194  statCountersDump(e);
195 }
196 
197 void
199 {
200  int i;
201 
202  stats.http_reads = IOStats.Http.reads;
203 
204  for (i = 0; i < IoStats::histSize; ++i) {
206  }
207 
208  stats.ftp_reads = IOStats.Ftp.reads;
209 
210  for (i = 0; i < IoStats::histSize; ++i) {
211  stats.ftp_read_hist[i] = IOStats.Ftp.read_hist[i];
212  }
213 
215 
216  for (i = 0; i < IoStats::histSize; ++i) {
218  }
219 }
220 
221 void
223 {
224  int i;
225 
226  storeAppendPrintf(sentry, "HTTP I/O\n");
227  storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.http_reads);
228  storeAppendPrintf(sentry, "Read Histogram:\n");
229 
230  for (i = 0; i < IoStats::histSize; ++i) {
231  storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n",
232  i ? (1 << (i - 1)) + 1 : 1,
233  1 << i,
234  stats.http_read_hist[i],
236  }
237 
238  storeAppendPrintf(sentry, "\n");
239  storeAppendPrintf(sentry, "FTP I/O\n");
240  storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.ftp_reads);
241  storeAppendPrintf(sentry, "Read Histogram:\n");
242 
243  for (i = 0; i < IoStats::histSize; ++i) {
244  storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n",
245  i ? (1 << (i - 1)) + 1 : 1,
246  1 << i,
247  stats.ftp_read_hist[i],
248  Math::doublePercent(stats.ftp_read_hist[i], stats.ftp_reads));
249  }
250 
251  storeAppendPrintf(sentry, "\n");
252  storeAppendPrintf(sentry, "Gopher I/O\n");
253  storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.gopher_reads);
254  storeAppendPrintf(sentry, "Read Histogram:\n");
255 
256  for (i = 0; i < IoStats::histSize; ++i) {
257  storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n",
258  i ? (1 << (i - 1)) + 1 : 1,
259  1 << i,
260  stats.gopher_read_hist[i],
262  }
263 
264  storeAppendPrintf(sentry, "\n");
265 }
266 
267 static const char *
269 {
270  LOCAL_ARRAY(char, buf, 256);
271  snprintf(buf, 256, "%-13s %-13s %-12s %-12s",
273  memStatusStr[entry->mem_status],
274  swapStatusStr[entry->swap_status],
275  pingStatusStr[entry->ping_status]);
276  return buf;
277 }
278 
279 const char *
281 {
282  LOCAL_ARRAY(char, buf, 256);
283  int flags = (int) entry->flags;
284  char *t;
285  buf[0] = '\0';
286 
287  if (EBIT_TEST(flags, ENTRY_SPECIAL))
288  strcat(buf, "SPECIAL,");
289 
291  strcat(buf, "REVALIDATE_ALWAYS,");
292 
293  if (EBIT_TEST(flags, DELAY_SENDING))
294  strcat(buf, "DELAY_SENDING,");
295 
296  if (EBIT_TEST(flags, RELEASE_REQUEST))
297  strcat(buf, "RELEASE_REQUEST,");
298 
299  if (EBIT_TEST(flags, REFRESH_REQUEST))
300  strcat(buf, "REFRESH_REQUEST,");
301 
302  if (EBIT_TEST(flags, ENTRY_REVALIDATE_STALE))
303  strcat(buf, "REVALIDATE_STALE,");
304 
305  if (EBIT_TEST(flags, ENTRY_DISPATCHED))
306  strcat(buf, "DISPATCHED,");
307 
308  if (EBIT_TEST(flags, KEY_PRIVATE))
309  strcat(buf, "PRIVATE,");
310 
311  if (EBIT_TEST(flags, ENTRY_FWD_HDR_WAIT))
312  strcat(buf, "FWD_HDR_WAIT,");
313 
314  if (EBIT_TEST(flags, ENTRY_NEGCACHED))
315  strcat(buf, "NEGCACHED,");
316 
317  if (EBIT_TEST(flags, ENTRY_VALIDATED))
318  strcat(buf, "VALIDATED,");
319 
320  if (EBIT_TEST(flags, ENTRY_BAD_LENGTH))
321  strcat(buf, "BAD_LENGTH,");
322 
323  if (EBIT_TEST(flags, ENTRY_ABORTED))
324  strcat(buf, "ABORTED,");
325 
326  if ((t = strrchr(buf, ',')))
327  *t = '\0';
328 
329  return buf;
330 }
331 
332 static void
334 {
335  MemObject *mem = e->mem_obj;
336  mb->appendf("KEY %s\n", e->getMD5Text());
337  mb->appendf("\t%s\n", describeStatuses(e));
338  mb->appendf("\t%s\n", storeEntryFlags(e));
339  mb->appendf("\t%s\n", e->describeTimestamps());
340  mb->appendf("\t%d locks, %d clients, %d refs\n", (int) e->locks(), storePendingNClients(e), (int) e->refcount);
341  mb->appendf("\tSwap Dir %d, File %#08X\n", e->swap_dirn, e->swap_filen);
342 
343  if (mem != NULL)
344  mem->stat (mb);
345 
346  mb->append("\n", 1);
347 }
348 
349 /* process objects list */
350 static void
351 statObjects(void *data)
352 {
353  StatObjectsState *state = static_cast<StatObjectsState *>(data);
354  StoreEntry *e;
355 
356  if (state->theSearch->isDone()) {
357  if (UsingSmp())
358  storeAppendPrintf(state->sentry, "} by kid%d\n\n", KidIdentifier);
359  state->sentry->complete();
360  state->sentry->unlock("statObjects+isDone");
361  delete state;
362  return;
363  } else if (EBIT_TEST(state->sentry->flags, ENTRY_ABORTED)) {
364  state->sentry->unlock("statObjects+aborted");
365  delete state;
366  return;
367  } else if (state->sentry->checkDeferRead(-1)) {
368  state->sentry->flush();
369  eventAdd("statObjects", statObjects, state, 0.1, 1);
370  return;
371  }
372 
373  state->sentry->buffer();
374  size_t statCount = 0;
375  MemBuf mb;
376  mb.init();
377 
378  while (statCount++ < static_cast<size_t>(Config.Store.objectsPerBucket) && state->
379  theSearch->next()) {
380  e = state->theSearch->currentItem();
381 
382  if (state->filter && 0 == state->filter(e))
383  continue;
384 
385  statStoreEntry(&mb, e);
386  }
387 
388  if (mb.size)
389  state->sentry->append(mb.buf, mb.size);
390  mb.clean();
391 
392  eventAdd("statObjects", statObjects, state, 0.0, 1);
393 }
394 
395 static void
397 {
398  StatObjectsState *state = new StatObjectsState;
399  state->sentry = sentry;
400  state->filter = filter;
401 
402  sentry->lock("statObjects");
403  state->theSearch = Store::Root().search();
404 
405  eventAdd("statObjects", statObjects, state, 0.0, 1);
406 }
407 
408 static void
410 {
411  statObjectsStart(sentry, NULL);
412 }
413 
414 static int
416 {
417  return e->mem_obj ? 1 : 0;
418 }
419 
420 static void
422 {
424 }
425 
426 #if DEBUG_OPENFD
427 static int
429 {
430  if (e->mem_obj == NULL)
431  return 0;
432 
433  if (e->mem_obj->swapout.sio == NULL)
434  return 0;
435 
436  return 1;
437 }
438 
439 static void
441 {
443 }
444 
445 #endif
446 
447 #if XMALLOC_STATISTICS
448 static void
449 info_get_mallstat(int size, int number, int oldnum, void *data)
450 {
451  StoreEntry *sentry = (StoreEntry *)data;
452 
453 // format: "%12s %15s %6s %12s\n","Alloc Size","Count","Delta","Alloc/sec"
454  if (number > 0)
455  storeAppendPrintf(sentry, "%12d %15d %6d %.1f\n", size, number, number - oldnum, xdiv((number - oldnum), xm_deltat));
456 }
457 
458 #endif
459 
460 void
462 {
463 
464  struct rusage rusage;
465  double cputime;
466  double runtime;
467 #if HAVE_MSTATS && HAVE_GNUMALLOC_H
468  struct mstats ms;
469 #endif
470 
471  runtime = tvSubDsec(squid_start, current_time);
472 
473  if (runtime == 0.0)
474  runtime = 1.0;
475 
476  stats.squid_start = squid_start;
477 
478  stats.current_time = current_time;
479 
481 
483 
485 
487 
489 
490 #if USE_HTCP
491 
493 
495 
496 #endif
497 
499 
500  stats.avg_client_http_requests = statCounter.client_http.requests / (runtime / 60.0);
501 
502  stats.avg_icp_messages = (statCounter.icp.pkts_sent + statCounter.icp.pkts_recv) / (runtime / 60.0);
503 
505  stats.avg_loop_time = 1000.0 * runtime / statCounter.select_loops;
506 
509 
512 
515 
518 
519  Store::Root().getStats(stats.store);
520 
522 
523  stats.http_requests5 = statPctileSvc(0.5, 5, PCTILE_HTTP);
524  stats.http_requests60 = statPctileSvc(0.5, 60, PCTILE_HTTP);
525 
526  stats.cache_misses5 = statPctileSvc(0.5, 5, PCTILE_MISS);
527  stats.cache_misses60 = statPctileSvc(0.5, 60, PCTILE_MISS);
528 
529  stats.cache_hits5 = statPctileSvc(0.5, 5, PCTILE_HIT);
530  stats.cache_hits60 = statPctileSvc(0.5, 60, PCTILE_HIT);
531 
532  stats.near_hits5 = statPctileSvc(0.5, 5, PCTILE_NH);
533  stats.near_hits60 = statPctileSvc(0.5, 60, PCTILE_NH);
534 
537 
538  stats.dns_lookups5 = statPctileSvc(0.5, 5, PCTILE_DNS);
539  stats.dns_lookups60 = statPctileSvc(0.5, 60, PCTILE_DNS);
540 
542  stats.icp_queries60 = statPctileSvc(0.5, 60, PCTILE_ICP_QUERY);
543 
544  squid_getrusage(&rusage);
545  cputime = rusage_cputime(&rusage);
546 
547  stats.up_time = runtime;
548  stats.cpu_time = cputime;
549  stats.cpu_usage = Math::doublePercent(cputime, runtime);
550  stats.cpu_usage5 = statCPUUsage(5);
551  stats.cpu_usage60 = statCPUUsage(60);
552 
553  stats.maxrss = rusage_maxrss(&rusage);
554 
555  stats.page_faults = rusage_pagefaults(&rusage);
556 
557 #if HAVE_MSTATS && HAVE_GNUMALLOC_H
558 
559  ms = mstats();
560 
561  stats.ms_bytes_total = ms.bytes_total;
562 
563  stats.ms_bytes_free = ms.bytes_free;
564 
565 #endif
566 
568 
569  {
570  MemPoolGlobalStats mp_stats;
571  memPoolGetGlobalStats(&mp_stats);
572  stats.gb_saved_count = mp_stats.TheMeter->gb_saved.count;
573  stats.gb_freed_count = mp_stats.TheMeter->gb_freed.count;
574  }
575 
576  stats.max_fd = Squid_MaxFD;
577  stats.biggest_fd = Biggest_FD;
578  stats.number_fd = Number_FD;
579  stats.opening_fd = Opening_FD;
580  stats.num_fd_free = fdNFree();
581  stats.reserved_fd = RESERVED_FD;
582 }
583 
584 void
586 {
587  storeAppendPrintf(sentry, "Squid Object Cache: Version %s\n",
589 
590  storeAppendPrintf(sentry, "Build Info: " SQUID_BUILD_INFO "\n");
591 
592 #if _SQUID_WINDOWS_
593  if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) {
594  storeAppendPrintf(sentry,"\nRunning as " SQUIDSBUFPH " Windows System Service on %s\n",
595  SQUIDSBUFPRINT(service_name), WIN32_OS_string);
596  storeAppendPrintf(sentry,"Service command line is: %s\n", WIN32_Service_Command_Line);
597  } else
598  storeAppendPrintf(sentry,"Running on %s\n",WIN32_OS_string);
599 #else
600  storeAppendPrintf(sentry,"Service Name: " SQUIDSBUFPH "\n", SQUIDSBUFPRINT(service_name));
601 #endif
602 
603  storeAppendPrintf(sentry, "Start Time:\t%s\n",
604  mkrfc1123(stats.squid_start.tv_sec));
605 
606  storeAppendPrintf(sentry, "Current Time:\t%s\n",
607  mkrfc1123(stats.current_time.tv_sec));
608 
609  storeAppendPrintf(sentry, "Connection information for %s:\n",APP_SHORTNAME);
610 
611  if (Config.onoff.client_db)
612  storeAppendPrintf(sentry, "\tNumber of clients accessing cache:\t%.0f\n", stats.client_http_clients);
613  else
614  sentry->append("\tNumber of clients accessing cache:\t(client_db off)\n", 52);
615 
616  storeAppendPrintf(sentry, "\tNumber of HTTP requests received:\t%.0f\n",
617  stats.client_http_requests);
618 
619  storeAppendPrintf(sentry, "\tNumber of ICP messages received:\t%.0f\n",
620  stats.icp_pkts_recv);
621 
622  storeAppendPrintf(sentry, "\tNumber of ICP messages sent:\t%.0f\n",
623  stats.icp_pkts_sent);
624 
625  storeAppendPrintf(sentry, "\tNumber of queued ICP replies:\t%.0f\n",
626  stats.icp_replies_queued);
627 
628 #if USE_HTCP
629 
630  storeAppendPrintf(sentry, "\tNumber of HTCP messages received:\t%.0f\n",
631  stats.htcp_pkts_recv);
632 
633  storeAppendPrintf(sentry, "\tNumber of HTCP messages sent:\t%.0f\n",
634  stats.htcp_pkts_sent);
635 
636 #endif
637 
638  double fct = stats.count > 1 ? stats.count : 1.0;
639  storeAppendPrintf(sentry, "\tRequest failure ratio:\t%5.2f\n",
640  stats.request_failure_ratio / fct);
641 
642  storeAppendPrintf(sentry, "\tAverage HTTP requests per minute since start:\t%.1f\n",
644 
645  storeAppendPrintf(sentry, "\tAverage ICP messages per minute since start:\t%.1f\n",
646  stats.avg_icp_messages);
647 
648  storeAppendPrintf(sentry, "\tSelect loop called: %.0f times, %0.3f ms avg\n",
649  stats.select_loops, stats.avg_loop_time / fct);
650 
651  storeAppendPrintf(sentry, "Cache information for %s:\n",APP_SHORTNAME);
652 
653  storeAppendPrintf(sentry, "\tHits as %% of all requests:\t5min: %3.1f%%, 60min: %3.1f%%\n",
654  stats.request_hit_ratio5 / fct,
655  stats.request_hit_ratio60 / fct);
656 
657  storeAppendPrintf(sentry, "\tHits as %% of bytes sent:\t5min: %3.1f%%, 60min: %3.1f%%\n",
658  stats.byte_hit_ratio5 / fct,
659  stats.byte_hit_ratio60 / fct);
660 
661  storeAppendPrintf(sentry, "\tMemory hits as %% of hit requests:\t5min: %3.1f%%, 60min: %3.1f%%\n",
662  stats.request_hit_mem_ratio5 / fct,
663  stats.request_hit_mem_ratio60 / fct);
664 
665  storeAppendPrintf(sentry, "\tDisk hits as %% of hit requests:\t5min: %3.1f%%, 60min: %3.1f%%\n",
666  stats.request_hit_disk_ratio5 / fct,
667  stats.request_hit_disk_ratio60 / fct);
668 
669  storeAppendPrintf(sentry, "\tStorage Swap size:\t%.0f KB\n",
670  stats.store.swap.size / 1024);
671 
672  storeAppendPrintf(sentry, "\tStorage Swap capacity:\t%4.1f%% used, %4.1f%% free\n",
675 
676  storeAppendPrintf(sentry, "\tStorage Mem size:\t%.0f KB\n",
677  stats.store.mem.size / 1024);
678 
679  storeAppendPrintf(sentry, "\tStorage Mem capacity:\t%4.1f%% used, %4.1f%% free\n",
682 
683  storeAppendPrintf(sentry, "\tMean Object Size:\t%0.2f KB\n",
684  stats.store.swap.meanObjectSize() / 1024);
685 
686  storeAppendPrintf(sentry, "\tRequests given to unlinkd:\t%.0f\n",
687  stats.unlink_requests);
688 
689  storeAppendPrintf(sentry, "Median Service Times (seconds) 5 min 60 min:\n");
690 
691  fct = stats.count > 1 ? stats.count * 1000.0 : 1000.0;
692  storeAppendPrintf(sentry, "\tHTTP Requests (All): %8.5f %8.5f\n",
693  stats.http_requests5 / fct,
694  stats.http_requests60 / fct);
695 
696  storeAppendPrintf(sentry, "\tCache Misses: %8.5f %8.5f\n",
697  stats.cache_misses5 / fct,
698  stats.cache_misses60 / fct);
699 
700  storeAppendPrintf(sentry, "\tCache Hits: %8.5f %8.5f\n",
701  stats.cache_hits5 / fct,
702  stats.cache_hits60 / fct);
703 
704  storeAppendPrintf(sentry, "\tNear Hits: %8.5f %8.5f\n",
705  stats.near_hits5 / fct,
706  stats.near_hits60 / fct);
707 
708  storeAppendPrintf(sentry, "\tNot-Modified Replies: %8.5f %8.5f\n",
709  stats.not_modified_replies5 / fct,
710  stats.not_modified_replies60 / fct);
711 
712  storeAppendPrintf(sentry, "\tDNS Lookups: %8.5f %8.5f\n",
713  stats.dns_lookups5 / fct,
714  stats.dns_lookups60 / fct);
715 
716  fct = stats.count > 1 ? stats.count * 1000000.0 : 1000000.0;
717  storeAppendPrintf(sentry, "\tICP Queries: %8.5f %8.5f\n",
718  stats.icp_queries5 / fct,
719  stats.icp_queries60 / fct);
720 
721  storeAppendPrintf(sentry, "Resource usage for %s:\n", APP_SHORTNAME);
722 
723  storeAppendPrintf(sentry, "\tUP Time:\t%.3f seconds\n", stats.up_time);
724 
725  storeAppendPrintf(sentry, "\tCPU Time:\t%.3f seconds\n", stats.cpu_time);
726 
727  storeAppendPrintf(sentry, "\tCPU Usage:\t%.2f%%\n",
728  stats.cpu_usage);
729 
730  storeAppendPrintf(sentry, "\tCPU Usage, 5 minute avg:\t%.2f%%\n",
731  stats.cpu_usage5);
732 
733  storeAppendPrintf(sentry, "\tCPU Usage, 60 minute avg:\t%.2f%%\n",
734  stats.cpu_usage60);
735 
736  storeAppendPrintf(sentry, "\tMaximum Resident Size: %.0f KB\n",
737  stats.maxrss);
738 
739  storeAppendPrintf(sentry, "\tPage faults with physical i/o: %.0f\n",
740  stats.page_faults);
741 
742 #if HAVE_MSTATS && HAVE_GNUMALLOC_H
743 
744  storeAppendPrintf(sentry, "Memory usage for %s via mstats():\n",APP_SHORTNAME);
745 
746  storeAppendPrintf(sentry, "\tTotal space in arena: %6.0f KB\n",
747  stats.ms_bytes_total / 1024);
748 
749  storeAppendPrintf(sentry, "\tTotal free: %6.0f KB %.0f%%\n",
750  stats.ms_bytes_free / 1024,
751  Math::doublePercent(stats.ms_bytes_free, stats.ms_bytes_total));
752 
753 #endif
754 
755  storeAppendPrintf(sentry, "Memory accounted for:\n");
756  storeAppendPrintf(sentry, "\tTotal accounted: %6.0f KB\n",
757  stats.total_accounted / 1024);
758  {
759  MemPoolGlobalStats mp_stats;
760  memPoolGetGlobalStats(&mp_stats);
761  storeAppendPrintf(sentry, "\tmemPoolAlloc calls: %9.0f\n",
762  stats.gb_saved_count);
763  storeAppendPrintf(sentry, "\tmemPoolFree calls: %9.0f\n",
764  stats.gb_freed_count);
765  }
766 
767  storeAppendPrintf(sentry, "File descriptor usage for %s:\n", APP_SHORTNAME);
768  storeAppendPrintf(sentry, "\tMaximum number of file descriptors: %4.0f\n",
769  stats.max_fd);
770  storeAppendPrintf(sentry, "\tLargest file desc currently in use: %4.0f\n",
771  stats.biggest_fd);
772  storeAppendPrintf(sentry, "\tNumber of file desc currently in use: %4.0f\n",
773  stats.number_fd);
774  storeAppendPrintf(sentry, "\tFiles queued for open: %4.0f\n",
775  stats.opening_fd);
776  storeAppendPrintf(sentry, "\tAvailable number of file descriptors: %4.0f\n",
777  stats.num_fd_free);
778  storeAppendPrintf(sentry, "\tReserved number of file descriptors: %4.0f\n",
779  stats.reserved_fd);
780  storeAppendPrintf(sentry, "\tStore Disk files open: %4.0f\n",
781  stats.store.swap.open_disk_fd);
782 
783  storeAppendPrintf(sentry, "Internal Data Structures:\n");
784  storeAppendPrintf(sentry, "\t%6.0f StoreEntries\n",
785  stats.store.store_entry_count);
786  storeAppendPrintf(sentry, "\t%6.0f StoreEntries with MemObjects\n",
787  stats.store.mem_object_count);
788  storeAppendPrintf(sentry, "\t%6.0f Hot Object Cache Items\n",
789  stats.store.mem.count);
790  storeAppendPrintf(sentry, "\t%6.0f on-disk objects\n",
791  stats.store.swap.count);
792 }
793 
794 void
796 {
797 #if XMALLOC_STATISTICS
798  xm_deltat = current_dtime - xm_time;
799  xm_time = current_dtime;
800  storeAppendPrintf(sentry, "\nMemory allocation statistics\n");
801  storeAppendPrintf(sentry, "%12s %15s %6s %12s\n","Alloc Size","Count","Delta","Alloc/sec");
802  malloc_statistics(info_get_mallstat, sentry);
803 #endif
804 }
805 
806 void
808 {
809  for (int i = 0; i < Mgr::ServiceTimesActionData::seriesSize; ++i) {
810  double p = (i + 1) * 5 / 100.0;
811  stats.http_requests5[i] = statPctileSvc(p, 5, PCTILE_HTTP);
812  stats.http_requests60[i] = statPctileSvc(p, 60, PCTILE_HTTP);
813 
814  stats.cache_misses5[i] = statPctileSvc(p, 5, PCTILE_MISS);
815  stats.cache_misses60[i] = statPctileSvc(p, 60, PCTILE_MISS);
816 
817  stats.cache_hits5[i] = statPctileSvc(p, 5, PCTILE_HIT);
818  stats.cache_hits60[i] = statPctileSvc(p, 60, PCTILE_HIT);
819 
820  stats.near_hits5[i] = statPctileSvc(p, 5, PCTILE_NH);
821  stats.near_hits60[i] = statPctileSvc(p, 60, PCTILE_NH);
822 
825 
826  stats.dns_lookups5[i] = statPctileSvc(p, 5, PCTILE_DNS);
827  stats.dns_lookups60[i] = statPctileSvc(p, 60, PCTILE_DNS);
828 
831  }
832 }
833 
834 void
836 {
837  storeAppendPrintf(sentry, "Service Time Percentiles 5 min 60 min:\n");
838  double fct = stats.count > 1 ? stats.count * 1000.0 : 1000.0;
839  for (int i = 0; i < Mgr::ServiceTimesActionData::seriesSize; ++i) {
840  storeAppendPrintf(sentry, "\tHTTP Requests (All): %2d%% %8.5f %8.5f\n",
841  (i + 1) * 5,
842  stats.http_requests5[i] / fct,
843  stats.http_requests60[i] / fct);
844  }
845  for (int i = 0; i < Mgr::ServiceTimesActionData::seriesSize; ++i) {
846  storeAppendPrintf(sentry, "\tCache Misses: %2d%% %8.5f %8.5f\n",
847  (i + 1) * 5,
848  stats.cache_misses5[i] / fct,
849  stats.cache_misses60[i] / fct);
850  }
851  for (int i = 0; i < Mgr::ServiceTimesActionData::seriesSize; ++i) {
852  storeAppendPrintf(sentry, "\tCache Hits: %2d%% %8.5f %8.5f\n",
853  (i + 1) * 5,
854  stats.cache_hits5[i] / fct,
855  stats.cache_hits60[i] / fct);
856  }
857  for (int i = 0; i < Mgr::ServiceTimesActionData::seriesSize; ++i) {
858  storeAppendPrintf(sentry, "\tNear Hits: %2d%% %8.5f %8.5f\n",
859  (i + 1) * 5,
860  stats.near_hits5[i] / fct,
861  stats.near_hits60[i] / fct);
862  }
863  for (int i = 0; i < Mgr::ServiceTimesActionData::seriesSize; ++i) {
864  storeAppendPrintf(sentry, "\tNot-Modified Replies: %2d%% %8.5f %8.5f\n",
865  (i + 1) * 5,
866  stats.not_modified_replies5[i] / fct,
867  stats.not_modified_replies60[i] / fct);
868  }
869  for (int i = 0; i < Mgr::ServiceTimesActionData::seriesSize; ++i) {
870  storeAppendPrintf(sentry, "\tDNS Lookups: %2d%% %8.5f %8.5f\n",
871  (i + 1) * 5,
872  stats.dns_lookups5[i] / fct,
873  stats.dns_lookups60[i] / fct);
874  }
875  fct = stats.count > 1 ? stats.count * 1000000.0 : 1000000.0;
876  for (int i = 0; i < Mgr::ServiceTimesActionData::seriesSize; ++i) {
877  storeAppendPrintf(sentry, "\tICP Queries: %2d%% %8.5f %8.5f\n",
878  (i + 1) * 5,
879  stats.icp_queries5[i] / fct,
880  stats.icp_queries60[i] / fct);
881  }
882 }
883 
884 static void
885 statAvgDump(StoreEntry * sentry, int minutes, int hours)
886 {
888  GetAvgStat(stats, minutes, hours);
889  DumpAvgStat(stats, sentry);
890 }
891 
892 #define XAVG(X) (dt ? (double) (f->X - l->X) / dt : 0.0)
893 void
894 GetAvgStat(Mgr::IntervalActionData& stats, int minutes, int hours)
895 {
896  StatCounters *f;
897  StatCounters *l;
898  double dt;
899  double ct;
900  assert(N_COUNT_HIST > 1);
901  assert(minutes > 0 || hours > 0);
902  f = &CountHist[0];
903  l = f;
904 
905  if (minutes > 0 && hours == 0) {
906  /* checking minute readings ... */
907 
908  if (minutes > N_COUNT_HIST - 1)
909  minutes = N_COUNT_HIST - 1;
910 
911  l = &CountHist[minutes];
912  } else if (minutes == 0 && hours > 0) {
913  /* checking hour readings ... */
914 
915  if (hours > N_COUNT_HOUR_HIST - 1)
916  hours = N_COUNT_HOUR_HIST - 1;
917 
918  l = &CountHourHist[hours];
919  } else {
920  debugs(18, DBG_IMPORTANT, "statAvgDump: Invalid args, minutes=" << minutes << ", hours=" << hours);
921  return;
922  }
923 
924  dt = tvSubDsec(l->timestamp, f->timestamp);
925  ct = f->cputime - l->cputime;
926 
927  stats.sample_start_time = l->timestamp;
928  stats.sample_end_time = f->timestamp;
929 
930  stats.client_http_requests = XAVG(client_http.requests);
931  stats.client_http_hits = XAVG(client_http.hits);
932  stats.client_http_errors = XAVG(client_http.errors);
933  stats.client_http_kbytes_in = XAVG(client_http.kbytes_in.kb);
934  stats.client_http_kbytes_out = XAVG(client_http.kbytes_out.kb);
935 
937  f->client_http.allSvcTime) / 1000.0;
939  f->client_http.missSvcTime) / 1000.0;
941  f->client_http.nearMissSvcTime) / 1000.0;
943  f->client_http.nearHitSvcTime) / 1000.0;
945  f->client_http.hitSvcTime) / 1000.0;
946 
947  stats.server_all_requests = XAVG(server.all.requests);
948  stats.server_all_errors = XAVG(server.all.errors);
949  stats.server_all_kbytes_in = XAVG(server.all.kbytes_in.kb);
950  stats.server_all_kbytes_out = XAVG(server.all.kbytes_out.kb);
951 
952  stats.server_http_requests = XAVG(server.http.requests);
953  stats.server_http_errors = XAVG(server.http.errors);
954  stats.server_http_kbytes_in = XAVG(server.http.kbytes_in.kb);
955  stats.server_http_kbytes_out = XAVG(server.http.kbytes_out.kb);
956 
957  stats.server_ftp_requests = XAVG(server.ftp.requests);
958  stats.server_ftp_errors = XAVG(server.ftp.errors);
959  stats.server_ftp_kbytes_in = XAVG(server.ftp.kbytes_in.kb);
960  stats.server_ftp_kbytes_out = XAVG(server.ftp.kbytes_out.kb);
961 
962  stats.server_other_requests = XAVG(server.other.requests);
963  stats.server_other_errors = XAVG(server.other.errors);
964  stats.server_other_kbytes_in = XAVG(server.other.kbytes_in.kb);
965  stats.server_other_kbytes_out = XAVG(server.other.kbytes_out.kb);
966 
967  stats.icp_pkts_sent = XAVG(icp.pkts_sent);
968  stats.icp_pkts_recv = XAVG(icp.pkts_recv);
969  stats.icp_queries_sent = XAVG(icp.queries_sent);
970  stats.icp_replies_sent = XAVG(icp.replies_sent);
971  stats.icp_queries_recv = XAVG(icp.queries_recv);
972  stats.icp_replies_recv = XAVG(icp.replies_recv);
973  stats.icp_replies_queued = XAVG(icp.replies_queued);
974  stats.icp_query_timeouts = XAVG(icp.query_timeouts);
975  stats.icp_kbytes_sent = XAVG(icp.kbytes_sent.kb);
976  stats.icp_kbytes_recv = XAVG(icp.kbytes_recv.kb);
977  stats.icp_q_kbytes_sent = XAVG(icp.q_kbytes_sent.kb);
978  stats.icp_r_kbytes_sent = XAVG(icp.r_kbytes_sent.kb);
979  stats.icp_q_kbytes_recv = XAVG(icp.q_kbytes_recv.kb);
980  stats.icp_r_kbytes_recv = XAVG(icp.r_kbytes_recv.kb);
981 
983  f->icp.querySvcTime) / 1000000.0;
985  f->icp.replySvcTime) / 1000000.0;
987  f->dns.svcTime) / 1000.0;
988 
989  stats.unlink_requests = XAVG(unlink.requests);
990  stats.page_faults = XAVG(page_faults);
991  stats.select_loops = XAVG(select_loops);
992  stats.select_fds = XAVG(select_fds);
994  (f->select_time - l->select_time) / (f->select_fds - l->select_fds) : 0.0;
995 
997  stats.swap_outs = XAVG(swap.outs);
998  stats.swap_ins = XAVG(swap.ins);
999  stats.swap_files_cleaned = XAVG(swap.files_cleaned);
1000  stats.aborted_requests = XAVG(aborted_requests);
1001 
1002  stats.syscalls_disk_opens = XAVG(syscalls.disk.opens);
1003  stats.syscalls_disk_closes = XAVG(syscalls.disk.closes);
1004  stats.syscalls_disk_reads = XAVG(syscalls.disk.reads);
1005  stats.syscalls_disk_writes = XAVG(syscalls.disk.writes);
1006  stats.syscalls_disk_seeks = XAVG(syscalls.disk.seeks);
1007  stats.syscalls_disk_unlinks = XAVG(syscalls.disk.unlinks);
1008  stats.syscalls_sock_accepts = XAVG(syscalls.sock.accepts);
1009  stats.syscalls_sock_sockets = XAVG(syscalls.sock.sockets);
1010  stats.syscalls_sock_connects = XAVG(syscalls.sock.connects);
1011  stats.syscalls_sock_binds = XAVG(syscalls.sock.binds);
1012  stats.syscalls_sock_closes = XAVG(syscalls.sock.closes);
1013  stats.syscalls_sock_reads = XAVG(syscalls.sock.reads);
1014  stats.syscalls_sock_writes = XAVG(syscalls.sock.writes);
1015  stats.syscalls_sock_recvfroms = XAVG(syscalls.sock.recvfroms);
1016  stats.syscalls_sock_sendtos = XAVG(syscalls.sock.sendtos);
1017  stats.syscalls_selects = XAVG(syscalls.selects);
1018 
1019  stats.cpu_time = ct;
1020  stats.wall_time = dt;
1021 }
1022 
1023 void
1025 {
1026  storeAppendPrintf(sentry, "sample_start_time = %d.%d (%s)\n",
1027  (int)stats.sample_start_time.tv_sec,
1028  (int)stats.sample_start_time.tv_usec,
1029  mkrfc1123(stats.sample_start_time.tv_sec));
1030  storeAppendPrintf(sentry, "sample_end_time = %d.%d (%s)\n",
1031  (int)stats.sample_end_time.tv_sec,
1032  (int)stats.sample_end_time.tv_usec,
1033  mkrfc1123(stats.sample_end_time.tv_sec));
1034 
1035  storeAppendPrintf(sentry, "client_http.requests = %f/sec\n",
1036  stats.client_http_requests);
1037  storeAppendPrintf(sentry, "client_http.hits = %f/sec\n",
1038  stats.client_http_hits);
1039  storeAppendPrintf(sentry, "client_http.errors = %f/sec\n",
1040  stats.client_http_errors);
1041  storeAppendPrintf(sentry, "client_http.kbytes_in = %f/sec\n",
1042  stats.client_http_kbytes_in);
1043  storeAppendPrintf(sentry, "client_http.kbytes_out = %f/sec\n",
1044  stats.client_http_kbytes_out);
1045 
1046  double fct = stats.count > 1 ? stats.count : 1.0;
1047  storeAppendPrintf(sentry, "client_http.all_median_svc_time = %f seconds\n",
1048  stats.client_http_all_median_svc_time / fct);
1049  storeAppendPrintf(sentry, "client_http.miss_median_svc_time = %f seconds\n",
1050  stats.client_http_miss_median_svc_time / fct);
1051  storeAppendPrintf(sentry, "client_http.nm_median_svc_time = %f seconds\n",
1052  stats.client_http_nm_median_svc_time / fct);
1053  storeAppendPrintf(sentry, "client_http.nh_median_svc_time = %f seconds\n",
1054  stats.client_http_nh_median_svc_time / fct);
1055  storeAppendPrintf(sentry, "client_http.hit_median_svc_time = %f seconds\n",
1056  stats.client_http_hit_median_svc_time / fct);
1057 
1058  storeAppendPrintf(sentry, "server.all.requests = %f/sec\n",
1059  stats.server_all_requests);
1060  storeAppendPrintf(sentry, "server.all.errors = %f/sec\n",
1061  stats.server_all_errors);
1062  storeAppendPrintf(sentry, "server.all.kbytes_in = %f/sec\n",
1063  stats.server_all_kbytes_in);
1064  storeAppendPrintf(sentry, "server.all.kbytes_out = %f/sec\n",
1065  stats.server_all_kbytes_out);
1066 
1067  storeAppendPrintf(sentry, "server.http.requests = %f/sec\n",
1068  stats.server_http_requests);
1069  storeAppendPrintf(sentry, "server.http.errors = %f/sec\n",
1070  stats.server_http_errors);
1071  storeAppendPrintf(sentry, "server.http.kbytes_in = %f/sec\n",
1072  stats.server_http_kbytes_in);
1073  storeAppendPrintf(sentry, "server.http.kbytes_out = %f/sec\n",
1074  stats.server_http_kbytes_out);
1075 
1076  storeAppendPrintf(sentry, "server.ftp.requests = %f/sec\n",
1077  stats.server_ftp_requests);
1078  storeAppendPrintf(sentry, "server.ftp.errors = %f/sec\n",
1079  stats.server_ftp_errors);
1080  storeAppendPrintf(sentry, "server.ftp.kbytes_in = %f/sec\n",
1081  stats.server_ftp_kbytes_in);
1082  storeAppendPrintf(sentry, "server.ftp.kbytes_out = %f/sec\n",
1083  stats.server_ftp_kbytes_out);
1084 
1085  storeAppendPrintf(sentry, "server.other.requests = %f/sec\n",
1086  stats.server_other_requests);
1087  storeAppendPrintf(sentry, "server.other.errors = %f/sec\n",
1088  stats.server_other_errors);
1089  storeAppendPrintf(sentry, "server.other.kbytes_in = %f/sec\n",
1090  stats.server_other_kbytes_in);
1091  storeAppendPrintf(sentry, "server.other.kbytes_out = %f/sec\n",
1092  stats.server_other_kbytes_out);
1093 
1094  storeAppendPrintf(sentry, "icp.pkts_sent = %f/sec\n",
1095  stats.icp_pkts_sent);
1096  storeAppendPrintf(sentry, "icp.pkts_recv = %f/sec\n",
1097  stats.icp_pkts_recv);
1098  storeAppendPrintf(sentry, "icp.queries_sent = %f/sec\n",
1099  stats.icp_queries_sent);
1100  storeAppendPrintf(sentry, "icp.replies_sent = %f/sec\n",
1101  stats.icp_replies_sent);
1102  storeAppendPrintf(sentry, "icp.queries_recv = %f/sec\n",
1103  stats.icp_queries_recv);
1104  storeAppendPrintf(sentry, "icp.replies_recv = %f/sec\n",
1105  stats.icp_replies_recv);
1106  storeAppendPrintf(sentry, "icp.replies_queued = %f/sec\n",
1107  stats.icp_replies_queued);
1108  storeAppendPrintf(sentry, "icp.query_timeouts = %f/sec\n",
1109  stats.icp_query_timeouts);
1110  storeAppendPrintf(sentry, "icp.kbytes_sent = %f/sec\n",
1111  stats.icp_kbytes_sent);
1112  storeAppendPrintf(sentry, "icp.kbytes_recv = %f/sec\n",
1113  stats.icp_kbytes_recv);
1114  storeAppendPrintf(sentry, "icp.q_kbytes_sent = %f/sec\n",
1115  stats.icp_q_kbytes_sent);
1116  storeAppendPrintf(sentry, "icp.r_kbytes_sent = %f/sec\n",
1117  stats.icp_r_kbytes_sent);
1118  storeAppendPrintf(sentry, "icp.q_kbytes_recv = %f/sec\n",
1119  stats.icp_q_kbytes_recv);
1120  storeAppendPrintf(sentry, "icp.r_kbytes_recv = %f/sec\n",
1121  stats.icp_r_kbytes_recv);
1122  storeAppendPrintf(sentry, "icp.query_median_svc_time = %f seconds\n",
1123  stats.icp_query_median_svc_time / fct);
1124  storeAppendPrintf(sentry, "icp.reply_median_svc_time = %f seconds\n",
1125  stats.icp_reply_median_svc_time / fct);
1126  storeAppendPrintf(sentry, "dns.median_svc_time = %f seconds\n",
1127  stats.dns_median_svc_time / fct);
1128  storeAppendPrintf(sentry, "unlink.requests = %f/sec\n",
1129  stats.unlink_requests);
1130  storeAppendPrintf(sentry, "page_faults = %f/sec\n",
1131  stats.page_faults);
1132  storeAppendPrintf(sentry, "select_loops = %f/sec\n",
1133  stats.select_loops);
1134  storeAppendPrintf(sentry, "select_fds = %f/sec\n",
1135  stats.select_fds);
1136  storeAppendPrintf(sentry, "average_select_fd_period = %f/fd\n",
1137  stats.average_select_fd_period / fct);
1138  storeAppendPrintf(sentry, "median_select_fds = %f\n",
1139  stats.median_select_fds / fct);
1140  storeAppendPrintf(sentry, "swap.outs = %f/sec\n",
1141  stats.swap_outs);
1142  storeAppendPrintf(sentry, "swap.ins = %f/sec\n",
1143  stats.swap_ins);
1144  storeAppendPrintf(sentry, "swap.files_cleaned = %f/sec\n",
1145  stats.swap_files_cleaned);
1146  storeAppendPrintf(sentry, "aborted_requests = %f/sec\n",
1147  stats.aborted_requests);
1148 
1149 #if USE_POLL
1150  storeAppendPrintf(sentry, "syscalls.polls = %f/sec\n", stats.syscalls_selects);
1151 #elif defined(USE_SELECT) || defined(USE_SELECT_WIN32)
1152  storeAppendPrintf(sentry, "syscalls.selects = %f/sec\n", stats.syscalls_selects);
1153 #endif
1154 
1155  storeAppendPrintf(sentry, "syscalls.disk.opens = %f/sec\n", stats.syscalls_disk_opens);
1156  storeAppendPrintf(sentry, "syscalls.disk.closes = %f/sec\n", stats.syscalls_disk_closes);
1157  storeAppendPrintf(sentry, "syscalls.disk.reads = %f/sec\n", stats.syscalls_disk_reads);
1158  storeAppendPrintf(sentry, "syscalls.disk.writes = %f/sec\n", stats.syscalls_disk_writes);
1159  storeAppendPrintf(sentry, "syscalls.disk.seeks = %f/sec\n", stats.syscalls_disk_seeks);
1160  storeAppendPrintf(sentry, "syscalls.disk.unlinks = %f/sec\n", stats.syscalls_disk_unlinks);
1161  storeAppendPrintf(sentry, "syscalls.sock.accepts = %f/sec\n", stats.syscalls_sock_accepts);
1162  storeAppendPrintf(sentry, "syscalls.sock.sockets = %f/sec\n", stats.syscalls_sock_sockets);
1163  storeAppendPrintf(sentry, "syscalls.sock.connects = %f/sec\n", stats.syscalls_sock_connects);
1164  storeAppendPrintf(sentry, "syscalls.sock.binds = %f/sec\n", stats.syscalls_sock_binds);
1165  storeAppendPrintf(sentry, "syscalls.sock.closes = %f/sec\n", stats.syscalls_sock_closes);
1166  storeAppendPrintf(sentry, "syscalls.sock.reads = %f/sec\n", stats.syscalls_sock_reads);
1167  storeAppendPrintf(sentry, "syscalls.sock.writes = %f/sec\n", stats.syscalls_sock_writes);
1168  storeAppendPrintf(sentry, "syscalls.sock.recvfroms = %f/sec\n", stats.syscalls_sock_recvfroms);
1169  storeAppendPrintf(sentry, "syscalls.sock.sendtos = %f/sec\n", stats.syscalls_sock_sendtos);
1170 
1171  storeAppendPrintf(sentry, "cpu_time = %f seconds\n", stats.cpu_time);
1172  storeAppendPrintf(sentry, "wall_time = %f seconds\n", stats.wall_time);
1173  storeAppendPrintf(sentry, "cpu_usage = %f%%\n", Math::doublePercent(stats.cpu_time, stats.wall_time));
1174 }
1175 
1176 static void
1178 {
1179  Mgr::RegisterAction("info", "General Runtime Information",
1180  &Mgr::InfoAction::Create, 0, 1);
1181  Mgr::RegisterAction("service_times", "Service Times (Percentiles)",
1183  Mgr::RegisterAction("filedescriptors", "Process Filedescriptor Allocation",
1184  fde::DumpStats, 0, 1);
1185  Mgr::RegisterAction("objects", "All Cache Objects", stat_objects_get, 0, 0);
1186  Mgr::RegisterAction("vm_objects", "In-Memory and In-Transit Objects",
1187  stat_vmobjects_get, 0, 0);
1188  Mgr::RegisterAction("io", "Server-side network read() size histograms",
1189  &Mgr::IoAction::Create, 0, 1);
1190  Mgr::RegisterAction("counters", "Traffic and Resource Counters",
1192  Mgr::RegisterAction("peer_select", "Peer Selection Algorithms",
1193  statPeerSelect, 0, 1);
1194  Mgr::RegisterAction("digest_stats", "Cache Digest and ICP blob",
1195  statDigestBlob, 0, 1);
1196  Mgr::RegisterAction("5min", "5 Minute Average of Counters",
1198  Mgr::RegisterAction("60min", "60 Minute Average of Counters",
1200  Mgr::RegisterAction("utilization", "Cache Utilization",
1201  statUtilization, 0, 1);
1202  Mgr::RegisterAction("histograms", "Full Histogram Counts",
1203  statCountersHistograms, 0, 1);
1204  Mgr::RegisterAction("active_requests",
1205  "Client-side Active Requests",
1206  statClientRequests, 0, 1);
1207 #if USE_AUTH
1208  Mgr::RegisterAction("username_cache",
1209  "Active Cached Usernames",
1211 #endif
1212 #if DEBUG_OPENFD
1213  Mgr::RegisterAction("openfd_objects", "Objects with Swapout files open",
1214  statOpenfdObj, 0, 0);
1215 #endif
1216 #if STAT_GRAPHS
1217  Mgr::RegisterAction("graph_variables", "Display cache metrics graphically",
1218  statGraphDump, 0, 1);
1219 #endif
1220 }
1221 
1222 void
1224 {
1225  int i;
1226  debugs(18, 5, "statInit: Initializing...");
1227 
1228  for (i = 0; i < N_COUNT_HIST; ++i)
1229  statCountersInit(&CountHist[i]);
1230 
1231  for (i = 0; i < N_COUNT_HOUR_HIST; ++i)
1232  statCountersInit(&CountHourHist[i]);
1233 
1235 
1236  eventAdd("statAvgTick", statAvgTick, NULL, (double) COUNT_INTERVAL, 1);
1237 
1239 
1241 
1243 }
1244 
1245 static void
1247 {
1248  StatCounters *t = &CountHist[0];
1249  StatCounters *p = &CountHist[1];
1250  StatCounters *c = &statCounter;
1251 
1252  struct rusage rusage;
1253  eventAdd("statAvgTick", statAvgTick, NULL, (double) COUNT_INTERVAL, 1);
1254  squid_getrusage(&rusage);
1255  c->page_faults = rusage_pagefaults(&rusage);
1256  c->cputime = rusage_cputime(&rusage);
1257  c->timestamp = current_time;
1258  /* even if NCountHist is small, we already Init()ed the tail */
1259  statCountersClean(CountHist + N_COUNT_HIST - 1);
1260  memmove(p, t, (N_COUNT_HIST - 1) * sizeof(StatCounters));
1261  statCountersCopy(t, c);
1262  ++NCountHist;
1263 
1264  if ((NCountHist % COUNT_INTERVAL) == 0) {
1265  /* we have an hours worth of readings. store previous hour */
1266  StatCounters *t2 = &CountHourHist[0];
1267  StatCounters *p2 = &CountHourHist[1];
1268  StatCounters *c2 = &CountHist[N_COUNT_HIST - 1];
1269  statCountersClean(CountHourHist + N_COUNT_HOUR_HIST - 1);
1270  memmove(p2, t2, (N_COUNT_HOUR_HIST - 1) * sizeof(StatCounters));
1271  statCountersCopy(t2, c2);
1272  ++NCountHourHist;
1273  }
1274 
1275  if (Config.warnings.high_rptm > 0) {
1276  int i = (int) statPctileSvc(0.5, 20, PCTILE_HTTP);
1277 
1278  if (Config.warnings.high_rptm < i)
1279  debugs(18, DBG_CRITICAL, "WARNING: Median response time is " << i << " milliseconds");
1280  }
1281 
1282  if (Config.warnings.high_pf) {
1283  int i = (CountHist[0].page_faults - CountHist[1].page_faults);
1284  double dt = tvSubDsec(CountHist[0].timestamp, CountHist[1].timestamp);
1285 
1286  if (i > 0 && dt > 0.0) {
1287  i /= (int) dt;
1288 
1289  if (Config.warnings.high_pf < i)
1290  debugs(18, DBG_CRITICAL, "WARNING: Page faults occuring at " << i << "/sec");
1291  }
1292  }
1293 
1294  if (Config.warnings.high_memory) {
1295  size_t i = 0;
1296 #if HAVE_MSTATS && HAVE_GNUMALLOC_H
1297  struct mstats ms = mstats();
1298  i = ms.bytes_total;
1299 #endif
1300  if (Config.warnings.high_memory < i)
1301  debugs(18, DBG_CRITICAL, "WARNING: Memory usage at " << ((unsigned long int)(i >> 20)) << " MB");
1302  }
1303 }
1304 
1305 static void
1307 {
1308  assert(C);
1309  memset(C, 0, sizeof(*C));
1310  C->timestamp = current_time;
1312 }
1313 
1314 /* add special cases here as they arrive */
1315 static void
1317 {
1318  /*
1319  * HTTP svc_time hist is kept in milli-seconds; max of 3 hours.
1320  */
1321  C->client_http.allSvcTime.logInit(300, 0.0, 3600000.0 * 3.0);
1322  C->client_http.missSvcTime.logInit(300, 0.0, 3600000.0 * 3.0);
1323  C->client_http.nearMissSvcTime.logInit(300, 0.0, 3600000.0 * 3.0);
1324  C->client_http.nearHitSvcTime.logInit(300, 0.0, 3600000.0 * 3.0);
1325  C->client_http.hitSvcTime.logInit(300, 0.0, 3600000.0 * 3.0);
1326  /*
1327  * ICP svc_time hist is kept in micro-seconds; max of 1 minute.
1328  */
1329  C->icp.querySvcTime.logInit(300, 0.0, 1000000.0 * 60.0);
1330  C->icp.replySvcTime.logInit(300, 0.0, 1000000.0 * 60.0);
1331  /*
1332  * DNS svc_time hist is kept in milli-seconds; max of 10 minutes.
1333  */
1334  C->dns.svcTime.logInit(300, 0.0, 60000.0 * 10.0);
1335  /*
1336  * Cache Digest Stuff
1337  */
1342  C->select_fds_hist.enumInit(256); /* was SQUID_MAXFD, but it is way too much. It is OK to crop this statistics */
1343 }
1344 
1345 /* add special cases here as they arrive */
1346 static void
1348 {
1349  assert(C);
1355  C->icp.querySvcTime.clear();
1356  C->icp.replySvcTime.clear();
1357  C->dns.svcTime.clear();
1358  C->cd.on_xition_count.clear();
1359  C->comm_udp_incoming.clear();
1360  C->comm_dns_incoming.clear();
1361  C->comm_tcp_incoming.clear();
1362  C->select_fds_hist.clear();
1363 }
1364 
1365 /* add special cases here as they arrive */
1366 static void
1368 {
1369  assert(dest && orig);
1370  /* this should take care of all the fields, but "special" ones */
1371  memcpy(dest, orig, sizeof(*dest));
1372  /* prepare space where to copy special entries */
1374  /* now handle special cases */
1375  /* note: we assert that histogram capacities do not change */
1380 
1382  dest->icp.querySvcTime=orig->icp.querySvcTime;
1383  dest->icp.replySvcTime=orig->icp.replySvcTime;
1384  dest->dns.svcTime=orig->dns.svcTime;
1385  dest->cd.on_xition_count=orig->cd.on_xition_count;
1389  dest->select_fds_hist=orig->select_fds_hist;
1390 }
1391 
1392 static void
1394 {
1395  storeAppendPrintf(sentry, "client_http.allSvcTime histogram:\n");
1397  storeAppendPrintf(sentry, "client_http.missSvcTime histogram:\n");
1399  storeAppendPrintf(sentry, "client_http.nearMissSvcTime histogram:\n");
1401  storeAppendPrintf(sentry, "client_http.nearHitSvcTime histogram:\n");
1403  storeAppendPrintf(sentry, "client_http.hitSvcTime histogram:\n");
1405  storeAppendPrintf(sentry, "icp.querySvcTime histogram:\n");
1407  storeAppendPrintf(sentry, "icp.replySvcTime histogram:\n");
1409  storeAppendPrintf(sentry, "dns.svc_time histogram:\n");
1410  statCounter.dns.svcTime.dump(sentry, NULL);
1411  storeAppendPrintf(sentry, "select_fds_hist histogram:\n");
1413 }
1414 
1415 static void
1417 {
1419  GetCountersStats(stats);
1420  DumpCountersStats(stats, sentry);
1421 }
1422 
1423 void
1425 {
1426  StatCounters *f = &statCounter;
1427 
1428  struct rusage rusage;
1429  squid_getrusage(&rusage);
1430  f->page_faults = rusage_pagefaults(&rusage);
1431  f->cputime = rusage_cputime(&rusage);
1432 
1433  stats.sample_time = f->timestamp;
1435  stats.client_http_hits = f->client_http.hits;
1440 
1441  stats.server_all_requests = f->server.all.requests;
1442  stats.server_all_errors = f->server.all.errors;
1443  stats.server_all_kbytes_in = f->server.all.kbytes_in.kb;
1444  stats.server_all_kbytes_out = f->server.all.kbytes_out.kb;
1445 
1446  stats.server_http_requests = f->server.http.requests;
1447  stats.server_http_errors = f->server.http.errors;
1448  stats.server_http_kbytes_in = f->server.http.kbytes_in.kb;
1449  stats.server_http_kbytes_out = f->server.http.kbytes_out.kb;
1450 
1451  stats.server_ftp_requests = f->server.ftp.requests;
1452  stats.server_ftp_errors = f->server.ftp.errors;
1453  stats.server_ftp_kbytes_in = f->server.ftp.kbytes_in.kb;
1454  stats.server_ftp_kbytes_out = f->server.ftp.kbytes_out.kb;
1455 
1456  stats.server_other_requests = f->server.other.requests;
1457  stats.server_other_errors = f->server.other.errors;
1458  stats.server_other_kbytes_in = f->server.other.kbytes_in.kb;
1459  stats.server_other_kbytes_out = f->server.other.kbytes_out.kb;
1460 
1461  stats.icp_pkts_sent = f->icp.pkts_sent;
1462  stats.icp_pkts_recv = f->icp.pkts_recv;
1463  stats.icp_queries_sent = f->icp.queries_sent;
1464  stats.icp_replies_sent = f->icp.replies_sent;
1465  stats.icp_queries_recv = f->icp.queries_recv;
1466  stats.icp_replies_recv = f->icp.replies_recv;
1469  stats.icp_kbytes_sent = f->icp.kbytes_sent.kb;
1470  stats.icp_kbytes_recv = f->icp.kbytes_recv.kb;
1475 
1476 #if USE_CACHE_DIGESTS
1477 
1478  stats.icp_times_used = f->icp.times_used;
1479  stats.cd_times_used = f->cd.times_used;
1480  stats.cd_msgs_sent = f->cd.msgs_sent;
1481  stats.cd_msgs_recv = f->cd.msgs_recv;
1482  stats.cd_memory = f->cd.memory.kb;
1483  stats.cd_local_memory = store_digest ? store_digest->mask_size / 1024 : 0;
1484  stats.cd_kbytes_sent = f->cd.kbytes_sent.kb;
1485  stats.cd_kbytes_recv = f->cd.kbytes_recv.kb;
1486 #endif
1487 
1488  stats.unlink_requests = f->unlink.requests;
1489  stats.page_faults = f->page_faults;
1490  stats.select_loops = f->select_loops;
1491  stats.cpu_time = f->cputime;
1493  stats.swap_outs = f->swap.outs;
1494  stats.swap_ins = f->swap.ins;
1497 }
1498 
1499 void
1501 {
1502  storeAppendPrintf(sentry, "sample_time = %d.%d (%s)\n",
1503  (int) stats.sample_time.tv_sec,
1504  (int) stats.sample_time.tv_usec,
1505  mkrfc1123(stats.sample_time.tv_sec));
1506  storeAppendPrintf(sentry, "client_http.requests = %.0f\n",
1507  stats.client_http_requests);
1508  storeAppendPrintf(sentry, "client_http.hits = %.0f\n",
1509  stats.client_http_hits);
1510  storeAppendPrintf(sentry, "client_http.errors = %.0f\n",
1511  stats.client_http_errors);
1512  storeAppendPrintf(sentry, "client_http.kbytes_in = %.0f\n",
1513  stats.client_http_kbytes_in);
1514  storeAppendPrintf(sentry, "client_http.kbytes_out = %.0f\n",
1515  stats.client_http_kbytes_out);
1516  storeAppendPrintf(sentry, "client_http.hit_kbytes_out = %.0f\n",
1518 
1519  storeAppendPrintf(sentry, "server.all.requests = %.0f\n",
1520  stats.server_all_requests);
1521  storeAppendPrintf(sentry, "server.all.errors = %.0f\n",
1522  stats.server_all_errors);
1523  storeAppendPrintf(sentry, "server.all.kbytes_in = %.0f\n",
1524  stats.server_all_kbytes_in);
1525  storeAppendPrintf(sentry, "server.all.kbytes_out = %.0f\n",
1526  stats.server_all_kbytes_out);
1527 
1528  storeAppendPrintf(sentry, "server.http.requests = %.0f\n",
1529  stats.server_http_requests);
1530  storeAppendPrintf(sentry, "server.http.errors = %.0f\n",
1531  stats.server_http_errors);
1532  storeAppendPrintf(sentry, "server.http.kbytes_in = %.0f\n",
1533  stats.server_http_kbytes_in);
1534  storeAppendPrintf(sentry, "server.http.kbytes_out = %.0f\n",
1535  stats.server_http_kbytes_out);
1536 
1537  storeAppendPrintf(sentry, "server.ftp.requests = %.0f\n",
1538  stats.server_ftp_requests);
1539  storeAppendPrintf(sentry, "server.ftp.errors = %.0f\n",
1540  stats.server_ftp_errors);
1541  storeAppendPrintf(sentry, "server.ftp.kbytes_in = %.0f\n",
1542  stats.server_ftp_kbytes_in);
1543  storeAppendPrintf(sentry, "server.ftp.kbytes_out = %.0f\n",
1544  stats.server_ftp_kbytes_out);
1545 
1546  storeAppendPrintf(sentry, "server.other.requests = %.0f\n",
1547  stats.server_other_requests);
1548  storeAppendPrintf(sentry, "server.other.errors = %.0f\n",
1549  stats.server_other_errors);
1550  storeAppendPrintf(sentry, "server.other.kbytes_in = %.0f\n",
1551  stats.server_other_kbytes_in);
1552  storeAppendPrintf(sentry, "server.other.kbytes_out = %.0f\n",
1553  stats.server_other_kbytes_out);
1554 
1555  storeAppendPrintf(sentry, "icp.pkts_sent = %.0f\n",
1556  stats.icp_pkts_sent);
1557  storeAppendPrintf(sentry, "icp.pkts_recv = %.0f\n",
1558  stats.icp_pkts_recv);
1559  storeAppendPrintf(sentry, "icp.queries_sent = %.0f\n",
1560  stats.icp_queries_sent);
1561  storeAppendPrintf(sentry, "icp.replies_sent = %.0f\n",
1562  stats.icp_replies_sent);
1563  storeAppendPrintf(sentry, "icp.queries_recv = %.0f\n",
1564  stats.icp_queries_recv);
1565  storeAppendPrintf(sentry, "icp.replies_recv = %.0f\n",
1566  stats.icp_replies_recv);
1567  storeAppendPrintf(sentry, "icp.query_timeouts = %.0f\n",
1568  stats.icp_query_timeouts);
1569  storeAppendPrintf(sentry, "icp.replies_queued = %.0f\n",
1570  stats.icp_replies_queued);
1571  storeAppendPrintf(sentry, "icp.kbytes_sent = %.0f\n",
1572  stats.icp_kbytes_sent);
1573  storeAppendPrintf(sentry, "icp.kbytes_recv = %.0f\n",
1574  stats.icp_kbytes_recv);
1575  storeAppendPrintf(sentry, "icp.q_kbytes_sent = %.0f\n",
1576  stats.icp_q_kbytes_sent);
1577  storeAppendPrintf(sentry, "icp.r_kbytes_sent = %.0f\n",
1578  stats.icp_r_kbytes_sent);
1579  storeAppendPrintf(sentry, "icp.q_kbytes_recv = %.0f\n",
1580  stats.icp_q_kbytes_recv);
1581  storeAppendPrintf(sentry, "icp.r_kbytes_recv = %.0f\n",
1582  stats.icp_r_kbytes_recv);
1583 
1584 #if USE_CACHE_DIGESTS
1585 
1586  storeAppendPrintf(sentry, "icp.times_used = %.0f\n",
1587  stats.icp_times_used);
1588  storeAppendPrintf(sentry, "cd.times_used = %.0f\n",
1589  stats.cd_times_used);
1590  storeAppendPrintf(sentry, "cd.msgs_sent = %.0f\n",
1591  stats.cd_msgs_sent);
1592  storeAppendPrintf(sentry, "cd.msgs_recv = %.0f\n",
1593  stats.cd_msgs_recv);
1594  storeAppendPrintf(sentry, "cd.memory = %.0f\n",
1595  stats.cd_memory);
1596  storeAppendPrintf(sentry, "cd.local_memory = %.0f\n",
1597  stats.cd_local_memory);
1598  storeAppendPrintf(sentry, "cd.kbytes_sent = %.0f\n",
1599  stats.cd_kbytes_sent);
1600  storeAppendPrintf(sentry, "cd.kbytes_recv = %.0f\n",
1601  stats.cd_kbytes_recv);
1602 #endif
1603 
1604  storeAppendPrintf(sentry, "unlink.requests = %.0f\n",
1605  stats.unlink_requests);
1606  storeAppendPrintf(sentry, "page_faults = %.0f\n",
1607  stats.page_faults);
1608  storeAppendPrintf(sentry, "select_loops = %.0f\n",
1609  stats.select_loops);
1610  storeAppendPrintf(sentry, "cpu_time = %f\n",
1611  stats.cpu_time);
1612  storeAppendPrintf(sentry, "wall_time = %f\n",
1613  stats.wall_time);
1614  storeAppendPrintf(sentry, "swap.outs = %.0f\n",
1615  stats.swap_outs);
1616  storeAppendPrintf(sentry, "swap.ins = %.0f\n",
1617  stats.swap_ins);
1618  storeAppendPrintf(sentry, "swap.files_cleaned = %.0f\n",
1619  stats.swap_files_cleaned);
1620  storeAppendPrintf(sentry, "aborted_requests = %.0f\n",
1621  stats.aborted_requests);
1622 }
1623 
1624 void
1626 {
1627  int i;
1628 
1629  for (i = 0; i < N_COUNT_HIST; ++i)
1630  statCountersClean(&CountHist[i]);
1631 
1632  for (i = 0; i < N_COUNT_HOUR_HIST; ++i)
1633  statCountersClean(&CountHourHist[i]);
1634 }
1635 
1636 static void
1638 {
1639 #if USE_CACHE_DIGESTS
1640  StatCounters *f = &statCounter;
1641  CachePeer *peer;
1642  const int tot_used = f->cd.times_used + f->icp.times_used;
1643 
1644  /* totals */
1645  cacheDigestGuessStatsReport(&f->cd.guess, sentry, "all peers");
1646  /* per-peer */
1647  storeAppendPrintf(sentry, "\nPer-peer statistics:\n");
1648 
1649  for (peer = getFirstPeer(); peer; peer = getNextPeer(peer)) {
1650  if (peer->digest)
1651  peerDigestStatsReport(peer->digest, sentry);
1652  else
1653  storeAppendPrintf(sentry, "\nNo peer digest from %s\n", peer->host);
1654 
1655  storeAppendPrintf(sentry, "\n");
1656  }
1657 
1658  storeAppendPrintf(sentry, "\nAlgorithm usage:\n");
1659  storeAppendPrintf(sentry, "Cache Digest: %7d (%3d%%)\n",
1660  f->cd.times_used, xpercentInt(f->cd.times_used, tot_used));
1661  storeAppendPrintf(sentry, "Icp: %7d (%3d%%)\n",
1662  f->icp.times_used, xpercentInt(f->icp.times_used, tot_used));
1663  storeAppendPrintf(sentry, "Total: %7d (%3d%%)\n",
1664  tot_used, xpercentInt(tot_used, tot_used));
1665 #else
1666 
1667  storeAppendPrintf(sentry, "peer digests are disabled; no stats is available.\n");
1668 #endif
1669 }
1670 
1671 static void
1673 {
1674  storeAppendPrintf(sentry, "\nCounters:\n");
1675  statCountersDump(sentry);
1676  storeAppendPrintf(sentry, "\n5 Min Averages:\n");
1677  statAvgDump(sentry, 5, 0);
1678  storeAppendPrintf(sentry, "\nHistograms:\n");
1679  statCountersHistograms(sentry);
1680  storeAppendPrintf(sentry, "\nPeer Digests:\n");
1681  statPeerSelect(sentry);
1682  storeAppendPrintf(sentry, "\nLocal Digest:\n");
1683  storeDigestReport(sentry);
1684 }
1685 
1686 static double
1687 statPctileSvc(double pctile, int interval, int which)
1688 {
1689  StatCounters *f;
1690  StatCounters *l;
1691  double x;
1692  assert(interval > 0);
1693 
1694  if (interval > N_COUNT_HIST - 1)
1695  interval = N_COUNT_HIST - 1;
1696 
1697  f = &CountHist[0];
1698 
1699  l = &CountHist[interval];
1700 
1701  assert(f);
1702 
1703  assert(l);
1704 
1705  switch (which) {
1706 
1707  case PCTILE_HTTP:
1709  break;
1710 
1711  case PCTILE_HIT:
1713  break;
1714 
1715  case PCTILE_MISS:
1717  break;
1718 
1719  case PCTILE_NM:
1721  break;
1722 
1723  case PCTILE_NH:
1725  break;
1726 
1727  case PCTILE_ICP_QUERY:
1729  break;
1730 
1731  case PCTILE_DNS:
1732  x = statHistDeltaPctile(l->dns.svcTime,f->dns.svcTime, pctile);
1733  break;
1734 
1735  default:
1736  debugs(49, 5, "statPctileSvc: unknown type.");
1737  x = 0;
1738  }
1739 
1740  return x;
1741 }
1742 
1743 StatCounters *
1744 snmpStatGet(int minutes)
1745 {
1746  return &CountHist[minutes];
1747 }
1748 
1749 int
1751 {
1752  assert(N_COUNT_HIST > 5);
1753  return statCounter.client_http.requests - CountHist[5].client_http.requests;
1754 }
1755 
1756 static double
1757 statCPUUsage(int minutes)
1758 {
1759  assert(minutes < N_COUNT_HIST);
1760  return Math::doublePercent(CountHist[0].cputime - CountHist[minutes].cputime,
1761  tvSubDsec(CountHist[minutes].timestamp, CountHist[0].timestamp));
1762 }
1763 
1764 double
1766 {
1767  assert(minutes < N_COUNT_HIST);
1768  return Math::doublePercent(CountHist[0].client_http.hits -
1769  CountHist[minutes].client_http.hits,
1770  CountHist[0].client_http.requests -
1771  CountHist[minutes].client_http.requests);
1772 }
1773 
1774 double
1776 {
1777  assert(minutes < N_COUNT_HIST);
1778  return Math::doublePercent(CountHist[0].client_http.mem_hits -
1779  CountHist[minutes].client_http.mem_hits,
1780  CountHist[0].client_http.hits -
1781  CountHist[minutes].client_http.hits);
1782 }
1783 
1784 double
1786 {
1787  assert(minutes < N_COUNT_HIST);
1788  return Math::doublePercent(CountHist[0].client_http.disk_hits -
1789  CountHist[minutes].client_http.disk_hits,
1790  CountHist[0].client_http.hits -
1791  CountHist[minutes].client_http.hits);
1792 }
1793 
1794 double
1795 statByteHitRatio(int minutes)
1796 {
1797  size_t s;
1798  size_t c;
1799 #if USE_CACHE_DIGESTS
1800 
1801  size_t cd;
1802 #endif
1803  /* size_t might be unsigned */
1804  assert(minutes < N_COUNT_HIST);
1805  c = CountHist[0].client_http.kbytes_out.kb - CountHist[minutes].client_http.kbytes_out.kb;
1806  s = CountHist[0].server.all.kbytes_in.kb - CountHist[minutes].server.all.kbytes_in.kb;
1807 #if USE_CACHE_DIGESTS
1808  /*
1809  * This ugly hack is here to prevent the user from seeing a
1810  * negative byte hit ratio. When we fetch a cache digest from
1811  * a neighbor, it gets treated like a cache miss because the
1812  * object is consumed internally. Thus, we subtract cache
1813  * digest bytes out before calculating the byte hit ratio.
1814  */
1815  cd = CountHist[0].cd.kbytes_recv.kb - CountHist[minutes].cd.kbytes_recv.kb;
1816 
1817  if (s < cd)
1818  debugs(18, DBG_IMPORTANT, "STRANGE: srv_kbytes=" << s << ", cd_kbytes=" << cd);
1819 
1820  s -= cd;
1821 
1822 #endif
1823 
1824  if (c > s)
1825  return Math::doublePercent(c - s, c);
1826  else
1827  return (-1.0 * Math::doublePercent(s - c, c));
1828 }
1829 
1830 static void
1832 {
1833  dlink_node *i;
1834  ClientHttpRequest *http;
1835  StoreEntry *e;
1836  char buf[MAX_IPSTRLEN];
1837 
1838  for (i = ClientActiveRequests.head; i; i = i->next) {
1839  const char *p = NULL;
1840  http = static_cast<ClientHttpRequest *>(i->data);
1841  assert(http);
1842  ConnStateData * conn = http->getConn();
1843  storeAppendPrintf(s, "Connection: %p\n", conn);
1844 
1845  if (conn != NULL) {
1846  const int fd = conn->clientConnection->fd;
1847  storeAppendPrintf(s, "\tFD %d, read %" PRId64 ", wrote %" PRId64 "\n", fd,
1848  fd_table[fd].bytes_read, fd_table[fd].bytes_written);
1849  storeAppendPrintf(s, "\tFD desc: %s\n", fd_table[fd].desc);
1850  storeAppendPrintf(s, "\tin: buf %p, used %ld, free %ld\n",
1851  conn->inBuf.rawContent(), (long int) conn->inBuf.length(), (long int) conn->inBuf.spaceSize());
1852  storeAppendPrintf(s, "\tremote: %s\n",
1854  storeAppendPrintf(s, "\tlocal: %s\n",
1856  storeAppendPrintf(s, "\tnrequests: %u\n", conn->pipeline.nrequests);
1857  }
1858 
1859  storeAppendPrintf(s, "uri %s\n", http->uri);
1860  storeAppendPrintf(s, "logType %s\n", http->logType.c_str());
1861  storeAppendPrintf(s, "out.offset %ld, out.size %lu\n",
1862  (long int) http->out.offset, (unsigned long int) http->out.size);
1863  storeAppendPrintf(s, "req_sz %ld\n", (long int) http->req_sz);
1864  e = http->storeEntry();
1865  storeAppendPrintf(s, "entry %p/%s\n", e, e ? e->getMD5Text() : "N/A");
1866  storeAppendPrintf(s, "start %ld.%06d (%f seconds ago)\n",
1867  (long int) http->al->cache.start_time.tv_sec,
1868  (int) http->al->cache.start_time.tv_usec,
1870 #if USE_AUTH
1871  if (http->request->auth_user_request != NULL)
1872  p = http->request->auth_user_request->username();
1873  else
1874 #endif
1875  if (http->request->extacl_user.size() > 0) {
1876  p = http->request->extacl_user.termedBuf();
1877  }
1878 
1879  if (!p && conn != NULL && conn->clientConnection->rfc931[0])
1880  p = conn->clientConnection->rfc931;
1881 
1882 #if USE_OPENSSL
1883  if (!p && conn != NULL && Comm::IsConnOpen(conn->clientConnection))
1884  p = sslGetUserEmail(fd_table[conn->clientConnection->fd].ssl.get());
1885 #endif
1886 
1887  if (!p)
1888  p = dash_str;
1889 
1890  storeAppendPrintf(s, "username %s\n", p);
1891 
1892 #if USE_DELAY_POOLS
1893  storeAppendPrintf(s, "delay_pool %d\n", DelayId::DelayClient(http).pool());
1894 #endif
1895 
1896  storeAppendPrintf(s, "\n");
1897  }
1898 }
1899 
1900 #if STAT_GRAPHS
1901 /*
1902  * urgh, i don't like these, but they do cut the amount of code down immensely
1903  */
1904 
1905 #define GRAPH_PER_MIN(Y) \
1906  for (i=0;i<(N_COUNT_HIST-2);++i) { \
1907  dt = tvSubDsec(CountHist[i+1].timestamp, CountHist[i].timestamp); \
1908  if (dt <= 0.0) \
1909  break; \
1910  storeAppendPrintf(e, "%lu,%0.2f:", \
1911  CountHist[i].timestamp.tv_sec, \
1912  ((CountHist[i].Y - CountHist[i+1].Y) / dt)); \
1913  }
1914 
1915 #define GRAPH_PER_HOUR(Y) \
1916  for (i=0;i<(N_COUNT_HOUR_HIST-2);++i) { \
1917  dt = tvSubDsec(CountHourHist[i+1].timestamp, CountHourHist[i].timestamp); \
1918  if (dt <= 0.0) \
1919  break; \
1920  storeAppendPrintf(e, "%lu,%0.2f:", \
1921  CountHourHist[i].timestamp.tv_sec, \
1922  ((CountHourHist[i].Y - CountHourHist[i+1].Y) / dt)); \
1923  }
1924 
1925 #define GRAPH_TITLE(X,Y) storeAppendPrintf(e,"%s\t%s\t",X,Y);
1926 #define GRAPH_END storeAppendPrintf(e,"\n");
1927 
1928 #define GENGRAPH(X,Y,Z) \
1929  GRAPH_TITLE(Y,Z) \
1930  GRAPH_PER_MIN(X) \
1931  GRAPH_PER_HOUR(X) \
1932  GRAPH_END
1933 
1934 static void
1935 statGraphDump(StoreEntry * e)
1936 {
1937  int i;
1938  double dt;
1939 
1940  GENGRAPH(client_http.requests, "client_http.requests", "Client HTTP requests/sec");
1941  GENGRAPH(client_http.hits, "client_http.hits", "Client HTTP hits/sec");
1942  GENGRAPH(client_http.errors, "client_http.errors", "Client HTTP errors/sec");
1943  GENGRAPH(client_http.kbytes_in.kb, "client_http.kbytes_in", "Client HTTP kbytes_in/sec");
1944  GENGRAPH(client_http.kbytes_out.kb, "client_http.kbytes_out", "Client HTTP kbytes_out/sec");
1945 
1946  /* XXX todo: http median service times */
1947 
1948  GENGRAPH(server.all.requests, "server.all.requests", "Server requests/sec");
1949  GENGRAPH(server.all.errors, "server.all.errors", "Server errors/sec");
1950  GENGRAPH(server.all.kbytes_in.kb, "server.all.kbytes_in", "Server total kbytes_in/sec");
1951  GENGRAPH(server.all.kbytes_out.kb, "server.all.kbytes_out", "Server total kbytes_out/sec");
1952 
1953  GENGRAPH(server.http.requests, "server.http.requests", "Server HTTP requests/sec");
1954  GENGRAPH(server.http.errors, "server.http.errors", "Server HTTP errors/sec");
1955  GENGRAPH(server.http.kbytes_in.kb, "server.http.kbytes_in", "Server HTTP kbytes_in/sec");
1956  GENGRAPH(server.http.kbytes_out.kb, "server.http.kbytes_out", "Server HTTP kbytes_out/sec");
1957 
1958  GENGRAPH(server.ftp.requests, "server.ftp.requests", "Server FTP requests/sec");
1959  GENGRAPH(server.ftp.errors, "server.ftp.errors", "Server FTP errors/sec");
1960  GENGRAPH(server.ftp.kbytes_in.kb, "server.ftp.kbytes_in", "Server FTP kbytes_in/sec");
1961  GENGRAPH(server.ftp.kbytes_out.kb, "server.ftp.kbytes_out", "Server FTP kbytes_out/sec");
1962 
1963  GENGRAPH(server.other.requests, "server.other.requests", "Server other requests/sec");
1964  GENGRAPH(server.other.errors, "server.other.errors", "Server other errors/sec");
1965  GENGRAPH(server.other.kbytes_in.kb, "server.other.kbytes_in", "Server other kbytes_in/sec");
1966  GENGRAPH(server.other.kbytes_out.kb, "server.other.kbytes_out", "Server other kbytes_out/sec");
1967 
1968  GENGRAPH(icp.pkts_sent, "icp.pkts_sent", "ICP packets sent/sec");
1969  GENGRAPH(icp.pkts_recv, "icp.pkts_recv", "ICP packets received/sec");
1970  GENGRAPH(icp.kbytes_sent.kb, "icp.kbytes_sent", "ICP kbytes_sent/sec");
1971  GENGRAPH(icp.kbytes_recv.kb, "icp.kbytes_recv", "ICP kbytes_received/sec");
1972 
1973  /* XXX todo: icp median service times */
1974  /* XXX todo: dns median service times */
1975 
1976  GENGRAPH(unlink.requests, "unlink.requests", "Cache File unlink requests/sec");
1977  GENGRAPH(page_faults, "page_faults", "System Page Faults/sec");
1978  GENGRAPH(select_loops, "select_loops", "System Select Loop calls/sec");
1979  GENGRAPH(cputime, "cputime", "CPU utilisation");
1980 }
1981 
1982 #endif /* STAT_GRAPHS */
1983 
1984 int
1986 {
1987  return memPoolsTotalAllocated();
1988 }
1989 
STOBJFLT * filter
Definition: stat.cc:76
sdirno swap_dirn
Definition: Store.h:179
PeerDigest * digest
Definition: CachePeer.h:143
StoreSearchPointer theSearch
Definition: stat.cc:77
struct StatCounters::@129 server
StoreSearch * search()
Definition: Controller.cc:205
static void statRegisterWithCacheManager(void)
Definition: stat.cc:1177
double request_failure_ratio
Definition: InfoAction.h:40
static double xm_deltat
Definition: old_api.cc:43
#define fd_table
Definition: fde.h:157
struct StatCounters::@129::@138 http
static void statCountersClean(StatCounters *)
Definition: stat.cc:1347
double total_accounted
Definition: InfoAction.h:82
StatCounters statCounter
Definition: StatCounters.cc:12
struct StatCounters::@129::@138 other
#define assert(EX)
Definition: assert.h:17
double rusage_cputime(struct rusage *r)
Definition: tools.cc:228
double http_reads
Definition: IoAction.h:28
double not_modified_replies60
Definition: InfoAction.h:66
int Squid_MaxFD
#define N_COUNT_HIST
Definition: defines.h:179
mgb_t gb_freed
Definition: Pool.h:110
ByteCounter r_kbytes_recv
Definition: StatCounters.h:79
double byte_hit_ratio5
Definition: InfoAction.h:47
double icp_replies_queued
Definition: InfoAction.h:35
ConnStateData * getConn() const
const char * mkrfc1123(time_t)
Definition: rfc1123.c:202
virtual void append(const char *c, int sz)
Definition: MemBuf.cc:225
void storeDigestReport(StoreEntry *e)
struct StatCounters::@133 dns
ByteCounter kbytes_recv
Definition: StatCounters.h:77
void GetServiceTimesStats(Mgr::ServiceTimesActionData &stats)
Definition: stat.cc:807
static void statObjectsStart(StoreEntry *sentry, STOBJFLT *filter)
Definition: stat.cc:396
double statHistDeltaMedian(const StatHist &A, const StatHist &B)
Definition: StatHist.cc:93
int unlock(const char *context)
Definition: store.cc:485
double statRequestHitDiskRatio(int minutes)
Definition: stat.cc:1785
static void DumpStats(StoreEntry *)
Definition: fde.cc:55
double open_disk_fd
number of opened disk files
Definition: StoreStats.h:35
virtual StoreEntry * currentItem()=0
int storePendingNClients(const StoreEntry *e)
StatHist comm_tcp_incoming
Definition: StatCounters.h:126
int locks() const
returns a local concurrent use counter, for debugging
Definition: Store.h:218
struct timeval timestamp
Definition: StatCounters.h:123
virtual bool isDone() const =0
double size
bytes currently in use
Definition: StoreStats.h:20
virtual void append(char const *, int)
Appends a c-string to existing packed data.
Definition: store.cc:844
static OBJH statOpenfdObj
Definition: stat.cc:97
ByteCounter r_kbytes_sent
Definition: StatCounters.h:76
double meanObjectSize() const
mean size of a cached object
Definition: StoreStats.h:25
struct StatCounters::@128 client_http
store size histograms of network read() from peer server
Definition: IoAction.h:21
static OBJH statDigestBlob
Definition: stat.cc:102
void clear()
Definition: StatHist.h:152
ByteCounter hit_kbytes_out
Definition: StatCounters.h:45
double request_hit_disk_ratio5
Definition: InfoAction.h:51
double http_requests5[seriesSize]
struct IoStats::@81 Gopher
int i
Definition: membanger.c:49
#define PRId64
Definition: types.h:110
double request_hit_ratio5
Definition: InfoAction.h:45
virtual void buffer()
Definition: store.cc:1707
static void statStoreEntry(MemBuf *mb, StoreEntry *e)
Definition: stat.cc:333
struct timeval sample_time
static Pointer Create(const CommandPointer &cmd)
Definition: IoAction.cc:46
int aborted_requests
Definition: StatCounters.h:152
double client_http_requests
Definition: InfoAction.h:32
struct timeval start_time
The time the master transaction started.
double icp_queries5[seriesSize]
ByteCounter memory
Definition: StatCounters.h:103
double gopher_reads
Definition: IoAction.h:30
double mem_object_count
number of MemObject objects in existence
Definition: StoreStats.h:53
CacheDigestGuessStats guess
Definition: StatCounters.h:108
static OBJH statUtilization
Definition: stat.cc:103
void DumpServiceTimesStats(Mgr::ServiceTimesActionData &stats, StoreEntry *sentry)
Definition: stat.cc:835
ByteCounter kbytes_sent
Definition: StatCounters.h:74
class Ping::pingStats_ stats
virtual void flush()
Definition: store.cc:1718
double http_read_hist[IoStats::histSize]
Definition: IoAction.h:31
int rusage_maxrss(struct rusage *r)
Definition: tools.cc:243
StatHist on_xition_count
Definition: StatCounters.h:111
StoreEntry * sentry
Definition: stat.cc:72
struct SquidConfig::@110 Store
double icp_queries60[seriesSize]
mgb_t gb_saved
Definition: Pool.h:107
double dns_lookups60[seriesSize]
static Pointer Create(const CommandPointer &cmd)
Definition: InfoAction.cc:110
sfileno swap_filen
unique ID inside a cache_dir for swapped out entries; -1 for others
Definition: Store.h:177
#define DBG_CRITICAL
Definition: Debug.h:44
static void statAvgDump(StoreEntry *, int minutes, int hours)
Definition: stat.cc:885
char * p
Definition: membanger.c:43
void OBJH(StoreEntry *)
Definition: forward.h:44
StatHist svcTime
Definition: StatCounters.h:96
int conn
the current server connection FD
Definition: Transport.cc:26
void DumpAvgStat(Mgr::IntervalActionData &stats, StoreEntry *sentry)
Definition: stat.cc:1024
double client_http_all_median_svc_time
Controller & Root()
safely access controller singleton
Definition: Controller.cc:619
static OBJH statClientRequests
Definition: stat.cc:105
int fdNFree(void)
Definition: fd.cc:300
double cputime
Definition: StatCounters.h:121
static double statCPUUsage(int minutes)
Definition: stat.cc:1757
struct timeval current_time
Definition: stub_time.cc:15
double store_entry_count
number of StoreEntry objects in existence
Definition: StoreStats.h:52
size_type size() const
Definition: SquidString.h:71
double not_modified_replies60[seriesSize]
double count
number of cached objects
Definition: StoreStats.h:21
static int NCountHourHist
Definition: stat.cc:127
double not_modified_replies5[seriesSize]
void GetAvgStat(Mgr::IntervalActionData &stats, int minutes, int hours)
Definition: stat.cc:894
struct StatCounters::@131 htcp
const char * memStatusStr[]
Definition: store.cc:66
void DumpIoStats(Mgr::IoActionData &stats, StoreEntry *sentry)
Definition: stat.cc:222
void logInit(unsigned int capacity, double min, double max)
Definition: StatHist.cc:223
struct StatCounters::@132 unlink
struct timeval current_time
Definition: InfoAction.h:30
StatHist hitSvcTime
Definition: StatCounters.h:49
static void statCountersInit(StatCounters *)
Definition: stat.cc:1306
void cacheDigestGuessStatsReport(const CacheDigestGuessStats *stats, StoreEntry *sentry, const char *label)
Definition: CacheDigest.cc:220
static double xm_time
Definition: old_api.cc:42
ByteCounter kbytes_in
Definition: StatCounters.h:43
StoreIOState::Pointer sio
Definition: MemObject.h:117
double avg_icp_messages
Definition: InfoAction.h:42
struct StatCounters::@137 swap
void init(mb_size_t szInit, mb_size_t szMax)
Definition: MemBuf.cc:105
CacheDigest * store_digest
StatCounters * snmpStatGet(int minutes)
Definition: stat.cc:1744
const char * storeStatusStr[]
Definition: store.cc:77
virtual void complete()
Definition: store.cc:1088
static Pointer Create(const CommandPointer &cmd)
int RESERVED_FD
int replies_queued
Definition: StatCounters.h:72
struct StatCounters::@129::@138 ftp
double capacity
the size limit
Definition: StoreStats.h:22
static Pointer Create60min(const CommandPointer &cmd)
StatHist replySvcTime
Definition: StatCounters.h:81
double doublePercent(const double, const double)
Definition: SquidMath.cc:25
Mem mem
all cache_dirs stats
Definition: StoreStats.h:49
int read_hist[histSize]
Definition: IoStats.h:21
SQUIDCEXTERN int xpercentInt(double part, double whole)
Definition: util.c:60
void statFreeMemory(void)
Definition: stat.cc:1625
static EVH statObjects
Definition: stat.cc:99
double request_hit_ratio60
Definition: InfoAction.h:46
struct IoStats::@81 Ftp
bool IsConnOpen(const Comm::ConnectionPointer &conn)
Definition: Connection.cc:24
ping_status_t ping_status
Definition: Store.h:183
void const char HLPCB void * data
Definition: stub_helper.cc:16
size_type length() const
Returns the number of bytes stored in SBuf.
Definition: SBuf.h:405
int CacheDigestHashFuncCount
LogTags logType
the processing tags associated with this request transaction.
double statByteHitRatio(int minutes)
Definition: stat.cc:1795
bool checkDeferRead(int fd) const
Definition: store.cc:244
#define N_COUNT_HOUR_HIST
Definition: defines.h:183
void stat(MemBuf *mb) const
Definition: MemObject.cc:205
const char * describeTimestamps() const
Definition: store.cc:2080
void EVH(void *)
Definition: event.h:19
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
#define DBG_IMPORTANT
Definition: Debug.h:45
#define COUNT_INTERVAL
Definition: defines.h:175
void RegisterAction(char const *action, char const *desc, OBJH *handler, int pw_req_flag, int atomic)
Definition: Registration.cc:16
unsigned int count
Definition: InfoAction.h:91
double request_hit_disk_ratio60
Definition: InfoAction.h:52
double gopher_read_hist[IoStats::histSize]
Definition: IoAction.h:33
double statRequestHitRatio(int minutes)
Definition: stat.cc:1765
void statInit(void)
Definition: stat.cc:1223
mem_status_t mem_status
Definition: Store.h:181
double select_time
Definition: StatCounters.h:120
mb_size_t size
Definition: MemBuf.h:135
double cache_misses60[seriesSize]
#define INCOMING_UDP_MAX
Definition: Loops.h:45
char const * termedBuf() const
Definition: SquidString.h:90
CachePeer * getNextPeer(CachePeer *p)
Definition: neighbors.cc:478
const char * c_str() const
compute the status access.log field
Definition: LogTags.cc:47
StatHist comm_dns_incoming
Definition: StatCounters.h:125
#define CBDATA_CLASS(type)
Definition: cbdata.h:302
StoreEntry * storeEntry() const
static int statObjectsVmFilter(const StoreEntry *e)
Definition: stat.cc:415
char * toUrl(char *buf, unsigned int len) const
Definition: Address.cc:892
double client_http_miss_median_svc_time
double http_requests60[seriesSize]
void peerDigestStatsReport(const PeerDigest *pd, StoreEntry *e)
int Number_FD
double client_http_clients
Definition: InfoAction.h:31
size_t kb
Definition: ByteCounter.h:25
void GetInfo(Mgr::InfoActionData &stats)
Definition: stat.cc:461
int memPoolGetGlobalStats(MemPoolGlobalStats *stats)
Definition: Pool.cc:250
int Biggest_FD
static OBJH stat_vmobjects_get
Definition: stat.cc:95
StatHist select_fds_hist
Definition: StatCounters.h:127
uint32_t mask_size
Definition: CacheDigest.h:59
void GetIoStats(Mgr::IoActionData &stats)
Definition: stat.cc:198
struct timeval squid_start
Definition: InfoAction.h:29
StatHist nearMissSvcTime
Definition: StatCounters.h:47
uint16_t flags
Definition: Store.h:173
virtual void getStats(StoreInfoStats &stats) const override
collect statistics
Definition: Controller.cc:111
AccessLogEntry::Pointer al
access.log entry
unsigned long int select_loops
Definition: StatCounters.h:118
static OBJH stat_objects_get
Definition: stat.cc:94
MemObject * mem_obj
Definition: Store.h:162
static Pointer Create(const CommandPointer &cmd)
int objectsPerBucket
Definition: SquidConfig.h:260
struct timeval squid_start
#define LOCAL_ARRAY(type, name, size)
Definition: leakcheck.h:18
double request_hit_mem_ratio5
Definition: InfoAction.h:49
double dns_lookups5[seriesSize]
double request_hit_mem_ratio60
Definition: InfoAction.h:50
struct ClientHttpRequest::Out out
static double statPctileSvc(double, int, int)
Definition: stat.cc:1687
uint16_t refcount
Definition: Store.h:172
bool UsingSmp()
Whether there should be more than one worker process running.
Definition: tools.cc:658
void const char * buf
Definition: stub_helper.cc:16
store service times for 5 and 60 min
class AccessLogEntry::CacheDetails cache
double near_hits60[seriesSize]
struct SquidConfig::@112 onoff
int reads
Definition: IoStats.h:19
MemPoolMeter * TheMeter
Definition: Pool.h:304
Ip::Address local
Definition: Connection.h:135
int statMemoryAccounted(void)
Definition: stat.cc:1985
SwapOut swapout
Definition: MemObject.h:124
bool SIGHDLR int STUB void int
Definition: stub_tools.cc:68
void clean()
Definition: MemBuf.cc:122
struct SquidConfig::@122 warnings
StatHist allSvcTime
Definition: StatCounters.h:50
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:109
char rfc931[USER_IDENT_SZ]
Definition: Connection.h:155
char * buf
Definition: MemBuf.h:134
virtual const char * getMD5Text() const
Definition: store.cc:181
void squid_getrusage(struct rusage *r)
Definition: tools.cc:170
store_status_t store_status
Definition: Store.h:185
StatHist comm_udp_incoming
Definition: StatCounters.h:124
int KidIdentifier
double cache_hits5[seriesSize]
const char * pingStatusStr[]
Definition: store.cc:71
struct StatCounters::@129::@138 all
int memPoolsTotalAllocated(void)
Definition: Pool.cc:299
struct timeval sample_start_time
Ip::Address remote
Definition: Connection.h:138
StatHist missSvcTime
Definition: StatCounters.h:46
void DumpCountersStats(Mgr::CountersActionData &stats, StoreEntry *sentry)
Definition: stat.cc:1500
double ftp_reads
Definition: IoAction.h:29
static char server[MAXLINE]
struct StatCounters::@134 cd
double count
Definition: Pool.h:84
SQUIDCEXTERN double xdiv(double nom, double denom)
Definition: util.c:72
double ftp_read_hist[IoStats::histSize]
Definition: IoAction.h:32
#define CBDATA_CLASS_INIT(type)
Definition: cbdata.h:318
#define INCOMING_TCP_MAX
Definition: Loops.h:64
int Opening_FD
char const * username() const
Definition: UserRequest.cc:32
double request_failure_ratio
String extacl_user
Definition: HttpRequest.h:167
struct timeval sample_end_time
double current_dtime
Definition: stub_time.cc:16
double avg_client_http_requests
Definition: InfoAction.h:41
static int statObjectsOpenfdFilter(const StoreEntry *e)
Definition: stat.cc:428
void appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
Append operation with printf-style arguments.
Definition: Packable.h:61
struct StatCounters::@130 icp
double cache_misses5[seriesSize]
void DumpInfo(Mgr::InfoActionData &stats, StoreEntry *sentry)
Definition: stat.cc:585
SBuf inBuf
read I/O buffer for the client connection
Definition: Server.h:110
Definition: MemBuf.h:23
Comm::ConnectionPointer clientConnection
Definition: Server.h:97
double available() const
number of unused bytes
Definition: StoreStats.h:28
Auth::UserRequest::Pointer auth_user_request
Definition: HttpRequest.h:115
int query_timeouts
Definition: StatCounters.h:82
double http_requests60
Definition: InfoAction.h:58
swap_status_t swap_status
Definition: Store.h:187
IoStats IOStats
#define XAVG(X)
Definition: stat.cc:892
static void statCountersCopy(StatCounters *dest, const StatCounters *orig)
Definition: stat.cc:1367
static OBJH statCountersDump
Definition: stat.cc:100
int STOBJFLT(const StoreEntry *)
Definition: stat.cc:68
static OBJH statCountersHistograms
Definition: stat.cc:104
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:23
static void statAvgTick(void *notused)
Definition: stat.cc:1246
ByteCounter q_kbytes_recv
Definition: StatCounters.h:78
SBuf service_name(APP_SHORTNAME)
StatHist querySvcTime
Definition: StatCounters.h:80
void dump(StoreEntry *sentry, StatHistBinDumper *bd) const
Definition: StatHist.cc:173
CachePeer * getFirstPeer(void)
Definition: neighbors.cc:484
#define SQUIDSBUFPH
Definition: SBuf.h:32
double unlink_requests
Definition: InfoAction.h:56
double cache_hits60[seriesSize]
ByteCounter kbytes_out
Definition: StatCounters.h:44
const char * rawContent() const
Definition: SBuf.cc:539
unsigned int mem_pool_alloc_calls
void GetCountersStats(Mgr::CountersActionData &stats)
Definition: stat.cc:1424
const char * swapStatusStr[]
Definition: store.cc:82
static const char * describeStatuses(const StoreEntry *)
Definition: stat.cc:268
size_t high_memory
Definition: SquidConfig.h:501
ByteCounter q_kbytes_sent
Definition: StatCounters.h:75
const char * sslGetUserEmail(SSL *ssl)
Definition: support.cc:708
int rusage_pagefaults(struct rusage *r)
Definition: tools.cc:264
#define SQUIDSBUFPRINT(s)
Definition: SBuf.h:33
StoreInfoStats store
disk and memory cache statistics
Definition: InfoAction.h:54
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:904
double byte_hit_ratio60
Definition: InfoAction.h:48
static const int histSize
Definition: IoStats.h:16
static DelayId DelayClient(ClientHttpRequest *, HttpReply *reply=nullptr)
Definition: DelayId.cc:67
uint32_t nrequests
Definition: Pipeline.h:66
const char * storeEntryFlags(const StoreEntry *entry)
Definition: stat.cc:280
int stat5minClientRequests(void)
Definition: stat.cc:1750
unsigned int mem_pool_free_calls
#define EBIT_TEST(flag, bit)
Definition: defines.h:107
const char * version_string
store traffic and resource counters
class SquidConfig Config
Definition: SquidConfig.cc:12
#define NULL
Definition: types.h:166
static Pointer Create5min(const CommandPointer &cmd)
double client_http_hit_median_svc_time
void DumpMallocStatistics(StoreEntry *sentry)
Definition: stat.cc:795
static OBJH statPeerSelect
Definition: stat.cc:101
static int NCountHist
Definition: stat.cc:125
SQUIDCEXTERN double tvSubDsec(struct timeval, struct timeval)
Definition: util.c:46
#define APP_SHORTNAME
Definition: version.h:19
double statRequestHitMemoryRatio(int minutes)
Definition: stat.cc:1775
size_type spaceSize() const
Definition: SBuf.h:383
static void CredentialsCacheStats(StoreEntry *output)
Definition: User.cc:244
double statHistDeltaPctile(const StatHist &A, const StatHist &B, double pctile)
Definition: StatHist.cc:99
char * host
Definition: CachePeer.h:41
Swap swap
cache_mem stats
Definition: StoreStats.h:48
static void statCountersInitSpecial(StatCounters *)
Definition: stat.cc:1316
Pipeline pipeline
set of requests waiting to be serviced
Definition: Server.h:115
struct IoStats::@81 Http
void enumInit(unsigned int last_enum)
Definition: StatHist.cc:237
#define INCOMING_DNS_MAX
Definition: Loops.h:54
double not_modified_replies5
Definition: InfoAction.h:65
const char * dash_str
StatHist nearHitSvcTime
Definition: StatCounters.h:48
void lock(const char *context)
Definition: store.cc:448

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors