diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-09-13 09:28:57 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-04 16:16:39 +0100 |
commit | 4dfced359fbc719a35527416f1b4b3999647f68b (patch) | |
tree | bfa501673ebf02c77818e87a374ff9a80bec974e /tools/perf/util/comm.c | |
parent | perf tools: Compare hists comm by addresses (diff) | |
download | linux-4dfced359fbc719a35527416f1b4b3999647f68b.tar.xz linux-4dfced359fbc719a35527416f1b4b3999647f68b.zip |
perf tools: Get current comm instead of last one
At insert time, a hist entry should reference comm at the time otherwise
it'll get the last comm anyway.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/n/tip-n6pykiiymtgmcjs834go2t8x@git.kernel.org
[ Fixed up const pointer issues ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/comm.c')
-rw-r--r-- | tools/perf/util/comm.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/util/comm.c b/tools/perf/util/comm.c index 8b3ac9f0207f..ee0df0e24cdb 100644 --- a/tools/perf/util/comm.c +++ b/tools/perf/util/comm.c @@ -94,6 +94,21 @@ struct comm *comm__new(const char *str, u64 timestamp) return comm; } +void comm__override(struct comm *comm, const char *str, u64 timestamp) +{ + struct comm_str *old = comm->comm_str; + + comm->comm_str = comm_str__findnew(str, &comm_str_root); + if (!comm->comm_str) { + comm->comm_str = old; + return; + } + + comm->start = timestamp; + comm_str__get(comm->comm_str); + comm_str__put(old); +} + void comm__free(struct comm *comm) { comm_str__put(comm->comm_str); |