Skip to content

Commit

Permalink
fixup! core+proto: Generalize histogram utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
dtnaylor committed May 15, 2019
1 parent a9e1039 commit 5a4f954
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
20 changes: 10 additions & 10 deletions bessctl/conf/port/latency.bess
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ while True:
(ret.timestamp - start_time,
diff_pkts / 1e6,
diff_bits / 1e6,
ret.latency.avg_ns / 1e3,
ret.latency.min_ns / 1e3,
ret.latency.percentile_values_ns[0] / 1e3,
ret.latency.percentile_values_ns[1] / 1e3,
ret.latency.max_ns / 1e3,
ret.jitter.avg_ns / 1e3,
ret.jitter.min_ns / 1e3,
ret.jitter.percentile_values_ns[0] / 1e3,
ret.jitter.percentile_values_ns[1] / 1e3,
ret.jitter.max_ns / 1e3))
ret.latency_ns.avg / 1e3,
ret.latency_ns.min / 1e3,
ret.latency_ns.percentile_values[0] / 1e3,
ret.latency_ns.percentile_values[1] / 1e3,
ret.latency_ns.max / 1e3,
ret.jitter_ns.avg / 1e3,
ret.jitter_ns.min / 1e3,
ret.jitter_ns.percentile_values[0] / 1e3,
ret.jitter_ns.percentile_values[1] / 1e3,
ret.jitter_ns.max / 1e3))
4 changes: 2 additions & 2 deletions bessctl/measurement_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ def next(self):
rtt = dict()
jitter = dict()
for i, p in enumerate(self.rtt_percentiles):
rtt[p] = mstats.latency.percentile_values_ns[i]
jitter[p] = mstats.jitter.percentile_values_ns[i]
rtt[p] = mstats.latency_ns.percentile_values[i]
jitter[p] = mstats.jitter_ns.percentile_values[i]

if self.rate:
now = time.time()
Expand Down
32 changes: 16 additions & 16 deletions bessctl/module_tests/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,28 @@ def test_timestamped_and_measured(self):
# timestamp: 1517529594.72
# packets: 64807616
# bits: 43550717952
# latency = {
# latency_ns = {
# count: 64807616
# min_ns: 400
# avg_ns: 513
# max_ns: 295600
# total_ns: 33273840000
# percentile_values_ns: [400, 500, 500, 500, 295600]
# resolution_ns: 100
# min: 400
# avg: 513
# max: 295600
# total: 33273840000
# percentile_values: [400, 500, 500, 500, 295600]
# resolution: 100
# }
# jitter = {
# jitter_ns = {
# count: 3238279
# avg_ns: 15
# max_ns: 295100
# total_ns: 48577800
# resolution_ns: 100
# avg: 15
# max: 295100
# total: 48577800
# resolution: 100
# }
print()
print('min ns =', stats.latency.min_ns)
print('avg ns =', stats.latency.avg_ns)
print('min ns =', stats.latency_ns.min)
print('avg ns =', stats.latency_ns.avg)
# these two should be approximately equal - within about 1%
a = stats.latency.avg_ns * stats.latency.count
b = stats.latency.total_ns
a = stats.latency_ns.avg * stats.latency_ns.count
b = stats.latency_ns.total
diff = abs(a - b) / float(b) * 100.0
self.assertLessEqual(diff, 1.0)

Expand Down

0 comments on commit 5a4f954

Please sign in to comment.