2727
2828
2929one_sec_cmd_stats::one_sec_cmd_stats () :
30- m_bytes(0 ),
30+ m_bytes_rx(0 ),
31+ m_bytes_tx(0 ),
3132 m_ops(0 ),
3233 m_hits(0 ),
3334 m_misses(0 ),
@@ -41,7 +42,8 @@ one_sec_cmd_stats::one_sec_cmd_stats() :
4142
4243
4344void one_sec_cmd_stats::reset () {
44- m_bytes = 0 ;
45+ m_bytes_rx = 0 ;
46+ m_bytes_tx = 0 ;
4547 m_ops = 0 ;
4648 m_hits = 0 ;
4749 m_misses = 0 ;
@@ -55,7 +57,8 @@ void one_sec_cmd_stats::reset() {
5557}
5658
5759void one_sec_cmd_stats::merge (const one_sec_cmd_stats& other) {
58- m_bytes += other.m_bytes ;
60+ m_bytes_rx += other.m_bytes_rx ;
61+ m_bytes_tx += other.m_bytes_tx ;
5962 m_ops += other.m_ops ;
6063 m_hits += other.m_hits ;
6164 m_misses += other.m_misses ;
@@ -79,26 +82,27 @@ void one_sec_cmd_stats::summarize_quantiles(safe_hdr_histogram histogram, std::v
7982 m_min_latency = has_samples ? hdr_min (histogram)/ (double ) LATENCY_HDR_RESULTS_MULTIPLIER : 0.0 ;
8083}
8184
82- void one_sec_cmd_stats::update_op (unsigned int bytes, unsigned int latency) {
83- m_bytes += bytes;
85+ void one_sec_cmd_stats::update_op (unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency) {
86+ m_bytes_rx += bytes_rx;
87+ m_bytes_tx += bytes_tx;
8488 m_ops++;
8589 m_total_latency += latency;
8690}
8791
88- void one_sec_cmd_stats::update_op (unsigned int bytes , unsigned int latency,
92+ void one_sec_cmd_stats::update_op (unsigned int bytes_rx, unsigned int bytes_tx , unsigned int latency,
8993 unsigned int hits, unsigned int misses) {
90- update_op (bytes , latency);
94+ update_op (bytes_rx, bytes_tx , latency);
9195 m_hits += hits;
9296 m_misses += misses;
9397}
9498
95- void one_sec_cmd_stats::update_moved_op (unsigned int bytes , unsigned int latency) {
96- update_op (bytes , latency);
99+ void one_sec_cmd_stats::update_moved_op (unsigned int bytes_rx, unsigned int bytes_tx , unsigned int latency) {
100+ update_op (bytes_rx, bytes_tx , latency);
97101 m_moved++;
98102}
99103
100- void one_sec_cmd_stats::update_ask_op (unsigned int bytes , unsigned int latency) {
101- update_op (bytes , latency);
104+ void one_sec_cmd_stats::update_ask_op (unsigned int bytes_rx, unsigned int bytes_tx , unsigned int latency) {
105+ update_op (bytes_rx, bytes_tx , latency);
102106 m_ask++;
103107}
104108
@@ -132,7 +136,8 @@ unsigned long int ar_one_sec_cmd_stats::ops() {
132136unsigned long int ar_one_sec_cmd_stats::bytes () {
133137 unsigned long int total_bytes = 0 ;
134138 for (size_t i = 0 ; i<m_commands.size (); i++) {
135- total_bytes += m_commands[i].m_bytes ;
139+ total_bytes += m_commands[i].m_bytes_rx ;
140+ total_bytes += m_commands[i].m_bytes_tx ;
136141 }
137142
138143 return total_bytes;
@@ -187,6 +192,8 @@ void one_second_stats::merge(const one_second_stats& other) {
187192totals_cmd::totals_cmd () :
188193 m_ops_sec(0 ),
189194 m_bytes_sec(0 ),
195+ m_bytes_sec_rx(0 ),
196+ m_bytes_sec_tx(0 ),
190197 m_moved_sec(0 ),
191198 m_ask_sec(0 ),
192199 m_latency(0 ),
@@ -198,6 +205,8 @@ void totals_cmd::add(const totals_cmd& other) {
198205 m_moved_sec += other.m_moved_sec ;
199206 m_ask_sec += other.m_ask_sec ;
200207 m_bytes_sec += other.m_bytes_sec ;
208+ m_bytes_sec_rx += other.m_bytes_sec_rx ;
209+ m_bytes_sec_tx += other.m_bytes_sec_tx ;
201210 m_latency += other.m_latency ;
202211 m_ops += other.m_ops ;
203212}
@@ -207,6 +216,8 @@ void totals_cmd::aggregate_average(size_t stats_size) {
207216 m_moved_sec /= stats_size;
208217 m_ask_sec /= stats_size;
209218 m_bytes_sec /= stats_size;
219+ m_bytes_sec_rx /= stats_size;
220+ m_bytes_sec_tx /= stats_size;
210221 m_latency /= stats_size;
211222}
212223
@@ -219,8 +230,9 @@ void totals_cmd::summarize(const one_sec_cmd_stats& other, unsigned long test_du
219230 } else {
220231 m_latency = 0 ;
221232 }
222-
223- m_bytes_sec = (other.m_bytes / 1024.0 ) / test_duration_usec * 1000000 ;
233+ m_bytes_sec = ((other.m_bytes_rx + other.m_bytes_tx ) / 1024.0 ) / test_duration_usec * 1000000 ;
234+ m_bytes_sec_rx = (other.m_bytes_rx / 1024.0 ) / test_duration_usec * 1000000 ;
235+ m_bytes_sec_tx = (other.m_bytes_tx / 1024.0 ) / test_duration_usec * 1000000 ;
224236 m_moved_sec = (double ) other.m_moved / test_duration_usec * 1000000 ;
225237 m_ask_sec = (double ) other.m_ask / test_duration_usec * 1000000 ;
226238}
@@ -265,7 +277,8 @@ totals::totals() :
265277 m_moved_sec(0 ),
266278 m_ask_sec(0 ),
267279 m_latency(0 ),
268- m_bytes(0 ),
280+ m_bytes_rx(0 ),
281+ m_bytes_tx(0 ),
269282 m_ops(0 ) {
270283}
271284
@@ -285,16 +298,18 @@ void totals::add(const totals& other) {
285298 m_moved_sec += other.m_moved_sec ;
286299 m_ask_sec += other.m_ask_sec ;
287300 m_bytes_sec += other.m_bytes_sec ;
301+ m_bytes_rx += other.m_bytes_rx ;
302+ m_bytes_tx += other.m_bytes_tx ;
288303 m_latency += other.m_latency ;
289- m_bytes += other.m_bytes ;
290304 m_ops += other.m_ops ;
291305
292306 // aggregate latency data
293307 hdr_add (latency_histogram,other.latency_histogram );
294308}
295309
296- void totals::update_op (unsigned long int bytes, unsigned int latency) {
297- m_bytes += bytes;
310+ void totals::update_op (unsigned long int bytes_rx, unsigned long int bytes_tx, unsigned int latency) {
311+ m_bytes_rx += bytes_rx;
312+ m_bytes_tx += bytes_tx;
298313 m_ops++;
299314 m_latency += latency;
300315 hdr_record_value (latency_histogram,latency);
0 commit comments