Skip to content

Async perf paths do not wake up for in-process or mock-only data sources #283

Description

@utpilla

Follow up to #279 (comment)

PR #279 added PerfSession::perf_fds() so consumers can drive parsing from kernel fd readiness (for example epoll(2) or tokio::io::unix::AsyncFd).

For sources that do not own per-CPU perf fds (MockData and InProcessRingBuf), perf_fds() returns an empty list. A consumer wired purely to fd readiness will therefore never wake up on such sources.

The current contract is that the consumer picks the source and knows whether the fd-driven async pattern applies. Sources without fds are expected to be driven by PerfSession::parse_all, parse_for_duration, or parse_until, as they are today.

Possible future directions if a real use case appears:

  • Give InProcessRingBuf a std::task::Waker slot (for example Arc<Mutex<Option<Waker>>> shared with the writer). The reader stashes its waker on Poll::Pending, and InProcessRingBufWriter::write calls wake() after publishing. This is std-only, works on any async runtime, and avoids a kernel-side wakeup object.
  • Alternatively, add an eventfd (or similar) so perf_fds() can return a real fd for in-process sources.
  • Add a timeout boundary to the async drain paths so they fall back to a periodic drain when no fds are present.

MockData is a test fixture, so the sync drain methods (parse_all, etc.) are likely the right answer there regardless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions