Skip to content

Commit 8bf382c

Browse files
committed
perf trace: Move flock op beautifier to tools/perf/trace/beauty/
To reduce the size of builtin-trace.c. Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/n/tip-c4c47w2a2jx13terl2p2hros@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent f9be7ee commit 8bf382c

2 files changed

Lines changed: 32 additions & 31 deletions

File tree

tools/perf/builtin-trace.c

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -369,37 +369,6 @@ static size_t syscall_arg__scnprintf_int(char *bf, size_t size,
369369

370370
#define SCA_INT syscall_arg__scnprintf_int
371371

372-
static size_t syscall_arg__scnprintf_flock(char *bf, size_t size,
373-
struct syscall_arg *arg)
374-
{
375-
int printed = 0, op = arg->val;
376-
377-
if (op == 0)
378-
return scnprintf(bf, size, "NONE");
379-
#define P_CMD(cmd) \
380-
if ((op & LOCK_##cmd) == LOCK_##cmd) { \
381-
printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #cmd); \
382-
op &= ~LOCK_##cmd; \
383-
}
384-
385-
P_CMD(SH);
386-
P_CMD(EX);
387-
P_CMD(NB);
388-
P_CMD(UN);
389-
P_CMD(MAND);
390-
P_CMD(RW);
391-
P_CMD(READ);
392-
P_CMD(WRITE);
393-
#undef P_OP
394-
395-
if (op)
396-
printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", op);
397-
398-
return printed;
399-
}
400-
401-
#define SCA_FLOCK syscall_arg__scnprintf_flock
402-
403372
static const char *bpf_cmd[] = {
404373
"MAP_CREATE", "MAP_LOOKUP_ELEM", "MAP_UPDATE_ELEM", "MAP_DELETE_ELEM",
405374
"MAP_GET_NEXT_KEY", "PROG_LOAD",
@@ -634,6 +603,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size,
634603
.arg_parm = { [arg] = &strarray__##array, }
635604

636605
#include "trace/beauty/eventfd.c"
606+
#include "trace/beauty/flock.c"
637607
#include "trace/beauty/futex_op.c"
638608
#include "trace/beauty/mmap.c"
639609
#include "trace/beauty/mode_t.c"

tools/perf/trace/beauty/flock.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
static size_t syscall_arg__scnprintf_flock(char *bf, size_t size,
3+
struct syscall_arg *arg)
4+
{
5+
int printed = 0, op = arg->val;
6+
7+
if (op == 0)
8+
return scnprintf(bf, size, "NONE");
9+
#define P_CMD(cmd) \
10+
if ((op & LOCK_##cmd) == LOCK_##cmd) { \
11+
printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #cmd); \
12+
op &= ~LOCK_##cmd; \
13+
}
14+
15+
P_CMD(SH);
16+
P_CMD(EX);
17+
P_CMD(NB);
18+
P_CMD(UN);
19+
P_CMD(MAND);
20+
P_CMD(RW);
21+
P_CMD(READ);
22+
P_CMD(WRITE);
23+
#undef P_OP
24+
25+
if (op)
26+
printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", op);
27+
28+
return printed;
29+
}
30+
31+
#define SCA_FLOCK syscall_arg__scnprintf_flock

0 commit comments

Comments
 (0)