diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2017-06-13 18:47:36 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2017-06-13 18:47:36 +0900 |
commit | 61d6a817e39d3bae0f47dbc09838d51db22a5d30 (patch) | |
tree | cb37caa1784bc738b976273335d6ed04a7cc80b0 /src/vm/sampleprofiler.h | |
parent | 5b975f8233e8c8d17b215372f89ca713b45d6a0b (diff) | |
download | coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.tar.gz coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.tar.bz2 coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.zip |
Imported Upstream version 2.0.0.11992upstream/2.0.0.11992
Diffstat (limited to 'src/vm/sampleprofiler.h')
-rw-r--r-- | src/vm/sampleprofiler.h | 35 |
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__ |