]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
refperf: Allow decimal nanoseconds
authorPaul E. McKenney <paulmck@kernel.org>
Mon, 25 May 2020 22:31:07 +0000 (15:31 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 29 Jun 2020 19:00:44 +0000 (12:00 -0700)
The CONFIG_PREEMPT=n rcu_read_lock()/rcu_read_unlock() pair's overhead,
even including loop overhead, is far less than one nanosecond.
Since logscale plots are not all that happy with zero values, provide
picoseconds as decimals.

Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/refperf.c

index 57c7b7a40bd23f0b124a474742376116e2601a89..e991d4820f51054b5a96e62f15526ed7eb7c7b93 100644 (file)
@@ -375,7 +375,7 @@ static int main_func(void *arg)
                if (torture_must_stop())
                        goto end;
 
-               reader_tasks[exp].result_avg = process_durations(exp) / ((exp + 1) * loops);
+               reader_tasks[exp].result_avg = 1000 * process_durations(exp) / ((exp + 1) * loops);
        }
 
        // Print the average of all experiments
@@ -386,7 +386,7 @@ static int main_func(void *arg)
        strcat(buf, "Threads\tTime(ns)\n");
 
        for (exp = 0; exp < nreaders; exp++) {
-               sprintf(buf1, "%d\t%llu\n", exp + 1, reader_tasks[exp].result_avg);
+               sprintf(buf1, "%d\t%llu.%03d\n", exp + 1, reader_tasks[exp].result_avg / 1000, (int)(reader_tasks[exp].result_avg % 1000));
                strcat(buf, buf1);
        }