Commit 7cb2a53f authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf record: Allow to specify max stack depth of fp callchain

Currently it has no interface to specify the max stack depth for perf
record.  Extend the command line parameter to accept a number after
'fp' to specify the depth like '--call-graph fp,32'.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Waiman Long <longman@redhat.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20220615163222.1275500-7-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 3ae03f26
...@@ -275,6 +275,11 @@ OPTIONS ...@@ -275,6 +275,11 @@ OPTIONS
User can change the size by passing the size after comma like User can change the size by passing the size after comma like
"--call-graph dwarf,4096". "--call-graph dwarf,4096".
When "fp" recording is used, perf tries to save stack enties
up to the number specified in sysctl.kernel.perf_event_max_stack
by default. User can change the number by passing it after comma
like "--call-graph fp,32".
-q:: -q::
--quiet:: --quiet::
Don't print any message, useful for scripting. Don't print any message, useful for scripting.
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "callchain.h" #include "callchain.h"
#include "branch.h" #include "branch.h"
#include "symbol.h" #include "symbol.h"
#include "util.h"
#include "../perf.h" #include "../perf.h"
#define CALLCHAIN_PARAM_DEFAULT \ #define CALLCHAIN_PARAM_DEFAULT \
...@@ -266,12 +267,17 @@ int parse_callchain_record(const char *arg, struct callchain_param *param) ...@@ -266,12 +267,17 @@ int parse_callchain_record(const char *arg, struct callchain_param *param)
do { do {
/* Framepointer style */ /* Framepointer style */
if (!strncmp(name, "fp", sizeof("fp"))) { if (!strncmp(name, "fp", sizeof("fp"))) {
if (!strtok_r(NULL, ",", &saveptr)) { ret = 0;
param->record_mode = CALLCHAIN_FP; param->record_mode = CALLCHAIN_FP;
ret = 0;
} else tok = strtok_r(NULL, ",", &saveptr);
pr_err("callchain: No more arguments " if (tok) {
"needed for --call-graph fp\n"); unsigned long size;
size = strtoul(tok, &name, 0);
if (size < (unsigned) sysctl__max_stack())
param->max_stack = size;
}
break; break;
/* Dwarf style */ /* Dwarf style */
......
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