| 50 | print("%s: %s %s %f %s"%(self._label, self._algo, self._encode, self._cputime, self._time_unit)) |
| 51 | |
| 52 | def 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 | |
| 71 | def to_percent(temp, position): |
| 72 | return '%1.0f'%(100*temp) + '%' |