]> git.ipfire.org Git - thirdparty/squid.git/blob - src/SBufDetailedStats.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / SBufDetailedStats.cc
1 /*
2 * Copyright (C) 1996-2014 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 #include "squid.h"
10 #include "SBufDetailedStats.h"
11 #include "StatHist.h"
12
13 /*
14 * Implementation note: the purpose of this construct is to avoid adding
15 * external dependencies to the SBuf code
16 */
17
18 static StatHist sbufDestructTimeStats;
19 static StatHist memblobDestructTimeStats;
20
21 namespace SBufDetailedStatsHistInitializer
22 {
23 // run the post-instantiation initialization methods for StatHist objects
24 struct Initializer {
25 Initializer() {
26 sbufDestructTimeStats.logInit(100,30.0,128000.0);
27 memblobDestructTimeStats.logInit(100,30.0,128000.0);
28 }
29 };
30 Initializer initializer;
31 }
32
33 void
34 recordSBufSizeAtDestruct(SBuf::size_type sz)
35 {
36 sbufDestructTimeStats.count(static_cast<double>(sz));
37 }
38
39 const StatHist *
40 collectSBufDestructTimeStats()
41 {
42 return &sbufDestructTimeStats;
43 }
44
45 void
46 recordMemBlobSizeAtDestruct(SBuf::size_type sz)
47 {
48 memblobDestructTimeStats.count(static_cast<double>(sz));
49 }
50
51 const StatHist *
52 collectMemBlobDestructTimeStats()
53 {
54 return &memblobDestructTimeStats;
55 }
56