adding system info

Change-Id: I1f7d23bd7c7e317eed9e177f0c7681226be4bfca
Este commit está contenido en:
Evgeny
2020-03-24 22:01:34 -05:00
padre 299a08e4be
commit c77a6236e7
Se han modificado 4 ficheros con 148 adiciones y 7 borrados
+15 -2
Ver fichero
@@ -22,6 +22,7 @@
import csv, sqlite3, re, sys
from functools import reduce
from txt2params import gen_params
# SQLite Database class
class SQLiteDB:
@@ -133,13 +134,13 @@ class SQLiteDB:
if not re.search(r'\.json$', file_name):
raise Exception('wrong output file type: "' + file_name + '"' )
with open(file_name, mode='a') as fd:
fd.write(']}\n');
fd.write('}')
def label_json(self, pid, label, file_name):
if not re.search(r'\.json$', file_name):
raise Exception('wrong output file type: "' + file_name + '"' )
with open(file_name, mode='a') as fd:
fd.write(',{"args":{"name":"%s %s"},"ph":"M","pid":%s,"name":"process_name"}\n' %(self.section_index, label, pid));
fd.write(',{"args":{"name":"%s"},"ph":"M","pid":%s,"name":"process_name","sort_index":%d}\n' %(label, pid, self.section_index))
self.section_index += 1
def flow_json(self, base_id, from_pid, from_tid, from_us_list, to_pid, to_us_dict, corr_id_list, start_us, file_name):
@@ -158,6 +159,18 @@ class SQLiteDB:
fd.write(',{"ts":%d,"ph":"t","cat":"DataFlow","id":%d,"pid":%s,"tid":0,"name":"dep"}\n' % (to_ts, dep_id, str(to_pid)))
dep_id += 1
def metadata_json(self, jsonfile, sysinfo_file):
params = gen_params(sysinfo_file);
with open(jsonfile, mode='a') as fd:
fd.write('],\n')
fd.write('"otherData": {\n')
cnt = 0
for key in params:
if cnt != 0: fd.write(',\n')
fd.write(' "' + key + '": "' + params[key] + '"')
cnt = cnt + 1
fd.write('\n }\n')
def dump_json(self, table_name, data_name, file_name):
if not re.search(r'\.json$', file_name):
raise Exception('wrong output file type: "' + file_name + '"' )