Stats.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2022 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 
21 class SBufStats
22 {
23 public:
25  std::ostream& dump(std::ostream &os) const;
26 
28 
30  static void RecordSBufSizeAtDestruct(size_t);
31 
33  static void RecordMemBlobSizeAtDestruct(size_t);
34 
35 public:
36  uint64_t alloc = 0;
37  uint64_t allocCopy = 0;
38  uint64_t allocFromCString = 0;
39  uint64_t assignFast = 0;
40  uint64_t clear = 0;
41  uint64_t append = 0;
42  uint64_t moves = 0;
43  uint64_t toStream = 0;
44  uint64_t setChar = 0;
45  uint64_t getChar = 0;
46  uint64_t compareSlow = 0;
47  uint64_t compareFast = 0;
48  uint64_t copyOut = 0;
49  uint64_t rawAccess = 0;
50  uint64_t nulTerminate = 0;
51  uint64_t chop = 0;
52  uint64_t trim = 0;
53  uint64_t find = 0;
54  uint64_t caseChange = 0;
55  uint64_t cowAvoided = 0;
56  uint64_t cowShift = 0;
57  uint64_t cowJustAlloc = 0;
58  uint64_t cowAllocCopy = 0;
59  uint64_t live = 0;
60 
62  using SizeRecorder = void (*)(size_t);
67 };
68 
69 #endif /* SQUID_SBUF_STATS_H */
70 
uint64_t trim
number of trim operations
Definition: Stats.h:52
uint64_t append
number of append operations
Definition: Stats.h:41
std::ostream & dump(std::ostream &os) const
Dump statistics to an ostream.
Definition: Stats.cc:65
uint64_t cowShift
number of cow() calls requiring just a memmove(3) inside an old buffer
Definition: Stats.h:56
uint64_t nulTerminate
number of c_str() terminations
Definition: Stats.h:50
SBufStats & operator+=(const SBufStats &)
Definition: Stats.cc:34
uint64_t moves
number of move constructions/assignments
Definition: Stats.h:42
uint64_t cowJustAlloc
number of cow() calls requiring just a new empty buffer
Definition: Stats.h:57
uint64_t rawAccess
number of accesses to raw contents
Definition: Stats.h:49
uint64_t assignFast
number of no-copy assignment operations
Definition: Stats.h:39
static void RecordMemBlobSizeAtDestruct(size_t)
Record the size a MemBlob had when it was destructed.
Definition: Stats.cc:27
uint64_t cowAllocCopy
number of cow() calls requiring copying into a new buffer
Definition: Stats.h:58
uint64_t getChar
number of calls to at() and operator[]
Definition: Stats.h:45
uint64_t setChar
number of calls to setAt
Definition: Stats.h:44
uint64_t caseChange
number of toUpper and toLower operations
Definition: Stats.h:54
uint64_t cowAvoided
number of cow() calls requiring no expensive operations
Definition: Stats.h:55
static SizeRecorder SBufSizeAtDestructRecorder
collects statistics about SBuf sizes at SBuf destruction time
Definition: Stats.h:64
uint64_t compareFast
number of comparison operations not requiring data scan
Definition: Stats.h:47
uint64_t chop
number of chop operations
Definition: Stats.h:51
uint64_t clear
number of clear operations
Definition: Stats.h:40
static void RecordSBufSizeAtDestruct(size_t)
Record the size a SBuf had when it was destructed.
Definition: Stats.cc:20
static SizeRecorder MemBlobSizeAtDestructRecorder
collects statistics about MemBlob capacity at MemBlob destruction time
Definition: Stats.h:66
uint64_t toStream
number of write operations to ostreams
Definition: Stats.h:43
uint64_t compareSlow
number of comparison operations requiring data scan
Definition: Stats.h:46
uint64_t allocCopy
number of calls to SBuf copy-constructor
Definition: Stats.h:37
uint64_t alloc
number of calls to SBuf constructors
Definition: Stats.h:36
uint64_t find
number of find operations
Definition: Stats.h:53
uint64_t live
number of currently-allocated SBuf
Definition: Stats.h:59
uint64_t copyOut
number of data-copies to other forms of buffers
Definition: Stats.h:48
uint64_t allocFromCString
number of copy-allocations from c-strings
Definition: Stats.h:38
void(*)(size_t) SizeRecorder
function for collecting detailed size-related statistics
Definition: Stats.h:62
int const char size_t
Definition: stub_liblog.cc:86

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors