blob: 8723e56c54390570e2c31523a0fb8063018f81bb (
plain) (
blame)
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
|
#pragma once
#include <util/generic/string.h>
#include <cstddef>
namespace NBus {
namespace NPrivate {
struct TMessageCounter {
size_t BytesData;
size_t BytesNetwork;
size_t Count;
size_t CountCompressed;
size_t CountCompressionRequests; // reader only
void AddMessage(size_t bytesData, size_t bytesCompressed, bool Compressed, bool compressionRequested) {
BytesData += bytesData;
BytesNetwork += bytesCompressed;
Count += 1;
if (Compressed) {
CountCompressed += 1;
}
if (compressionRequested) {
CountCompressionRequests += 1;
}
}
TMessageCounter& operator+=(const TMessageCounter& that);
TString ToString(bool reader) const;
TMessageCounter();
};
}
}
|