]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
bbc27441 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 | ||
ff1eb053 | 9 | #include "squid.h" |
dfe4488f | 10 | #include "sbuf/DetailedStats.h" |
ff1eb053 FC |
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 | ||
b3c7741c AR |
18 | static StatHist * |
19 | newStatHist() { | |
20 | StatHist *stats = new StatHist; | |
21 | stats->logInit(100, 30.0, 128000.0); | |
22 | return stats; | |
ff1eb053 FC |
23 | } |
24 | ||
b3c7741c AR |
25 | StatHist & |
26 | collectSBufDestructTimeStats() | |
ff1eb053 | 27 | { |
b3c7741c AR |
28 | static StatHist *stats = newStatHist(); |
29 | return *stats; | |
ff1eb053 FC |
30 | } |
31 | ||
b3c7741c AR |
32 | StatHist & |
33 | collectMemBlobDestructTimeStats() | |
ff1eb053 | 34 | { |
b3c7741c AR |
35 | static StatHist *stats = newStatHist(); |
36 | return *stats; | |
ff1eb053 FC |
37 | } |
38 | ||
39 | void | |
b3c7741c | 40 | recordSBufSizeAtDestruct(SBuf::size_type sz) |
ff1eb053 | 41 | { |
b3c7741c | 42 | collectSBufDestructTimeStats().count(static_cast<double>(sz)); |
ff1eb053 FC |
43 | } |
44 | ||
b3c7741c AR |
45 | void |
46 | recordMemBlobSizeAtDestruct(SBuf::size_type sz) | |
ff1eb053 | 47 | { |
b3c7741c | 48 | collectMemBlobDestructTimeStats().count(static_cast<double>(sz)); |
ff1eb053 | 49 | } |
f53969cc | 50 |