]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb/src/third_party/duktape-1.8.0/examples/alloc-logging/log2gnuplot.py
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / prometheus-cpp / 3rdparty / civetweb / src / third_party / duktape-1.8.0 / examples / alloc-logging / log2gnuplot.py
1 #!/usr/bin/env python2
2 #
3 # Analyze allocator logs and write total-bytes-in-use after every
4 # operation to stdout. The output can be gnuplotted as:
5 #
6 # $ python log2gnuplot.py </tmp/duk-alloc-log.txt >/tmp/output.txt
7 # $ gnuplot
8 # > plot "output.txt" with lines
9 #
10
11 import os
12 import sys
13
14 def main():
15 allocated = 0
16
17 for line in sys.stdin:
18 line = line.strip()
19 parts = line.split(' ')
20
21 # A ptr/NULL/FAIL size
22 # F ptr/NULL size
23 # R ptr/NULL oldsize ptr/NULL/FAIL newsize
24
25 # Note: ajduk doesn't log oldsize (uses -1 instead)
26
27 if parts[0] == 'A':
28 if parts[1] != 'NULL' and parts[1] != 'FAIL':
29 allocated += long(parts[2])
30 elif parts[0] == 'F':
31 allocated -= long(parts[2])
32 elif parts[0] == 'R':
33 allocated -= long(parts[2])
34 if parts[3] != 'NULL' and parts[3] != 'FAIL':
35 allocated += long(parts[4])
36 print(allocated)
37
38 print(allocated)
39
40 if __name__ == '__main__':
41 main()