]> git.ipfire.org Git - thirdparty/squid.git/blob - src/sbuf/Stats.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / sbuf / Stats.h
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 #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:
24 uint64_t alloc; ///<number of calls to SBuf constructors
25 uint64_t allocCopy; ///<number of calls to SBuf copy-constructor
26 uint64_t allocFromCString; ///<number of copy-allocations from c-strings
27 uint64_t assignFast; ///<number of no-copy assignment operations
28 uint64_t clear; ///<number of clear operations
29 uint64_t append; ///<number of append operations
30 uint64_t moves; ///<number of move constructions/assignments
31 uint64_t toStream; ///<number of write operations to ostreams
32 uint64_t setChar; ///<number of calls to setAt
33 uint64_t getChar; ///<number of calls to at() and operator[]
34 uint64_t compareSlow; ///<number of comparison operations requiring data scan
35 uint64_t compareFast; ///<number of comparison operations not requiring data scan
36 uint64_t copyOut; ///<number of data-copies to other forms of buffers
37 uint64_t rawAccess; ///<number of accesses to raw contents
38 uint64_t nulTerminate; ///<number of c_str() terminations
39 uint64_t chop; ///<number of chop operations
40 uint64_t trim; ///<number of trim operations
41 uint64_t find; ///<number of find operations
42 uint64_t caseChange; ///<number of toUpper and toLower operations
43 uint64_t cowFast; ///<number of cow operations not actually requiring a copy
44 uint64_t cowSlow; ///<number of cow operations requiring a copy
45 uint64_t live; ///<number of currently-allocated SBuf
46
47 ///Dump statistics to an ostream.
48 std::ostream& dump(std::ostream &os) const;
49 SBufStats();
50
51 SBufStats& operator +=(const SBufStats&);
52 };
53
54 #endif /* SQUID_SBUF_STATS_H */
55