perf trace: Use a constant for the syscall formatting buffer

We were using it as a magic number, 1024, fix that.

Eventually we need to stop doing it per line, and do it per
arg, traversing the args at output time, to avoid the memmove()
calls that will be used in the next cset to replace pointers
present at raw_syscalls:sys_enter time with its contents that
appear at probe:vfs_getname time, before raw_syscalls:sys_exit
time.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Milian Wolff <mail@milianw.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-4sz3wid39egay1pp8qmbur4u@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 08c98776
...@@ -1262,6 +1262,8 @@ static struct thread_trace *thread__trace(struct thread *thread, FILE *fp) ...@@ -1262,6 +1262,8 @@ static struct thread_trace *thread__trace(struct thread *thread, FILE *fp)
#define TRACE_PFMAJ (1 << 0) #define TRACE_PFMAJ (1 << 0)
#define TRACE_PFMIN (1 << 1) #define TRACE_PFMIN (1 << 1)
static const size_t trace__entry_str_size = 2048;
struct trace { struct trace {
struct perf_tool tool; struct perf_tool tool;
struct { struct {
...@@ -1822,7 +1824,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, ...@@ -1822,7 +1824,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel,
args = perf_evsel__sc_tp_ptr(evsel, args, sample); args = perf_evsel__sc_tp_ptr(evsel, args, sample);
if (ttrace->entry_str == NULL) { if (ttrace->entry_str == NULL) {
ttrace->entry_str = malloc(1024); ttrace->entry_str = malloc(trace__entry_str_size);
if (!ttrace->entry_str) if (!ttrace->entry_str)
goto out_put; goto out_put;
} }
...@@ -1832,9 +1834,9 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, ...@@ -1832,9 +1834,9 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel,
ttrace->entry_time = sample->time; ttrace->entry_time = sample->time;
msg = ttrace->entry_str; msg = ttrace->entry_str;
printed += scnprintf(msg + printed, 1024 - printed, "%s(", sc->name); printed += scnprintf(msg + printed, trace__entry_str_size - printed, "%s(", sc->name);
printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed, printed += syscall__scnprintf_args(sc, msg + printed, trace__entry_str_size - printed,
args, trace, thread); args, trace, thread);
if (sc->is_exit) { if (sc->is_exit) {
......
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