microsoft / microsoft/perfview

Add a public API to read call stacks in EventPipeEventSource

Open
#2,084 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
4.7k
Forks
775
Avg merge
5d 11h
Merged PRs (30d)
9

Description

EventPipeEventSource writes call stacks into the trace event eventRecord internal field (here).

There is no public API to read the call stacks from the eventRecord, so call stacks are not accessible, particularly when using the "push" model with EventPipeEventSource. The only public way the read call stacks is to use TraceLog, which reads the eventRecord (here).

Would it be possible to add a public API to read the call stacks from the events generated by EventPipeEventSource?

API example:

public class EventPipeStack
{
    public EventPipeStack(ulong[] addresses);

    public int Length { get; }

    public ulong this[int index] { get; }
}

public class EventPipeEventSource
{
    // Reads call stack from `eventRecord`
    public static bool TryGetStack(TraceEvent traceEvent, out EventPipeStack stack);
}

Of course, there are many design options for the API. I simply thought that adding TryGetStack in EventPipeEventSource next to GetEventRecordForEventData would make sense.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review EventPipeEventSource.cs around the eventRecord handling and the GetEventRecordForEventData area, then compare how TraceLog.cs reads call stacks. Determine a public API shape that works for EventPipeEventSource push-model events; done means callers can reliably retrieve the call-stack addresses from the generated TraceEvent.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.