MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / parse_json

Function parse_json

scripts/tools/draw-png.py:52–69  ·  view source on GitHub ↗
(json_file)

Source from the content-addressed store, hash-verified

50 print("%s: %s %s %f %s"%(self._label, self._algo, self._encode, self._cputime, self._time_unit))
51
52def parse_json(json_file):
53 with open(json_file, 'r') as f:
54 data = json.load(f)
55 benchmarks = data["benchmarks"]
56 records = []
57 for benchmark in benchmarks:
58 record = Record(benchmark)
59 records.append(record)
60
61 tests = {}
62 for record in records:
63 if record.is_decode() or record.is_encode():
64 if record.category() not in tests:
65 tests[record.category()] = [record]
66 else:
67 tests[record.category()].append(record)
68
69 return tests
70
71def to_percent(temp, position):
72 return '%1.0f'%(100*temp) + '%'

Callers 1

mainFunction · 0.70

Calls 5

is_decodeMethod · 0.95
is_encodeMethod · 0.95
categoryMethod · 0.95
RecordClass · 0.85
loadMethod · 0.45

Tested by

no test coverage detected