lkml.org 
[lkml]   [2013]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 12/12] [RFC] perf, persistent: ioctl functions to control persistency
> > On Thu, 22 Aug 2013, Robert Richter wrote:
> > > This is for Linux man-pages:

Updated description below.

-Robert



Author: Robert Richter <robert.richter@linaro.org>
Date: Tue Aug 13 11:22:22 2013 +0200

[RFC] perf, persistent: ioctl functions to control persistency

Implementing ioctl functions to control persistent events. There are
functions to detach or attach an event to or from a process. The
PERF_EVENT_IOC_DETACH ioctl call makes an event persistent. After
closing the event's fd it runs then in the background of the system
without the need of a controlling process. The perf_event_open()
syscall can be used to reopen the event by any process. The
PERF_EVENT_IOC_ATTACH ioctl attaches the event again so that it is
removed after closing the event's fd.

This is for Linux man-pages:

type ...

PERF_TYPE_PERSISTENT (Since Linux 3.xx)

Open a persistent event that is already running in the
background of the system. There is a unique identifier for
each persistent event that needs to be specified in the
event's attribute config field. Persistent events are
listed under:

/sys/bus/event_source/devices/persistent/

See PERF_EVENT_IOC_DETACH how to create a persistent
event. The instance creating such an event should also be
responsible for removing it.

...
persistent : 41, /* always-on event */
...

persistent: (Since Linux 3.xx)

Put event into persistent state after opening. After closing
the event's fd the event is persistent in the system and
continues to run.

perf_event ioctl calls

PERF_EVENT_IOC_DETACH (Since Linux 3.xx)

Any event that was opened with the perf_event_open()
syscall may become a persistent event. This is done by
detaching the event from the controlling process that
holds the event's file descriptor. This ioctl can be used
for doing this. After detaching it, the event is
persistent in the system. An unique identifier for the
persistent event is returned or an error otherwise. After
closing the fd the event will continue to run. The
following allows to connect to the event again:

pe.type = PERF_TYPE_PERSISTENT;
pe.config = <pevent_id>;
...
fd = perf_event_open(...);

The event must be reopened on the same cpu.

PERF_EVENT_IOC_ATTACH (Since Linux 3.xx)

Attach the event specified by the file descriptor to the
current process. The event is no longer persistent in the
system and will be removed after all users disconnected
from the event. Thus, if there are no other users the
event will be closed too after closing its file
descriptor, the event then no longer exists.

Cc: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Robert Richter <robert.richter@linaro.org>
Signed-off-by: Robert Richter <rric@kernel.org>


\
 
 \ /
  Last update: 2013-08-27 15:01    [W:0.102 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site