Skip to content

Commit dba3142

Browse files
committed
scftorture: Summarize per-thread statistics
This commit summarizes the per-thread statistics, providing counts of the number of single, many, and all calls, both no-wait and wait, and, for the single case, the number where the target CPU was offline. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent bca3711 commit dba3142

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

kernel/scftorture.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,27 @@ DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
128128
static void scf_torture_stats_print(void)
129129
{
130130
int cpu;
131+
int i;
131132
long long invoked_count = 0;
132133
bool isdone = READ_ONCE(scfdone);
134+
struct scf_statistics scfs = {};
133135

134136
for_each_possible_cpu(cpu)
135137
invoked_count += data_race(per_cpu(scf_invoked_count, cpu));
136-
pr_alert("%s scf_invoked_count %s: %lld ",
137-
SCFTORT_FLAG, isdone ? "VER" : "ver", invoked_count);
138+
for (i = 0; i < nthreads; i++) {
139+
scfs.n_single += scf_stats_p[i].n_single;
140+
scfs.n_single_ofl += scf_stats_p[i].n_single_ofl;
141+
scfs.n_single_wait += scf_stats_p[i].n_single_wait;
142+
scfs.n_single_wait_ofl += scf_stats_p[i].n_single_wait_ofl;
143+
scfs.n_many += scf_stats_p[i].n_many;
144+
scfs.n_many_wait += scf_stats_p[i].n_many_wait;
145+
scfs.n_all += scf_stats_p[i].n_all;
146+
scfs.n_all_wait += scf_stats_p[i].n_all_wait;
147+
}
148+
pr_alert("%s scf_invoked_count %s: %lld single: %lld/%lld single_ofl: %lld/%lld many: %lld/%lld all: %lld/%lld ",
149+
SCFTORT_FLAG, isdone ? "VER" : "ver", invoked_count,
150+
scfs.n_single, scfs.n_single_wait, scfs.n_single_ofl, scfs.n_single_wait_ofl,
151+
scfs.n_many, scfs.n_many_wait, scfs.n_all, scfs.n_all_wait);
138152
torture_onoff_stats();
139153
pr_cont("\n");
140154
}
@@ -357,11 +371,11 @@ static void scf_torture_cleanup(void)
357371
torture_stop_kthread("scftorture_invoker", scf_stats_p[i].task);
358372
else
359373
goto end;
360-
kfree(scf_stats_p);
361-
scf_stats_p = NULL;
362374
smp_call_function(scf_cleanup_handler, NULL, 0);
363375
torture_stop_kthread(scf_torture_stats, scf_torture_stats_task);
364376
scf_torture_stats_print(); // -After- the stats thread is stopped!
377+
kfree(scf_stats_p); // -After- the last stats print has completed!
378+
scf_stats_p = NULL;
365379

366380
if (atomic_read(&n_errs))
367381
scftorture_print_module_parms("End of test: FAILURE");

0 commit comments

Comments
 (0)