]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/sbuf/Stats.cc
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
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.
10 #include "sbuf/MemBlob.h"
11 #include "sbuf/SBuf.h"
12 #include "sbuf/Stats.h"
16 SBufStats::SBufStats()
17 : alloc(0), allocCopy(0), allocFromCString(0),
18 assignFast(0), clear(0), append(0), moves(0), toStream(0), setChar(0),
19 getChar(0), compareSlow(0), compareFast(0), copyOut(0),
20 rawAccess(0), nulTerminate(0), chop(0), trim(0), find(0),
21 caseChange(0), cowFast(0), cowSlow(0), live(0)
25 SBufStats::operator +=(const SBufStats
& ss
)
28 allocCopy
+= ss
.allocCopy
;
29 allocFromCString
+= ss
.allocFromCString
;
30 assignFast
+= ss
.assignFast
;
34 toStream
+= ss
.toStream
;
35 setChar
+= ss
.setChar
;
36 getChar
+= ss
.getChar
;
37 compareSlow
+= ss
.compareSlow
;
38 compareFast
+= ss
.compareFast
;
39 copyOut
+= ss
.copyOut
;
40 rawAccess
+= ss
.rawAccess
;
41 nulTerminate
+= ss
.nulTerminate
;
45 caseChange
+= ss
.caseChange
;
46 cowFast
+= ss
.cowFast
;
47 cowSlow
+= ss
.cowSlow
;
54 SBufStats::dump(std::ostream
& os
) const
56 MemBlobStats ststats
= MemBlob::GetStats();
58 "SBuf stats:\nnumber of allocations: " << alloc
<<
59 "\ncopy-allocations: " << allocCopy
<<
60 "\ncopy-allocations from C String: " << allocFromCString
<<
61 "\nlive references: " << live
<<
62 "\nno-copy assignments: " << assignFast
<<
63 "\nclearing operations: " << clear
<<
64 "\nappend operations: " << append
<<
65 "\nmove operations: " << moves
<<
66 "\ndump-to-ostream: " << toStream
<<
67 "\nset-char: " << setChar
<<
68 "\nget-char: " << getChar
<<
69 "\ncomparisons with data-scan: " << compareSlow
<<
70 "\ncomparisons not requiring data-scan: " << compareFast
<<
71 "\ncopy-out ops: " << copyOut
<<
72 "\nraw access to memory: " << rawAccess
<<
73 "\nNULL terminate C string: " << nulTerminate
<<
74 "\nchop operations: " << chop
<<
75 "\ntrim operations: " << trim
<<
77 "\ncase-change ops: " << caseChange
<<
78 "\nCOW not actually requiring a copy: " << cowFast
<<
79 "\nCOW: " << cowSlow
<<
80 "\naverage store share factor: " <<
81 (ststats
.live
!= 0 ? static_cast<float>(live
)/ststats
.live
: 0) <<