]>
Commit | Line | Data |
---|---|---|
b268925c | 1 | /* |
f6e9a3ee | 2 | * Copyright (C) 1996-2019 The Squid Software Foundation and contributors |
b268925c AJ |
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 | #ifndef SQUID_SBUF_STATS_H | |
10 | #define SQUID_SBUF_STATS_H | |
11 | ||
12 | #include <iosfwd> | |
13 | ||
14 | /** | |
15 | * Container for various SBuf class-wide statistics. | |
16 | * | |
17 | * The stats are not completely accurate; they're mostly meant to | |
18 | * understand whether Squid is leaking resources | |
19 | * and whether SBuf is paying off the expected gains. | |
20 | */ | |
21 | class SBufStats | |
22 | { | |
23 | public: | |
b268925c AJ |
24 | ///Dump statistics to an ostream. |
25 | std::ostream& dump(std::ostream &os) const; | |
b268925c AJ |
26 | |
27 | SBufStats& operator +=(const SBufStats&); | |
14610262 AJ |
28 | |
29 | public: | |
30 | uint64_t alloc = 0; ///<number of calls to SBuf constructors | |
31 | uint64_t allocCopy = 0; ///<number of calls to SBuf copy-constructor | |
32 | uint64_t allocFromCString = 0; ///<number of copy-allocations from c-strings | |
33 | uint64_t assignFast = 0; ///<number of no-copy assignment operations | |
34 | uint64_t clear = 0; ///<number of clear operations | |
35 | uint64_t append = 0; ///<number of append operations | |
36 | uint64_t moves = 0; ///<number of move constructions/assignments | |
37 | uint64_t toStream = 0; ///<number of write operations to ostreams | |
38 | uint64_t setChar = 0; ///<number of calls to setAt | |
39 | uint64_t getChar = 0; ///<number of calls to at() and operator[] | |
40 | uint64_t compareSlow = 0; ///<number of comparison operations requiring data scan | |
41 | uint64_t compareFast = 0; ///<number of comparison operations not requiring data scan | |
42 | uint64_t copyOut = 0; ///<number of data-copies to other forms of buffers | |
43 | uint64_t rawAccess = 0; ///<number of accesses to raw contents | |
44 | uint64_t nulTerminate = 0; ///<number of c_str() terminations | |
45 | uint64_t chop = 0; ///<number of chop operations | |
46 | uint64_t trim = 0; ///<number of trim operations | |
47 | uint64_t find = 0; ///<number of find operations | |
48 | uint64_t caseChange = 0; ///<number of toUpper and toLower operations | |
49 | uint64_t cowFast = 0; ///<number of cow operations not actually requiring a copy | |
50 | uint64_t cowSlow = 0; ///<number of cow operations requiring a copy | |
51 | uint64_t live = 0; ///<number of currently-allocated SBuf | |
b268925c AJ |
52 | }; |
53 | ||
54 | #endif /* SQUID_SBUF_STATS_H */ | |
bb7082c2 | 55 |