Name Date Size #Lines LOC

..--

resources/H25-Apr-2025-1,3401,339

.gitignoreH A D25-Apr-20258 21

README.mdH A D25-Apr-20252.4 KiB7654

configs.pyH A D25-Apr-20257.9 KiB194155

draw.pyH A D25-Apr-20254.6 KiB141114

top_down.pyH A D25-Apr-20255.9 KiB167123

utils.pyH A D25-Apr-20254.5 KiB137112

README.md

1# top-down 分析工具 ([English](#Top-down-Analysis-Tool))
2
3本目录集成了 top-down 分析所需要的工具。在使用 [env-scripts](https://github.com/OpenXiangShan/env-scripts) 脚本完成 checkpoint 的运行后,可以使用本目录下的工具进行 top-down 分析。
4
5## 使用方法
6
7``` shell
8# python top_down.py --help
9usage: generate top-down results
10
11optional arguments:
12  -h, --help            show this help message and exit
13  -s STAT_DIR, --stat-dir STAT_DIR
14                        stat output directory
15  -j JSON, --json JSON  specify json file
16```
17
18举例:
19
20``` shell
21# python top_down.py -s <...>/SPEC06_EmuTasks_1021_0.3_c157cf -j resources/spec06_rv64gcb_o2_20m.json
22# python top_down.py -s <...>/SPEC06_EmuTasks_1215_allbump -j <...>/spec06_rv64gcb_O3_20m_gcc12.2.0-intFpcOff-jeMalloc/checkpoint-0-0-0/cluster-0-0.json
23```
24
25脚本运行结束后,会生成 `results` 目录:
26
27``` shell
28# tree results
29results
30├── result.png
31├── results.csv
32└── results-weighted.csv
33
340 directories, 3 files
35```
36
37其中,`result.png` 为 top-down 堆叠条形统计图,`results.csv` 为各采样点的 top-down 计数器,`results-weighted.csv` 为各子项的加权 top-down 计数器。
38
39# <div id="Top-down-Analysis-Tool">Top-down Analysis Tool</div>
40
41This directory contains analysis tool for top-down. After running checkpoints by using [env-scripts](https://github.com/OpenXiangShan/env-scripts), you may use the tool to analyze top-down counters.
42
43## Usage
44
45``` shell
46# python top_down.py --help
47usage: generate top-down results
48
49optional arguments:
50  -h, --help            show this help message and exit
51  -s STAT_DIR, --stat-dir STAT_DIR
52                        stat output directory
53  -j JSON, --json JSON  specify json file
54```
55
56Some examples:
57
58``` shell
59# python top_down.py -s <...>/SPEC06_EmuTasks_1021_0.3_c157cf -j resources/spec06_rv64gcb_o2_20m.json
60# python top_down.py -s <...>/SPEC06_EmuTasks_1215_allbump -j <...>/spec06_rv64gcb_O3_20m_gcc12.2.0-intFpcOff-jeMalloc/checkpoint-0-0-0/cluster-0-0.json
61```
62
63A `results` directory would be generated then:
64
65``` shell
66# tree results
67results
68├── result.png
69├── results.csv
70└── results-weighted.csv
71
720 directories, 3 files
73```
74
75The `result.png` is a stacked bar chart of top-down. The `results.csv` contains per-checkpoint top-down counters. And the `results-weighted.csv` contains weighted counters for all sub tests.
76