forked from pmem/pmemkv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount_ops.py
More file actions
executable file
·40 lines (35 loc) · 882 Bytes
/
Copy pathcount_ops.py
File metadata and controls
executable file
·40 lines (35 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
import getopt
import sys
def main():
#input arg : file name
if (len(sys.argv) != 2):
print("Please input log file")
exit(1)
log_file = sys.argv[1]
count = 0
count_fence = 0
count_flush = 0
count_store = 0
count_others = 0
operations = open(log_file).read().split("|")
for op in operations:
count+=1
op_value = op.split(";")[0]
if (op_value == "FENCE"):
count_fence += 1
elif (op_value == "STORE"):
count_store += 1
elif (op_value == "FLUSH"):
count_flush += 1
else:
count_others +=1
#print(str(op))
print("\n----- OP SUMMARY --------\n")
print("\n Total Ops : " + str(count))
print("\n Total store ops : " + str(count_store))
print("\n Total flush ops : " + str(count_flush))
print("\n Total fence ops : " + str(count_fence))
print("\n Other ops : " + str(count_others))
if __name__ == "__main__":
main()