Commit 6fbe4f48 authored by Alexey Bayduraev's avatar Alexey Bayduraev Committed by Arnaldo Carvalho de Melo

perf record: Introduce function to propagate control commands

Introduce evlist__ctlfd_update() function to propagate external control
commands to global evlist object.
Reviewed-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
Signed-off-by: default avatarAlexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
Tested-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarNamhyung Kim <namhyung@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Budankov <abudankov@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/7df52c9816b13c74897b9e518128b29a391462fe.1642440724.git.alexey.v.bayduraev@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 415ccb58
......@@ -2139,6 +2139,22 @@ int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd)
return err;
}
int evlist__ctlfd_update(struct evlist *evlist, struct pollfd *update)
{
int ctlfd_pos = evlist->ctl_fd.pos;
struct pollfd *entries = evlist->core.pollfd.entries;
if (!evlist__ctlfd_initialized(evlist))
return 0;
if (entries[ctlfd_pos].fd != update->fd ||
entries[ctlfd_pos].events != update->events)
return -1;
entries[ctlfd_pos].revents = update->revents;
return 0;
}
struct evsel *evlist__find_evsel(struct evlist *evlist, int idx)
{
struct evsel *evsel;
......
......@@ -410,6 +410,7 @@ void evlist__close_control(int ctl_fd, int ctl_fd_ack, bool *ctl_fd_close);
int evlist__initialize_ctlfd(struct evlist *evlist, int ctl_fd, int ctl_fd_ack);
int evlist__finalize_ctlfd(struct evlist *evlist);
bool evlist__ctlfd_initialized(struct evlist *evlist);
int evlist__ctlfd_update(struct evlist *evlist, struct pollfd *update);
int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd);
int evlist__ctlfd_ack(struct evlist *evlist);
......
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