summaryrefslogtreecommitdiffstatsci
path: root/utils/json2csv
diff options
context:
space:
mode:
authorBryce Harrington <b.harrington@samsung.com>2014-04-30 18:03:55 -0700
committerBryce Harrington <b.harrington@samsung.com>2014-05-01 10:27:51 -0700
commit0a6b0ec981a40e4d0991223e2cbb97d0997eb752 (patch)
tree7e29d8ffde2ca0c6dcd5f0b44dcbe95a821fbf1c /utils/json2csv
parent7cd7c03222a76cd51d2e677bce784a6ec0abcb63 (diff)
utils: Move misc. scripts to utils
Diffstat (limited to 'utils/json2csv')
-rwxr-xr-xutils/json2csv21
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/json2csv b/utils/json2csv
new file mode 100755
index 0000000..1b49dd3
--- /dev/null
+++ b/utils/json2csv
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import sys
+import csv
+import json
+
+json_file = sys.argv[1]
+if len(sys.argv) > 2:
+ csv_file = sys.argv[2]
+else:
+ csv_file = "results.csv"
+
+with open(json_file) as file:
+ data = json.load(file)
+
+with open(csv_file, "w") as file:
+ csv_file = csv.writer(file)
+ for item in data:
+ csv_file.writerow([item['test case'], item['size'],
+ item['iterations'], item['minimum run time (s)'],
+ item['average run time (s)']])