perf stat: Factor out body of event handling loop for fork case
authorAlexey Budankov <alexey.budankov@linux.intel.com>
Fri, 17 Jul 2020 07:03:19 +0000 (10:03 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 22 Jul 2020 12:43:12 +0000 (09:43 -0300)
Factor out body of event handling loop for fork case reusing
handle_interval() function.

Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/a8ae3f8d-a30e-fd40-998a-f5ca3e98cd45@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-stat.c

index 87eebf3..91f3151 100644 (file)
@@ -792,10 +792,7 @@ try_again_reset:
                if (interval || timeout) {
                        while (!waitpid(child_pid, &status, WNOHANG)) {
                                nanosleep(&ts, NULL);
-                               if (timeout)
-                                       break;
-                               process_interval();
-                               if (interval_count && !(--times))
+                               if (timeout || handle_interval(interval, &times))
                                        break;
                        }
                }