Skip to content

Commit acce022

Browse files
Alexey Budankovacmel
authored andcommitted
perf record: Implement control commands handling
Implement handling of 'enable' and 'disable' control commands coming from control file descriptor. Signed-off-by: Alexey Budankov <[email protected]> Acked-by: Jiri Olsa <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 68cd3b4 commit acce022

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tools/perf/builtin-record.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,6 +1564,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
15641564
bool disabled = false, draining = false;
15651565
int fd;
15661566
float ratio = 0;
1567+
enum evlist_ctl_cmd cmd = EVLIST_CTL_CMD_UNSUPPORTED;
15671568

15681569
atexit(record__sig_exit);
15691570
signal(SIGCHLD, sig_handler);
@@ -1883,6 +1884,21 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
18831884
draining = true;
18841885
}
18851886

1887+
if (evlist__ctlfd_process(rec->evlist, &cmd) > 0) {
1888+
switch (cmd) {
1889+
case EVLIST_CTL_CMD_ENABLE:
1890+
pr_info(EVLIST_ENABLED_MSG);
1891+
break;
1892+
case EVLIST_CTL_CMD_DISABLE:
1893+
pr_info(EVLIST_DISABLED_MSG);
1894+
break;
1895+
case EVLIST_CTL_CMD_ACK:
1896+
case EVLIST_CTL_CMD_UNSUPPORTED:
1897+
default:
1898+
break;
1899+
}
1900+
}
1901+
18861902
/*
18871903
* When perf is starting the traced process, at the end events
18881904
* die with the process and we wait for that. Thus no need to

0 commit comments

Comments
 (0)