]>
git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/scripts/histogram.py
8 buf
= sys
.stdin
.readlines()
9 json
= json
.loads(" ".join(buf
))
10 histogram
= base64
.b64decode(json
["histogram"])
11 bucket_shift
= json
["bucket_shift"]
12 tsc_rate
= json
["tsc_rate"]
14 print("Latency histogram")
15 print("==============================================================================")
16 print(" Range in us Cumulative IO count")
22 for i
in range(0, 64 - bucket_shift
):
23 for j
in range(0, (1 << bucket_shift
)):
24 index
= (((i
<< bucket_shift
) + j
) * 8)
25 total
+= int.from_bytes(histogram
[index
:index
+ 8], 'little')
27 for i
in range(0, 64 - bucket_shift
):
28 for j
in range(0, (1 << bucket_shift
)):
29 index
= (((i
<< bucket_shift
) + j
)*8)
30 count
= int.from_bytes(histogram
[index
:index
+ 8], 'little')
35 bucket
= (1 << (i
+ bucket_shift
- 1))
36 bucket
+= ((j
+1) << (i
- 1))
40 start
= last_bucket
* 1000 * 1000 / tsc_rate
41 end
= bucket
* 1000 * 1000 / tsc_rate
42 so_far_pct
= so_far
* 100.0 / total
44 print("%9.3f - %9.3f: %9.4f%% (%9u)" % (start
, end
, so_far_pct
, count
))