diff options
author | Jiri Olsa <jolsa@kernel.org> | 2018-06-20 05:40:36 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-06-25 10:59:37 -0400 |
commit | 983107072be1a39cbde67d45cb0059138190e015 (patch) | |
tree | a6e3768d99fe34d3ac21e6ffabd739dd44d53be4 /tools/perf/bench | |
parent | 6dde6429c5ff5b38d6d40a14a6ee105117e6364d (diff) |
perf bench: Fix numa report output code
Currently we can hit following assert when running numa bench:
$ perf bench numa mem -p 3 -t 1 -P 512 -s 100 -zZ0cm --thp 1
perf: bench/numa.c:1577: __bench_numa: Assertion `!(!(((wait_stat) & 0x7f) == 0))' failed.
The assertion is correct, because we hit the SIGFPE in following line:
Thread 2.2 "thread 0/0" received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0x7fffd28c6700 (LWP 11750)]
0x000.. in worker_thread (__tdata=0x7.. ) at bench/numa.c:1257
1257 td->speed_gbs = bytes_done / (td->runtime_ns / NSEC_PER_SEC) / 1e9;
We don't check if the runtime is actually bigger than 1 second,
and thus this might end up with zero division within FPU.
Adding the check to prevent this.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180620094036.17278-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/bench')
-rw-r--r-- | tools/perf/bench/numa.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 63eb49082774..44195514b19e 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c | |||
@@ -1098,7 +1098,7 @@ static void *worker_thread(void *__tdata) | |||
1098 | u8 *global_data; | 1098 | u8 *global_data; |
1099 | u8 *process_data; | 1099 | u8 *process_data; |
1100 | u8 *thread_data; | 1100 | u8 *thread_data; |
1101 | u64 bytes_done; | 1101 | u64 bytes_done, secs; |
1102 | long work_done; | 1102 | long work_done; |
1103 | u32 l; | 1103 | u32 l; |
1104 | struct rusage rusage; | 1104 | struct rusage rusage; |
@@ -1254,7 +1254,8 @@ static void *worker_thread(void *__tdata) | |||
1254 | timersub(&stop, &start0, &diff); | 1254 | timersub(&stop, &start0, &diff); |
1255 | td->runtime_ns = diff.tv_sec * NSEC_PER_SEC; | 1255 | td->runtime_ns = diff.tv_sec * NSEC_PER_SEC; |
1256 | td->runtime_ns += diff.tv_usec * NSEC_PER_USEC; | 1256 | td->runtime_ns += diff.tv_usec * NSEC_PER_USEC; |
1257 | td->speed_gbs = bytes_done / (td->runtime_ns / NSEC_PER_SEC) / 1e9; | 1257 | secs = td->runtime_ns / NSEC_PER_SEC; |
1258 | td->speed_gbs = secs ? bytes_done / secs / 1e9 : 0; | ||
1258 | 1259 | ||
1259 | getrusage(RUSAGE_THREAD, &rusage); | 1260 | getrusage(RUSAGE_THREAD, &rusage); |
1260 | td->system_time_ns = rusage.ru_stime.tv_sec * NSEC_PER_SEC; | 1261 | td->system_time_ns = rusage.ru_stime.tv_sec * NSEC_PER_SEC; |