Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Create the Concept of Multiple EventPipe Sessions (#24417)
Browse files Browse the repository at this point in the history
This is the initial work to enable https://github.com/dotnet/coreclr/issues/15377

## What's here?

- A lot of code move/split. Some important moves:
  - `EventPipe` has a colection of `EventPipeSessions` instead of a single session.
  - `EventPipeSession` now owns a `EventPipeBufferManager` and a `EventPipeFile`
  - `EventPipeThread` now owns a collection of { EventPipeBufferManager, EventPipeBuffer }, and a collection of { EventPipeBufferManager, EventPipeBufferList }
  - There is a cap on the max number of `EventPipeSession` (64 sessions)
  - `EventPipeProvider` and `EventPipeEvent` use a 64-bit mask to keep track of the sessions that are listening to provider/events.

## What's pending?

https://github.com/dotnet/coreclr/issues/24753
  • Loading branch information
jorive committed May 29, 2019
1 parent c614a00 commit 19edba3
Show file tree
Hide file tree
Showing 31 changed files with 1,484 additions and 1,081 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ internal EventPipeProviderConfiguration[] Providers
get { return m_providers.ToArray(); }
}

internal long ProfilerSamplingRateInNanoseconds
{
// 100 nanoseconds == 1 tick.
get { return m_minTimeBetweenSamples.Ticks * 100; }
}

internal void EnableProvider(string providerName, ulong keywords, uint loggingLevel)
{
EnableProviderWithFilter(providerName, keywords, loggingLevel, null);
Expand Down Expand Up @@ -183,7 +177,6 @@ internal static void Enable(EventPipeConfiguration configuration)
s_sessionID = EventPipeInternal.Enable(
configuration.OutputFile,
configuration.CircularBufferSizeInMB,
(ulong)configuration.ProfilerSamplingRateInNanoseconds,
providers,
(uint)providers.Length);
}
Expand All @@ -203,7 +196,6 @@ internal static class EventPipeInternal
internal static extern UInt64 Enable(
string? outputFile,
uint circularBufferSizeInMB,
ulong profilerSamplingRateInNanoseconds,
EventPipeProviderConfiguration[] providers,
uint numProviders);

Expand Down Expand Up @@ -242,7 +234,7 @@ internal static class EventPipeInternal
internal static extern unsafe bool GetSessionInfo(UInt64 sessionID, EventPipeSessionInfo* pSessionInfo);

[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
internal static extern unsafe bool GetNextEvent(EventPipeEventInstanceData* pInstance);
internal static extern unsafe bool GetNextEvent(UInt64 sessionID, EventPipeEventInstanceData* pInstance);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void CommitDispatchConfiguration()
new EventPipeProviderConfiguration(NativeRuntimeEventSource.EventSourceName, (ulong) aggregatedKeywords, (uint) highestLevel, null)
};

m_sessionID = EventPipeInternal.Enable(null, 1024, 1, providerConfiguration, 1);
m_sessionID = EventPipeInternal.Enable(null, 1024, providerConfiguration, 1);
Debug.Assert(m_sessionID != 0);

// Get the session information that is required to properly dispatch events.
Expand Down Expand Up @@ -162,7 +162,7 @@ private unsafe void DispatchEventsToEventListeners()
while (!m_stopDispatchTask)
{
// Get the next event.
while (!m_stopDispatchTask && EventPipeInternal.GetNextEvent(&instanceData))
while (!m_stopDispatchTask && EventPipeInternal.GetNextEvent(m_sessionID, &instanceData))
{
// Filter based on provider.
if (instanceData.ProviderID == m_RuntimeProviderID)
Expand Down
3 changes: 0 additions & 3 deletions src/vm/diagnosticserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

#ifdef FEATURE_PERFTRACING // This macro should change to something more generic than performance.

#include <stdint.h>
#include "diagnosticsipc.h"

//! TODO: Temp class.
enum class DiagnosticMessageType : uint32_t
{
///////////////////////////////////////////////////////////////////////////
Expand All @@ -28,7 +26,6 @@ enum class DiagnosticMessageType : uint32_t
AttachProfiler = 2048,
};

//! TODO: Temp class.
struct MessageHeader
{
DiagnosticMessageType RequestType;
Expand Down

0 comments on commit 19edba3

Please sign in to comment.