Skip to content

Commit

Permalink
feat(simpoint): Support writting basic block info (first pc and secon…
Browse files Browse the repository at this point in the history
…d pc) into simpoint_bbv file

Signed-off-by: jiaxiaoyu <[email protected]>
  • Loading branch information
xyyy1420 committed Feb 25, 2025
1 parent 72ab2ee commit d6bd747
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ config ENGINE_INTERPRETER
Interpreter guest instructions one by one.
endchoice

choice
prompt "NEMU profiling config"
default PROFILING_SIMPLIFIED_MODEL

config PROFILING_SIMPLIFIED_MODEL
bool "Simplified model"
help
NEMU profiling output T:block_id:block_count, for cluster.

config PROFILING_DETAIL_MODEL
bool "Detail model"
help
NEMU profiling output T:first_pc:second_pc:block_id:block_count, for parser simpoint_bbv file.
endchoice

config ENGINE
string
default "interpreter" if ENGINE_INTERPRETER
Expand Down
8 changes: 8 additions & 0 deletions src/checkpoint/simpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ SimPoint::profile(Addr pc, bool is_control, bool is_last_uop, unsigned instr_cou
// (intervalCount) and the excessive inst count from the previous
// interval (intervalDrift) is greater than/equal to the interval size.
if (intervalCount + intervalDrift >= intervalSize) {
#ifdef CONFIG_PROFILING_DETAIL_MODEL
*simpointStream->stream() << "T";
for (auto map_itr = bbMap.begin(); map_itr != bbMap.end(); ++map_itr) {
*simpointStream->stream() << ":" << map_itr->first.first << ":" << map_itr->first.second << ":"
<< map_itr->second.id << ":" << map_itr->second.count << " ";
}
#else
// summarize interval and display BBV info
std::vector<std::pair<uint64_t, uint64_t> > counts;
for (auto map_itr = bbMap.begin(); map_itr != bbMap.end(); ++map_itr) {
Expand All @@ -159,6 +166,7 @@ SimPoint::profile(Addr pc, bool is_control, bool is_last_uop, unsigned instr_cou
for (auto cnt_itr = counts.begin(); cnt_itr != counts.end(); ++cnt_itr) {
*simpointStream->stream() << ":" << cnt_itr->first << ":" << cnt_itr->second << " ";
}
#endif
*simpointStream->stream() << "\n";
Logsp("Simpoint profilied %lu instrs", intervalCount);

Expand Down

0 comments on commit d6bd747

Please sign in to comment.