Skip to content

Commit

Permalink
i#6426 sched stats: Print list of threads (#6791)
Browse files Browse the repository at this point in the history
Adds the list of threads per cpu to the schedule_stats output. Updates
the schedule_stats tests to confirm some tids are printed.

Issue: #6426
  • Loading branch information
derekbruening authored Apr 25, 2024
1 parent 092b4f2 commit 3c22f53
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion clients/drcachesim/tests/core_serial.templatex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Schedule stats tool results:
Total counts:
4 cores
8 threads
8 threads: 1257.*
638938 instructions
6 total context switches
0.0093906 CSPKI \(context switches per 1000 instructions\)
Expand Down
10 changes: 5 additions & 5 deletions clients/drcachesim/tests/schedule_stats_nopreempt.templatex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Schedule stats tool results:
Total counts:
4 cores
8 threads
8 threads: 1257.*
638938 instructions
6 total context switches
0\.0093906 CSPKI \(context switches per 1000 instructions\)
Expand All @@ -22,7 +22,7 @@ Total counts:
*[0-9\.]*% cpu busy by time
*[0-9\.]*% cpu busy by time, ignoring idle past last instr
Core #0 counts:
. threads
. threads: 1257.*
*[0-9]* instructions
. total context switches
0\.0[0-9\.]* CSPKI \(context switches per 1000 instructions\)
Expand All @@ -43,7 +43,7 @@ Core #0 counts:
*[0-9\.]*% cpu busy by time
*[0-9\.]*% cpu busy by time, ignoring idle past last instr
Core #1 counts:
. threads
. threads: 1257.*
*[0-9]* instructions
. total context switches
0\.0[0-9\.]* CSPKI \(context switches per 1000 instructions\)
Expand All @@ -64,7 +64,7 @@ Core #1 counts:
*[0-9\.]*% cpu busy by time
*[0-9\.]*% cpu busy by time, ignoring idle past last instr
Core #2 counts:
. threads
. threads: 1257.*
*[0-9]* instructions
. total context switches
0\.0[0-9\.]* CSPKI \(context switches per 1000 instructions\)
Expand All @@ -85,7 +85,7 @@ Core #2 counts:
*[0-9\.]*% cpu busy by time
*[0-9\.]*% cpu busy by time, ignoring idle past last instr
Core #3 counts:
. threads
. threads: 1257.*
*[0-9]* instructions
. total context switches
0\.0[0-9\.]* CSPKI \(context switches per 1000 instructions\)
Expand Down
13 changes: 12 additions & 1 deletion clients/drcachesim/tools/schedule_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,18 @@ schedule_stats_t::print_percentage(double numerator, double denominator,
void
schedule_stats_t::print_counters(const counters_t &counters)
{
std::cerr << std::setw(12) << counters.threads.size() << " threads\n";
std::cerr << std::setw(12) << counters.threads.size() << " threads";
if (!counters.threads.empty()) {
std::cerr << ": ";
auto it = counters.threads.begin();
while (it != counters.threads.end()) {
std::cerr << *it;
++it;
if (it != counters.threads.end())
std::cerr << ", ";
}
}
std::cerr << "\n";
std::cerr << std::setw(12) << counters.instrs << " instructions\n";
std::cerr << std::setw(12) << counters.total_switches << " total context switches\n";
double cspki = 0.;
Expand Down

0 comments on commit 3c22f53

Please sign in to comment.