Commit 571f1eb9 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf callchain: Introduce callchain_cursor__copy()

The callchain_cursor__copy() function is to save current callchain
captured by a cursor.  It'll be used to keep callchains when switching
to idle task for each cpu.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161206034010.6499-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 6fa94258
......@@ -1234,3 +1234,30 @@ int callchain_node__make_parent_list(struct callchain_node *node)
}
return -ENOMEM;
}
int callchain_cursor__copy(struct callchain_cursor *dst,
struct callchain_cursor *src)
{
int rc = 0;
callchain_cursor_reset(dst);
callchain_cursor_commit(src);
while (true) {
struct callchain_cursor_node *node;
node = callchain_cursor_current(src);
if (node == NULL)
break;
rc = callchain_cursor_append(dst, node->ip, node->map, node->sym,
node->branch, &node->branch_flags,
node->nr_loop_iter, node->samples);
if (rc)
break;
callchain_cursor_advance(src);
}
return rc;
}
......@@ -216,6 +216,9 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor)
cursor->pos++;
}
int callchain_cursor__copy(struct callchain_cursor *dst,
struct callchain_cursor *src);
struct option;
struct hist_entry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment