SBufStatsAction.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 "base/PackableStream.h"
11 #include "ipc/Messages.h"
12 #include "ipc/TypedMsgHdr.h"
13 #include "mgr/Registration.h"
14 #include "sbuf/DetailedStats.h"
15 #include "SBufStatsAction.h"
16 
18  Action(cmd_)
19 { } //default constructor is OK for data member
20 
23 {
24  return new SBufStatsAction(cmd);
25 }
26 
27 void
29 {
30  sbdata += dynamic_cast<const SBufStatsAction&>(action).sbdata;
31  mbdata += dynamic_cast<const SBufStatsAction&>(action).mbdata;
34 }
35 
36 void
38 {
43 }
44 
45 static void
46 statHistSBufDumper(StoreEntry * sentry, int, double val, double size, int count)
47 {
48  if (count == 0)
49  return;
50  storeAppendPrintf(sentry, "\t%d-%d\t%d\n", static_cast<int>(val), static_cast<int>(val+size), count);
51 }
52 
53 void
55 {
56  PackableStream ses(*entry);
57  ses << "\n\n\nThese statistics are experimental; their format and contents "
58  "should not be relied upon, they are bound to change as "
59  "the SBuf feature is evolved\n";
60  sbdata.dump(ses);
61  mbdata.dump(ses);
62  ses << "\n";
63  ses << "SBuf size distribution at destruct time:\n";
65  ses << "MemBlob capacity distribution at destruct time:\n";
67 }
68 
69 void
71 {
73  msg.putPod(sbdata);
74  msg.putPod(mbdata);
75 }
76 
77 void
79 {
81  msg.getPod(sbdata);
82  msg.getPod(mbdata);
83 }
84 
85 void
87 {
88  Mgr::RegisterAction("sbuf", "String-Buffer statistics", &SBufStatsAction::Create, 0, 1);
89 }
90 
void getPod(Pod &pod) const
load POD
Definition: TypedMsgHdr.h:50
static Pointer Create(const Mgr::CommandPointer &cmd)
Mgr::ClassActionCreationHandler for Mgr::RegisterAction()
static const SBufStats & GetStats()
gets global statistic informations
Definition: SBuf.cc:504
void putPod(const Pod &pod)
store POD
Definition: TypedMsgHdr.h:52
std::ostream & dump(std::ostream &os) const
dumps class-wide statistics
Definition: MemBlob.cc:37
static const MemBlobStats & GetStats()
obtain a const view of class-wide statistics
Definition: MemBlob.cc:128
MemBlobStats mbdata
void RegisterAction(char const *action, char const *desc, OBJH *handler, int pw_req_flag, int atomic)
Definition: Registration.cc:16
virtual void add(const Mgr::Action &action)
incrementally merge in remote information (of the same action type)
SBufStatsAction(const Mgr::CommandPointer &cmd)
const CommandPointer cmd
the command that caused this action
Definition: Action.h:86
bool action(int fd, size_t metasize, const char *fn, const char *url, const SquidMetaList &meta)
Definition: purge.cc:311
StatHist mbsizesatdestruct
virtual void unpack(const Ipc::TypedMsgHdr &msg)
unpack action info from the message received by Coordinator
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:31
static void statHistSBufDumper(StoreEntry *sentry, int, double val, double size, int count)
virtual void dump(StoreEntry *entry)
StatHist & collectMemBlobDestructTimeStats()
the MemBlob size-at-destruct-time histogram
static void RegisterWithCacheManager(void)
void setType(int aType)
sets message type; use MessageType enum
Definition: TypedMsgHdr.cc:107
virtual void collect()
calculate and keep local action-specific information
void checkType(int aType) const
throws if stored type is not aType
Definition: TypedMsgHdr.cc:101
StatHist & collectSBufDestructTimeStats()
the SBuf size-at-destruct-time histogram
StatHist sbsizesatdestruct
std::ostream & dump(std::ostream &os) const
Dump statistics to an ostream.
Definition: Stats.cc:46
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:875
virtual void pack(Ipc::TypedMsgHdr &msg) const
pack collected action info into a message to be sent to Coordinator
SBuf stats for cachemgr.
void dump(StoreEntry *sentry, StatHistBinDumper *bd) const
Definition: StatHist.cc:173
int size
Definition: ModDevPoll.cc:77

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors