Skip to content

Commit 20c013d

Browse files
List ingress and egress separately on JSON and CSV exports. Include BW and also raw values per second (#246)
1 parent 912a6da commit 20c013d

File tree

8 files changed

+284
-91
lines changed

8 files changed

+284
-91
lines changed

client.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,16 @@ void client::handle_response(unsigned int conn_id, struct timeval timestamp,
445445
switch (request->m_type) {
446446
case rt_get:
447447
m_stats.update_get_op(&timestamp,
448-
request->m_size + response->get_total_len(),
448+
response->get_total_len(),
449+
request->m_size,
449450
ts_diff(request->m_sent_time, timestamp),
450451
response->get_hits(),
451452
request->m_keys - response->get_hits());
452453
break;
453454
case rt_set:
454455
m_stats.update_set_op(&timestamp,
455-
request->m_size + response->get_total_len(),
456+
response->get_total_len(),
457+
request->m_size,
456458
ts_diff(request->m_sent_time, timestamp));
457459
break;
458460
case rt_wait:
@@ -462,7 +464,8 @@ void client::handle_response(unsigned int conn_id, struct timeval timestamp,
462464
case rt_arbitrary: {
463465
arbitrary_request *ar = static_cast<arbitrary_request *>(request);
464466
m_stats.update_arbitrary_op(&timestamp,
465-
request->m_size + response->get_total_len(),
467+
response->get_total_len(),
468+
request->m_size,
466469
ts_diff(request->m_sent_time, timestamp),
467470
ar->index);
468471
break;

cluster_client.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,19 @@ void cluster_client::handle_moved(unsigned int conn_id, struct timeval timestamp
418418
// update stats
419419
if (request->m_type == rt_get) {
420420
m_stats.update_moved_get_op(&timestamp,
421-
request->m_size + response->get_total_len(),
421+
response->get_total_len(),
422+
request->m_size,
422423
ts_diff(request->m_sent_time, timestamp));
423424
} else if (request->m_type == rt_set) {
424425
m_stats.update_moved_set_op(&timestamp,
425-
request->m_size + response->get_total_len(),
426+
response->get_total_len(),
427+
request->m_size,
426428
ts_diff(request->m_sent_time, timestamp));
427429
} else if (request->m_type == rt_arbitrary) {
428430
arbitrary_request *ar = static_cast<arbitrary_request *>(request);
429431
m_stats.update_moved_arbitrary_op(&timestamp,
430-
request->m_size + response->get_total_len(),
432+
response->get_total_len(),
433+
request->m_size,
431434
ts_diff(request->m_sent_time, timestamp),
432435
ar->index);
433436
} else {
@@ -452,16 +455,19 @@ void cluster_client::handle_ask(unsigned int conn_id, struct timeval timestamp,
452455
// update stats
453456
if (request->m_type == rt_get) {
454457
m_stats.update_ask_get_op(&timestamp,
455-
request->m_size + response->get_total_len(),
458+
response->get_total_len(),
459+
request->m_size,
456460
ts_diff(request->m_sent_time, timestamp));
457461
} else if (request->m_type == rt_set) {
458462
m_stats.update_ask_set_op(&timestamp,
459-
request->m_size + response->get_total_len(),
463+
response->get_total_len(),
464+
request->m_size,
460465
ts_diff(request->m_sent_time, timestamp));
461466
} else if (request->m_type == rt_arbitrary) {
462467
arbitrary_request *ar = static_cast<arbitrary_request *>(request);
463468
m_stats.update_ask_arbitrary_op(&timestamp,
464-
request->m_size + response->get_total_len(),
469+
response->get_total_len(),
470+
request->m_size,
465471
ts_diff(request->m_sent_time, timestamp),
466472
ar->index);
467473
} else {

run_stats.cpp

Lines changed: 71 additions & 43 deletions
Large diffs are not rendered by default.

run_stats.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,21 @@ class run_stats {
121121
void set_start_time(struct timeval* start_time);
122122
void set_end_time(struct timeval* end_time);
123123

124-
void update_get_op(struct timeval* ts, unsigned int bytes, unsigned int latency, unsigned int hits, unsigned int misses);
125-
void update_set_op(struct timeval* ts, unsigned int bytes, unsigned int latency);
124+
void update_get_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency, unsigned int hits, unsigned int misses);
125+
void update_set_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency);
126126

127-
void update_moved_get_op(struct timeval* ts, unsigned int bytes, unsigned int latency);
128-
void update_moved_set_op(struct timeval* ts, unsigned int bytes, unsigned int latency);
129-
void update_moved_arbitrary_op(struct timeval *ts, unsigned int bytes,
127+
void update_moved_get_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency);
128+
void update_moved_set_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency);
129+
void update_moved_arbitrary_op(struct timeval *ts, unsigned int bytes_rx, unsigned int bytes_tx,
130130
unsigned int latency, size_t arbitrary_index);
131131

132-
void update_ask_get_op(struct timeval* ts, unsigned int bytes, unsigned int latency);
133-
void update_ask_set_op(struct timeval* ts, unsigned int bytes, unsigned int latency);
134-
void update_ask_arbitrary_op(struct timeval *ts, unsigned int bytes,
132+
void update_ask_get_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency);
133+
void update_ask_set_op(struct timeval* ts, unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency);
134+
void update_ask_arbitrary_op(struct timeval *ts, unsigned int bytes_rx, unsigned int bytes_tx,
135135
unsigned int latency, size_t arbitrary_index);
136136

137137
void update_wait_op(struct timeval* ts, unsigned int latency);
138-
void update_arbitrary_op(struct timeval *ts, unsigned int bytes,
138+
void update_arbitrary_op(struct timeval *ts, unsigned int bytes_rx, unsigned int bytes_tx,
139139
unsigned int latency, size_t arbitrary_index);
140140

141141
void aggregate_average(const std::vector<run_stats>& all_stats);

run_stats_types.cpp

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727

2828

2929
one_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

4344
void 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

5759
void 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() {
132136
unsigned 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) {
187192
totals_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);

run_stats_types.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class safe_hdr_histogram {
7575

7676
class one_sec_cmd_stats {
7777
public:
78-
unsigned long int m_bytes;
78+
unsigned long int m_bytes_rx;
79+
unsigned long int m_bytes_tx;
7980
unsigned long int m_ops;
8081
unsigned int m_hits;
8182
unsigned int m_misses;
@@ -90,10 +91,10 @@ class one_sec_cmd_stats {
9091
void reset();
9192
void merge(const one_sec_cmd_stats& other);
9293
void summarize_quantiles(safe_hdr_histogram histogram, std::vector<float> quantiles);
93-
void update_op(unsigned int bytes, unsigned int latency);
94-
void update_op(unsigned int bytes, unsigned int latency, unsigned int hits, unsigned int misses);
95-
void update_moved_op(unsigned int bytes, unsigned int latency);
96-
void update_ask_op(unsigned int bytes, unsigned int latency);
94+
void update_op(unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency);
95+
void update_op(unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency, unsigned int hits, unsigned int misses);
96+
void update_moved_op(unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency);
97+
void update_ask_op(unsigned int bytes_rx, unsigned int bytes_tx, unsigned int latency);
9798
};
9899

99100
class one_second_stats; // forward declaration
@@ -135,6 +136,8 @@ class totals_cmd {
135136
public:
136137
double m_ops_sec;
137138
double m_bytes_sec;
139+
double m_bytes_sec_rx;
140+
double m_bytes_sec_tx;
138141
double m_moved_sec;
139142
double m_ask_sec;
140143
double m_latency;
@@ -173,17 +176,22 @@ class totals {
173176
safe_hdr_histogram latency_histogram;
174177
double m_ops_sec;
175178
double m_bytes_sec;
179+
double m_bytes_sec_rx;
180+
double m_bytes_sec_tx;
176181
double m_hits_sec;
177182
double m_misses_sec;
178183
double m_moved_sec;
179184
double m_ask_sec;
180185
unsigned long long int m_latency;
181-
unsigned long int m_bytes;
186+
// number of bytes received
187+
unsigned long int m_bytes_rx;
188+
// number of bytes sent
189+
unsigned long int m_bytes_tx;
182190
unsigned long int m_ops;
183191
totals();
184192
void setup_arbitrary_commands(size_t n_arbitrary_commands);
185193
void add(const totals& other);
186-
void update_op(unsigned long int bytes, unsigned int latency);
194+
void update_op(unsigned long int bytes_rx, unsigned long int bytes_tx, unsigned int latency);
187195
};
188196

189197

tests/include.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,31 @@ def agg_keyspace_range(master_nodes_connections):
158158
shard_count = int(shard_reply['db0']['keys'])
159159
overall_keyspace_range = overall_keyspace_range + shard_count
160160
return overall_keyspace_range
161+
162+
163+
def get_column_csv(filename,column_name):
164+
found = False
165+
with open(filename,"r") as fd:
166+
stop_line = 0
167+
lines = fd.readlines()
168+
for line in lines:
169+
# CSV is the first part of file
170+
if "Full-Test GET Latency" in line or len(line) == 0:
171+
break
172+
stop_line = stop_line + 1
173+
print(stop_line)
174+
csv_lines = lines[1:stop_line-1]
175+
header_line = csv_lines[0].strip().split(",")
176+
col_pos = -1
177+
for col_index,col in enumerate(header_line):
178+
if column_name == col:
179+
col_pos = col_index
180+
found = True
181+
data_lines = []
182+
for line in csv_lines[1:]:
183+
data_lines.append(line.strip().split(","))
184+
column_data = []
185+
if found is True:
186+
for line in data_lines:
187+
column_data.append(line[col_pos])
188+
return found, column_data

0 commit comments

Comments
 (0)