Skip to content

Commit

Permalink
hooks to EP library from AOT
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshanF committed Jan 9, 2023
1 parent ac16e8e commit 418f8c3
Show file tree
Hide file tree
Showing 7 changed files with 704 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/coreclr/nativeaot/Runtime/AotDisabledEventPipeInterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

void EventPipeAdapter_Initialize() {}

bool DiagnosticServerAdapter_Initialize() { return false; }
void DiagnosticServerAdapter_PauseForDiagnosticsMonitor() {}

void EventPipeAdapter_FinishInitialize() {}

void EventPipeAdapter_Shutdown() {}
bool DiagnosticServerAdapter_Shutdown() { return false; }
17 changes: 17 additions & 0 deletions src/coreclr/nativeaot/Runtime/AotEnabledEventPipeInterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#include "eventpipeadapter.h"
#include "diagnosticserveradapter.h"


void EventPipeAdapter_Initialize() { EventPipeAdapter::Initialize(); }

bool DiagnosticServerAdapter_Initialize() { return DiagnosticServerAdapter::Initialize(); }
void DiagnosticServerAdapter_PauseForDiagnosticsMonitor() { DiagnosticServerAdapter::PauseForDiagnosticsMonitor();}


void EventPipeAdapter_FinishInitialize() { EventPipeAdapter::FinishInitialize(); }

void EventPipeAdapter_Shutdown() { EventPipeAdapter::Shutdown(); }
bool DiagnosticServerAdapter_Shutdown() { return DiagnosticServerAdapter::Shutdown(); }
19 changes: 19 additions & 0 deletions src/coreclr/nativeaot/Runtime/EventPipeInterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef __EVENTPIPE_INTERFACE_H__
#define __EVENTPIPE_INTERFACE_H__

// Initialize EventPipe
void EventPipeAdapter_Initialize();

// Initialize DS
bool DiagnosticServerAdapter_Initialize();
void DiagnosticServerAdapter_PauseForDiagnosticsMonitor();


void EventPipeAdapter_FinishInitialize();

void EventPipeAdapter_Shutdown();
bool DiagnosticServerAdapter_Shutdown();

#endif //__EVENTPIPE_INTERFACE_H__
42 changes: 42 additions & 0 deletions src/coreclr/nativeaot/Runtime/diagnosticserveradapter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#ifndef __DIAGNOSTIC_SERVER_ADAPTER_H__
#define __DIAGNOSTIC_SERVER_ADAPTER_H__

#if defined(FEATURE_PERFTRACING)

#include <eventpipe/ds-server.h>

class DiagnosticServerAdapter final
{
public:
static inline bool Initialize()
{
return ds_server_init();
}

static inline bool Shutdown()
{
return ds_server_shutdown();
}

NOINLINE static void PauseForDiagnosticsMonitor()
{
return ds_server_pause_for_diagnostics_monitor();
}

static void ResumeRuntimeStartup()
{
return ds_server_resume_runtime_startup();
}

static bool IsPausedInRuntimeStartup()
{
return ds_server_is_paused_in_startup();
}
};

#endif // FEATURE_PERFTRACING

#endif // __DIAGNOSTIC_SERVER_ADAPTER_H__
Loading

0 comments on commit 418f8c3

Please sign in to comment.