sysprofd: add sample_id_all field to options

We need this to get the time field from mmap/comm events.
This commit is contained in:
Christian Hergert
2016-04-15 04:43:37 -07:00
parent d7ed2ddf30
commit 3e1bc8eb4a

View File

@ -80,6 +80,7 @@ sysprofd_perf_event_open (sd_bus_message *msg,
int exclude_idle = 0;
int fd = -1;
int use_clockid = 0;
int sample_id_all = 0;
int r;
assert (msg);
@ -119,6 +120,12 @@ sysprofd_perf_event_open (sd_bus_message *msg,
if (r < 0)
GOTO (cleanup);
}
else if (strcmp (name, "sample_id_all") == 0)
{
r = sd_bus_message_read (msg, "b", &sample_id_all);
if (r < 0)
GOTO (cleanup);
}
else if (strcmp (name, "clockid") == 0)
{
r = sd_bus_message_read (msg, "i", &clockid);
@ -224,20 +231,22 @@ sysprofd_perf_event_open (sd_bus_message *msg,
if (!use_clockid || clockid < 0)
clockid = CLOCK_MONOTONIC_RAW;
attr.clockid = clockid;
attr.comm = !!comm;
attr.config = config;
attr.disabled = disabled;
attr.exclude_idle = !!exclude_idle;
attr.mmap = !!mmap_;
attr.sample_id_all = sample_id_all;
attr.sample_period = sample_period;
attr.sample_type = sample_type;
attr.size = sizeof attr;
attr.task = !!task;
attr.type = type;
attr.clockid = clockid;
attr.use_clockid = use_clockid;
attr.wakeup_events = wakeup_events;
attr.size = sizeof attr;
fd = _perf_event_open (&attr, pid, cpu, -1, 0);
if (fd < 0)
{