lkml.org 
[lkml]   [2020]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1 2/8] perf evlist: implement control command handling functions
From
Date

On 02.04.2020 17:17, Jiri Olsa wrote:
> On Fri, Mar 27, 2020 at 11:46:43AM +0300, Alexey Budankov wrote:
>
> SNIP
>
>> +
>> +int perf_evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd)
>> +{
>> + int err = 0;
>> + int ctlfd_pos = evlist->ctl_fd_pos;
>> + struct pollfd *entries = evlist->core.pollfd.entries;
>> +
>> + if (!entries[ctlfd_pos].revents)
>> + return 0;
>> +
>> + if (entries[ctlfd_pos].revents & POLLIN) {
>> + err = perf_evlist__ctlfd_recv(evlist, cmd);
>> + if (err > 0) {
>> + switch (*cmd) {
>> + case CTL_CMD_RESUME:
>> + evlist__enable(evlist);
>> + break;
>> + case CTL_CMD_PAUSE:
>> + evlist__disable(evlist);
>> + break;
>
> would CTL_CMD_ENABLE, CTL_CMD_DISABLE be better fit in here?

Makes sense. Let's have it named like the corresponding ioctls, for clarity.

>
> especialy because we have the 'pause' ioctl for sampling,
> which I was thinking initialy you are using for record,
>
> and it's still might be better fit for sampling than disable, no?

PAUSE_OUTPUT ioctl doesn't stop NMIs but it should be avoided
in order not to affect workload execution during paused intervals.

PERF_EVENT_IOC_PAUSE_OUTPUT (since Linux 4.7)
This allows pausing and resuming the event's ring-buffer. A
paused ring-buffer does not prevent generation of samples, but
simply discards them. The discarded samples are considered
lost, and cause a PERF_RECORD_LOST sample to be generated when
possible. An overflow signal may still be triggered by the
discarded sample even though the ring-buffer remains empty.

The argument is an unsigned 32-bit integer. A nonzero value
pauses the ring-buffer, while a zero value resumes the ring-
buffer.

~Alexey

\
 
 \ /
  Last update: 2020-04-02 17:21    [W:0.036 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site