StoreStats.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 20 Storage Manager Statistics */
10 
11 #include "squid.h"
12 #include "StoreStats.h"
13 #include "tools.h"
14 
15 /* StoreInfoStats */
16 
18 {
19  memset(this, 0, sizeof(*this));
20 }
21 
24 {
25  swap.size += stats.swap.size;
26  swap.capacity += stats.swap.capacity;
27  swap.count += stats.swap.count;
29 
30  // Assume that either all workers use shared memory cache or none do.
31  // It is possible but difficult to report correct stats for an arbitrary
32  // mix, and only rather unusual deployments can benefit from mixing.
33 
34  // If workers share memory, we will get shared stats from those workers
35  // and non-shared stats from other processes. Ignore order and also
36  // ignore other processes stats because they are zero in most setups.
37  if (stats.mem.shared) { // workers share memory
38  // use the latest reported stats, they all should be about the same
39  mem.shared = true;
40  mem.size = stats.mem.size;
41  mem.capacity = stats.mem.capacity;
42  mem.count = stats.mem.count;
43  } else if (!mem.shared) { // do not corrupt shared stats, if any
44  // workers do not share so we must add everything up
45  mem.size += stats.mem.size;
46  mem.capacity += stats.mem.capacity;
47  mem.count += stats.mem.count;
48  }
49 
52 
53  return *this;
54 }
55 
56 /* StoreIoStats */
57 
59 {
60  memset(this, 0, sizeof(*this));
61 }
62 
double open_disk_fd
number of opened disk files
Definition: StoreStats.h:35
double size
bytes currently in use
Definition: StoreStats.h:20
double mem_object_count
number of MemObject objects in existence
Definition: StoreStats.h:53
class Ping::pingStats_ stats
High-level store statistics used by mgr:info action. Used inside PODs!
Definition: StoreStats.h:13
double store_entry_count
number of StoreEntry objects in existence
Definition: StoreStats.h:52
double count
number of cached objects
Definition: StoreStats.h:21
double capacity
the size limit
Definition: StoreStats.h:22
Mem mem
all cache_dirs stats
Definition: StoreStats.h:49
StoreInfoStats & operator+=(const StoreInfoStats &stats)
Definition: StoreStats.cc:23
bool shared
whether memory cache is shared among workers
Definition: StoreStats.h:42
Swap swap
cache_mem stats
Definition: StoreStats.h:48

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors