libperf: Add 'flush' to 'struct perf_mmap'
authorJiri Olsa <jolsa@kernel.org>
Tue, 27 Aug 2019 14:05:18 +0000 (16:05 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 25 Sep 2019 12:51:46 +0000 (09:51 -0300)
Move 'flush' from tools/perf's mmap to libperf's perf_mmap struct.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lore.kernel.org/lkml/20190913132355.21634-19-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c
tools/perf/lib/include/internal/mmap.h
tools/perf/util/mmap.c
tools/perf/util/mmap.h

index 2520c02122750776202d6597a42d0dfe0d69ea69..06738efd9820607b49af03cffc3254e59d5466db 100644 (file)
@@ -973,13 +973,13 @@ static int record__mmap_read_evlist(struct record *rec, struct evlist *evlist,
                if (map->core.base) {
                        record__adjust_affinity(rec, map);
                        if (synch) {
-                               flush = map->flush;
-                               map->flush = 1;
+                               flush = map->core.flush;
+                               map->core.flush = 1;
                        }
                        if (!record__aio_enabled(rec)) {
                                if (perf_mmap__push(map, rec, record__pushfn) < 0) {
                                        if (synch)
-                                               map->flush = flush;
+                                               map->core.flush = flush;
                                        rc = -1;
                                        goto out;
                                }
@@ -987,13 +987,13 @@ static int record__mmap_read_evlist(struct record *rec, struct evlist *evlist,
                                if (record__aio_push(rec, map, &off) < 0) {
                                        record__aio_set_pos(trace_fd, off);
                                        if (synch)
-                                               map->flush = flush;
+                                               map->core.flush = flush;
                                        rc = -1;
                                        goto out;
                                }
                        }
                        if (synch)
-                               map->flush = flush;
+                               map->core.flush = flush;
                }
 
                if (map->auxtrace_mmap.base && !rec->opts.auxtrace_snapshot_mode &&
index 10653b6e864e63efa84575c825d5902330e3b1c4..ba1e519c15b912235e7d5fe08e991a4b7464f1f5 100644 (file)
@@ -25,6 +25,7 @@ struct perf_mmap {
        u64              start;
        u64              end;
        bool             overwrite;
+       u64              flush;
        char             event_copy[PERF_SAMPLE_MAX_SIZE] __aligned(8);
 };
 
index 4b8ec8dd79c5f6e1fc4ffce1032b6d0356d0bbfc..4cc3b54b2f73f20b4f689ebff91998685aa8d446 100644 (file)
@@ -383,7 +383,7 @@ int perf_mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu)
 
        perf_mmap__setup_affinity_mask(map, mp);
 
-       map->flush = mp->flush;
+       map->core.flush = mp->flush;
 
        map->comp_level = mp->comp_level;
 
@@ -450,7 +450,7 @@ static int __perf_mmap__read_init(struct mmap *md)
        md->core.start = md->core.overwrite ? head : old;
        md->core.end = md->core.overwrite ? old : head;
 
-       if ((md->core.end - md->core.start) < md->flush)
+       if ((md->core.end - md->core.start) < md->core.flush)
                return -EAGAIN;
 
        size = md->core.end - md->core.start;
index 75c77fa5712144b4361bd7d6b8b7ba22df7f15ce..e567c1c875bdb8f65d1d82b8b3a8a47fff538191 100644 (file)
@@ -32,7 +32,6 @@ struct mmap {
        } aio;
 #endif
        cpu_set_t       affinity_mask;
-       u64             flush;
        void            *data;
        int             comp_level;
 };