forked from vmware/concord-bft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugStatistics.hpp
More file actions
71 lines (51 loc) · 1.89 KB
/
DebugStatistics.hpp
File metadata and controls
71 lines (51 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Concord
//
// Copyright (c) 2018, 2019 VMware, Inc. All Rights Reserved.
//
// This product is licensed to you under the Apache 2.0 license (the "License"). You may not use this product except in
// compliance with the Apache 2.0 License.
//
// This product may include a number of subcomponents with separate copyright notices and license terms. Your use of
// these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE
// file.
#pragma once
#include <cstddef>
#include <stdint.h>
#include "TimeUtils.hpp"
#include <atomic>
namespace bftEngine {
namespace impl {
const unsigned int DEBUG_STAT_PERIOD_SECONDS = 7; // 2;
class DebugStatistics {
public:
static void onCycleCheck();
static void onReceivedExMessage(uint16_t type);
static void onSendExMessage(uint16_t type);
static void onRequestCompleted(bool isReadOnly);
static void onSendPrePrepareMessage(size_t batchRequests, size_t pendingRequests);
static void initDebugStatisticsData();
static void freeDebugStatisticsData();
static void onLastExecutedSequenceNumberChanged(int64_t newNumber);
private:
struct DebugStatDesc {
bool initialized = false;
Time lastCycleTime;
size_t receivedMessages = 0;
std::atomic<size_t> sendMessages = 0;
size_t completedReadOnlyRequests = 0;
size_t completedReadWriteRequests = 0;
size_t numberOfReceivedSTMessages = 0;
size_t numberOfReceivedStatusMessages = 0;
size_t numberOfReceivedCommitMessages = 0;
int64_t lastExecutedSequenceNumber = 0;
size_t prePrepareMessages = 0;
size_t batchRequests = 0;
size_t pendingRequests = 0;
DebugStatDesc() : initialized(false) {}
};
static DebugStatDesc globalDebugStatDesc;
static DebugStatDesc& getDebugStatDesc() { return globalDebugStatDesc; }
static void clearCounters(DebugStatDesc& d);
};
} // namespace impl
} // namespace bftEngine