Skip to content

Investigate whether and when perf_event_open() is process-wide or thread-wide #7

Open
@nh2

Description

@nh2

From the man page:

       The pid and cpu arguments allow specifying which process and CPU to
       monitor:

       pid == 0 and cpu == -1
              This measures the calling process/thread on any CPU.

So what now, is it the calling process or thread? How do I control that?

Quite likely, if I run perf_event_open() from a forked pthread, it's going to count only for that pthread. But what if I run it from the process's (only) main thread, and afterwards create a new pthread? Does the perf FD then record the events only for the main thread, or the whole process?

That would be important to know, so that we don't accidentally give wrong numbers when running in the threaded runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions