ServiceTimesAction.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 /* DEBUG: section 16 Cache Manager API */
10 
11 #include "squid.h"
12 #include "base/TextException.h"
13 #include "ipc/Messages.h"
14 #include "ipc/TypedMsgHdr.h"
15 #include "mgr/ServiceTimesAction.h"
16 #include "Store.h"
17 #include "tools.h"
18 
21 
23 {
24  memset(this, 0, sizeof(*this));
25 }
26 
29 {
30  for (int i = 0; i < seriesSize; ++i) {
31  http_requests5[i] += stats.http_requests5[i];
32  http_requests60[i] += stats.http_requests60[i];
33 
34  cache_misses5[i] += stats.cache_misses5[i];
35  cache_misses60[i] += stats.cache_misses60[i];
36 
37  cache_hits5[i] += stats.cache_hits5[i];
38  cache_hits60[i] += stats.cache_hits60[i];
39 
40  near_hits5[i] += stats.near_hits5[i];
41  near_hits60[i] += stats.near_hits60[i];
42 
43  not_modified_replies5[i] += stats.not_modified_replies5[i];
44  not_modified_replies60[i] += stats.not_modified_replies60[i];
45 
46  dns_lookups5[i] += stats.dns_lookups5[i];
47  dns_lookups60[i] += stats.dns_lookups60[i];
48 
49  icp_queries5[i] += stats.icp_queries5[i];
50  icp_queries60[i] += stats.icp_queries60[i];
51  }
52  ++count;
53 
54  return *this;
55 }
56 
59 {
60  return new ServiceTimesAction(cmd);
61 }
62 
64  Action(aCmd), data()
65 {
66  debugs(16, 5, MYNAME);
67 }
68 
69 void
71 {
72  debugs(16, 5, MYNAME);
73  data += dynamic_cast<const ServiceTimesAction&>(action).data;
74 }
75 
76 void
78 {
79  debugs(16, 5, MYNAME);
81 }
82 
83 void
85 {
86  debugs(16, 5, MYNAME);
87  Must(entry != nullptr);
88  DumpServiceTimesStats(data, entry);
89 }
90 
91 void
93 {
95  msg.putPod(data);
96 }
97 
98 void
100 {
102  msg.getPod(data);
103 }
104 
ServiceTimesActionData & operator+=(const ServiceTimesActionData &stats)
implement aggregated 'service_times' action
double cache_misses60[seriesSize]
void add(const Action &action) override
incrementally merge in remote information (of the same action type)
void setType(int aType)
sets message type; use MessageType enum
Definition: TypedMsgHdr.cc:100
void checkType(int aType) const
Definition: TypedMsgHdr.cc:94
double dns_lookups5[seriesSize]
void dump(StoreEntry *entry) override
@ mtCacheMgrResponse
Definition: Messages.h:36
double near_hits60[seriesSize]
store service times for 5 and 60 min
void DumpServiceTimesStats(Mgr::ServiceTimesActionData &stats, StoreEntry *sentry)
Definition: stat.cc:805
double cache_hits5[seriesSize]
void unpack(const Ipc::TypedMsgHdr &msg) override
unpack action info from the message received by Coordinator
double cache_misses5[seriesSize]
double cache_hits60[seriesSize]
static Pointer Create(const CommandPointer &cmd)
void putPod(const Pod &pod)
store POD
Definition: TypedMsgHdr.h:126
ServiceTimesAction(const CommandPointer &cmd)
void GetServiceTimesStats(Mgr::ServiceTimesActionData &stats)
Definition: stat.cc:777
double http_requests5[seriesSize]
double not_modified_replies60[seriesSize]
double icp_queries5[seriesSize]
double not_modified_replies5[seriesSize]
#define Must(condition)
Definition: TextException.h:75
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:34
#define MYNAME
Definition: Stream.h:219
double dns_lookups60[seriesSize]
double icp_queries60[seriesSize]
void pack(Ipc::TypedMsgHdr &msg) const override
pack collected action info into a message to be sent to Coordinator
void getPod(Pod &pod) const
load POD
Definition: TypedMsgHdr.h:118
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:192
double http_requests60[seriesSize]
void collect() override
calculate and keep local action-specific information

 

Introduction

Documentation

Support

Miscellaneous