summaryrefslogtreecommitdiff
path: root/src/vm/sampleprofiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/sampleprofiler.h')
-rw-r--r--src/vm/sampleprofiler.h35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/vm/sampleprofiler.h b/src/vm/sampleprofiler.h
index 2c7466f4c9..02eb6b39cd 100644
--- a/src/vm/sampleprofiler.h
+++ b/src/vm/sampleprofiler.h
@@ -5,11 +5,25 @@
#ifndef __SAMPLEPROFILER_H__
#define __SAMPLEPROFILER_H__
+#ifdef FEATURE_PERFTRACING
+
#include "common.h"
#include "eventpipe.h"
+enum class SampleProfilerSampleType
+{
+ Error = 0,
+ External = 1,
+ Managed = 2
+};
+
class SampleProfiler
{
+
+ // Declare friends.
+ friend class EventPipe;
+ friend class SampleProfilerEventInstance;
+
public:
// Enable profiling.
@@ -18,13 +32,16 @@ class SampleProfiler
// Disable profiling.
static void Disable();
+ // Set the sampling rate.
+ static void SetSamplingRate(long nanoseconds);
+
private:
// Iterate through all managed threads and walk all stacks.
static void WalkManagedThreads();
// Profiling thread proc. Invoked on a new thread when profiling is enabled.
- static DWORD WINAPI SampleProfiler::ThreadProc(void *args);
+ static DWORD WINAPI ThreadProc(void *args);
// True when profiling is enabled.
static Volatile<BOOL> s_profilingEnabled;
@@ -32,13 +49,25 @@ class SampleProfiler
// The sampling thread.
static Thread *s_pSamplingThread;
+ // The provider and event emitted by the profiler.
+ static const GUID s_providerID;
+ static EventPipeProvider *s_pEventPipeProvider;
+ static EventPipeEvent *s_pThreadTimeEvent;
+
+ // Event payloads.
+ // External represents a sample in external or native code.
+ // Managed represents a sample in managed code.
+ static BYTE *s_pPayloadExternal;
+ static BYTE *s_pPayloadManaged;
+ static const unsigned int c_payloadSize = sizeof(unsigned int);
+
// Thread shutdown event for synchronization between Disable() and the sampling thread.
static CLREventStatic s_threadShutdownEvent;
-#ifdef FEATURE_PAL
// The sampling rate.
static long s_samplingRateInNs;
-#endif
};
+#endif // FEATURE_PERFTRACING
+
#endif // __SAMPLEPROFILER_H__