Moving samples value into struct record_thread, because
we need to have this value per thread for checking
if there have been new data.

Link: http://lkml.kernel.org/n/tip-yhah10r7jikirxhbprxs3...@git.kernel.org
Signed-off-by: Jiri Olsa <jo...@kernel.org>
---
 tools/perf/builtin-record.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 62ff4411ce39..b17445f332a8 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -72,6 +72,7 @@ struct record_thread {
        int                       ovw_mmap_nr;
        struct fdarray            pollfd;
        struct record            *rec;
+       unsigned long long        samples;
 };
 
 struct record {
@@ -159,7 +160,7 @@ static int record__pushfn(struct perf_mmap *map, void *to, 
void *bf, size_t size
 {
        struct record *rec = to;
 
-       rec->samples++;
+       thread->samples++;
        return record__write(rec, map, bf, size);
 }
 
@@ -243,7 +244,7 @@ static int record__auxtrace_mmap_read(struct record *rec,
                return ret;
 
        if (ret)
-               rec->samples++;
+               thread->samples++;
 
        return 0;
 }
@@ -260,7 +261,7 @@ static int record__auxtrace_mmap_read_snapshot(struct 
record *rec,
                return ret;
 
        if (ret)
-               rec->samples++;
+               thread->samples++;
 
        return 0;
 }
@@ -1346,7 +1347,7 @@ static int __cmd_record(struct record *rec, int argc, 
const char **argv)
        trigger_ready(&switch_output_trigger);
        perf_hooks__invoke_record_start();
        for (;;) {
-               unsigned long long hits = rec->samples;
+               unsigned long long hits = thread->samples;
 
                /*
                 * rec->evlist->bkw_mmap_state is possible to be
@@ -1415,7 +1416,7 @@ static int __cmd_record(struct record *rec, int argc, 
const char **argv)
                                alarm(rec->switch_output.time);
                }
 
-               if (hits == rec->samples) {
+               if (hits == thread->samples) {
                        if (done || draining)
                                break;
                        err = fdarray__poll(&thread->pollfd, -1);
-- 
2.17.1

Reply via email to