diff options
author | Johan Lorensson <lateralusx.github@gmail.com> | 2021-05-12 12:21:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-12 12:21:01 +0300 |
commit | b4f4418d56d32c3a1677b5651899a112d7e02226 (patch) | |
tree | b6c7bbec40a277052d053f39a381b49ff294276c /src/coreclr | |
parent | 2e618ff905a619bc75138e26e2ef15ebd5bc19b6 (diff) |
Add streaming support for EventPipe env trace file. (#52443)
* Add streaming support for EventPipe env trace file.
Using EventPipeOutputPath and EventPipeConfig it is possible to setup
an EventPipe file session running during complete runtime execution.
There was however no logic that would flush this session, so if number
of events included in file exceeded max buffer all subsequent events
would be lost. Depeding on use case (like startup profiling) that could
be acceptable, unless rundown events where needed, since they would
likely be lost unless buffer size was way biffer than default limit (1MB).
Adding ability to run a streaming thread (similar to IPC) together with
file sessions would greatly increase usage of the default file session
and could then be real useful in cases where regular diagnostic
tooling won't work or increase the complexity of the profilig task.
In order to preserve old behavior, a new EventPipeSessionType has been
introduced, EP_SESSION_TYPE_FILESTREAM and that will work similar to
existing EP_SESSION_TYPE_FILE, but also start a streaming thread,
making sure buffer content is periodically flushed into file, reduce
risk of getting a flooded buffer manager triggering lost events.
For the default trace file, old behavior is kept and there is a new env
variable, COMPlus_EventPipeOutputStreaming that can be used to enable
using EP_SESSION_TYPE_FILESTREAM instead of EP_SESSION_TYPE_FILE for the
default file session.
Diffstat (limited to 'src/coreclr')
-rw-r--r-- | src/coreclr/inc/clrconfigvalues.h | 1 | ||||
-rw-r--r-- | src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index fec282fbe10..62a7665b9e1 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -708,6 +708,7 @@ RETAIL_CONFIG_STRING_INFO(INTERNAL_EventPipeConfig, W("EventPipeConfig"), "Confi RETAIL_CONFIG_DWORD_INFO(INTERNAL_EventPipeRundown, W("EventPipeRundown"), 1, "Enable/disable eventpipe rundown.") RETAIL_CONFIG_DWORD_INFO(INTERNAL_EventPipeCircularMB, W("EventPipeCircularMB"), 1024, "The EventPipe circular buffer size in megabytes.") RETAIL_CONFIG_DWORD_INFO(INTERNAL_EventPipeProcNumbers, W("EventPipeProcNumbers"), 0, "Enable/disable capturing processor numbers in EventPipe event headers") +RETAIL_CONFIG_DWORD_INFO(INTERNAL_EventPipeOutputStreaming, W("EventPipeOutputStreaming"), 0, "Enable/disable streaming for trace file set in COMPlus_EventPipeOutputPath. Non-zero values enable streaming.") // // Generational Aware Analysis diff --git a/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h b/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h index 22c6826d7be..da3ff470670 100644 --- a/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h +++ b/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h @@ -1601,6 +1601,15 @@ ep_rt_config_value_get_circular_mb (void) static inline bool +ep_rt_config_value_get_output_streaming (void) +{ + STATIC_CONTRACT_NOTHROW; + return CLRConfig::GetConfigValue (CLRConfig::INTERNAL_EventPipeOutputStreaming) != 0; +} + +static +inline +bool ep_rt_config_value_get_use_portable_thread_pool (void) { STATIC_CONTRACT_NOTHROW; |