]> git.ipfire.org Git - thirdparty/squid.git/blame - src/sbuf/DetailedStats.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / sbuf / DetailedStats.cc
CommitLineData
bbc27441 1/*
77b1029d 2 * Copyright (C) 1996-2020 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
18static StatHist *
19newStatHist() {
20 StatHist *stats = new StatHist;
21 stats->logInit(100, 30.0, 128000.0);
22 return stats;
ff1eb053
FC
23}
24
b3c7741c
AR
25StatHist &
26collectSBufDestructTimeStats()
ff1eb053 27{
b3c7741c
AR
28 static StatHist *stats = newStatHist();
29 return *stats;
ff1eb053
FC
30}
31
b3c7741c
AR
32StatHist &
33collectMemBlobDestructTimeStats()
ff1eb053 34{
b3c7741c
AR
35 static StatHist *stats = newStatHist();
36 return *stats;
ff1eb053
FC
37}
38
39void
b3c7741c 40recordSBufSizeAtDestruct(SBuf::size_type sz)
ff1eb053 41{
b3c7741c 42 collectSBufDestructTimeStats().count(static_cast<double>(sz));
ff1eb053
FC
43}
44
b3c7741c
AR
45void
46recordMemBlobSizeAtDestruct(SBuf::size_type sz)
ff1eb053 47{
b3c7741c 48 collectMemBlobDestructTimeStats().count(static_cast<double>(sz));
ff1eb053 49}
f53969cc 50