summaryrefslogtreecommitdiff
path: root/src/vm/eventpipe.h
AgeCommit message (Collapse)AuthorFilesLines
2019-06-24Make s_numberOfSessions Volatile as advertisement to other devs that the ↵José Rivero1-2/+2
data is being used across multiple threads and a portion of that usage is lock-free (#25366)
2019-06-24Multiple bug fixes (#25308)José Rivero1-4/+15
- Fixes EventPipe does not properly dispose of itself on an active session error #25228 - On EventPipeSession::ThreadProc, if an error occurs on the IPC streaming, then EventPipe::Disable will be invoked. - Fixes Prevent EventPipe Sessions IDs from being reused on disconnect #25229
2019-06-21Add EventPipe Processor Number support and make NetTrace the default … ↵Noah Falk1-0/+22
(#25276) * Add EventPipe Processor Number support and make NetTrace the default format The EventPipe header now has a Processor Number field. On windows we query the correct value, on other OSes we currently have a -1 placeholder, but the field is written to the format regardless. NetTrace is now the default format when using the environment variable, and the format must be explicitly configured when using the IPC channel or managed API. A parallel change in the diagnostics repo is changing dotnet-trace and dotnet-counter to specify nettrace format which means .NET devs should see nettrace almost exclusively from now on. If for whatever reason it is needed, NetPerf remains available if a scenario explicitly requests to use it. * PR feedback + attempting to fix broken tests
2019-06-14Moving non-EventPipe types out of eventpipe.* (#25161)José Rivero1-285/+5
* Replace runtime check with compile time assert. * Move EventPipeEventPayload to its own file. * Move `StackContents` to its own file. * Move other classes declaration/definition out of eventpipe.*
2019-06-13Multiple EventPipe related bugs/issues (#25112)José Rivero1-3/+1
* Taking the event pipe lock around s_tracingInitialized. https://github.com/dotnet/coreclr/pull/24896#discussion_r291790885 * Remove unused `EventPipe::s_fileSwitchTimerHandle` and `EventPipe::s_lastFlushTime` static variables. * Improve `EventPipe::Shutdown` thread-safety (This is not complete yet as shutting down configuration might cause an AV if WriteEvent happens during or after `EventPipe::Shutdown`). * Make sure we call `EventPipe::Shutdown` only once (the first time around). * Move two EventPipe methods to `private`
2019-06-10Add support for the NetTrace EventPipe file formatnoahfalk1-1/+4
Right now the new format is not on by default, but it can be enabled using COMPlus_EventPipeNetTraceFormat = 1 for testing purposes. The plan to have a follow up PR that will add shipping configuration mechanisms and change the default setting. See the documentation in the PerfView repo for more details about the format. At a glance the goal is to create a format that is more efficient to produce, has a smaller on disk size, and offers enhanced functionality in a few areas: a) 64 bit thread id support b) Detection of dropped events via sequence numbers c) Better support for extracting subsets of the file Together with the change there was also some refactoring of the EventPipeBufferManager and EventPipeThread. This change addresses (at least in part) the following issues: #19688, #23414, #24188, #20751, #20555, #21827, #24852, #25046
2019-06-09Fix `EventPipe::Disable` threading issues. (#24896)José Rivero1-11/+30
`EventPipe::WriteEvent*` does not use the `EventPipe::Crst` which created race conditions with other methods such as EventPipe::Disable.
2019-05-28Create the Concept of Multiple EventPipe Sessions (#24417)José Rivero1-29/+17
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
2019-05-01Pulling in Noah's fix in event_pipe_lock_fix branchSung Yoon Whang1-0/+6
2019-04-30Changing comments/names that refers to file switching to flushing insteadAndrew Au1-1/+1
2019-04-26Commits from #24229 - Fixes for IBC profile data on LinuxBrian Sullivan1-4/+0
Added public static function GetManagedCommandLine() and SaveManagedCommandLine() Moved GetManagedCommandLine and SaveManagedCommandLine to ceeload to link Disabled the setup for BBSweep on Linux as the PAL doesn’t support process named objects
2019-04-26Revert "Fix for IBC profile data on Linux - Build the full command line for ↵Brian Sullivan1-0/+4
FEATURE_PAL" This reverts commit 08422af33fa2026953c2e720cecf000ed4345a32.
2019-04-26Refactored the duplicated code into a template method patternAndrew Au1-1/+50
2019-04-25Fix for IBC profile data on Linux - Build the full command line for FEATURE_PALBrian Sullivan1-4/+0
Added public static function GetManagedCommandLine() andSaveManagedCommandLine() Add helper method Append_Next_Item Moved GetManagedCommandLine and SaveManagedCommandLine to ceeload to link crossgen Cleanup, codereview feedback
2019-04-25Postponing the managed callback so that they are called after the lock ↵Andrew Au1-2/+7
acquistion
2019-04-18If IPC connections fails, then remove active session. (#24082)José Rivero1-0/+2
2019-04-16[EventPipe] Minor bug fixes, and remove redundant/unused code. (#23956)José Rivero1-13/+9
- Update MicrosoftDiagnosticsTracingTraceEventPackageVersion - Delete connection if the request is unknown/unhandled - Adding missing error handling. - Provider names must be defined. - Some renaming, error handling, and build warnings. - Removing test code, and merge EventPipe::Enable functions. - Remove commented/non-used lines.
2019-04-08Remove the MultiFileSec option from EventPipe. (#23777)José Rivero1-20/+4
This option was a pseudo mechanism to fake "streaming" events out-of-proc. The idea was to have EventPipe creating files every N seconds, with event data up to that point. Thus, external processes could read these files in an attempt to get "read-time" data. Now, we actually have streaming of event through IPC channels, so this option is not needed.
2019-04-02[EventPipe] Streaming events out-of-proc using IPC (#23448)José Rivero1-18/+40
- There was a race condition on EventPipe::Disable where we deallocated the s_pSession and set it to NULL, but there was still a thread waiting to write and dereference the null pointer. Now, we check that the session is not null. - Added a new attach event to be handled to the Diagnostic server: Add streaming functionality (Syncronus) #23299 - On Linux, IPC was failing when delete was invoked because we were using new (std::nothrow) instead of new (nothrow) when allocating the newly connected clients/streams. I have replaced the call with new. This fixed #23580 - Move multiFileTraceLengthInSeconds out of the EventPipeSession. - Unlink previously existing socket. - EventPipeBlock: _ASSERTE was updated not to fail when data is not aligned if an error has already occurred. - Update _ASSERTE in fastserializer.cpp to take into account the the write operation could have failed.
2019-03-18[EventPipe] Adding an IPC server to handle out of process communication. ↵José Rivero1-219/+107
(#23106) This is the first commit to enable a "diagnostic port" using IPC (Named Pipe on Windows and Unix Domain Socket on other platforms). This change currently enable EventPipe to be enabled/disabled without the use of a file drop. - Split the DiagnosticsIpc into (DiagnosticsIpc/IpcStream) - DiagnosticsIpc (IPC listener) is meant to be used by the Diagnostic server. - IpcStream (IPC channel) is meant to be use to communicate with the connected client. - Change the FastSerializer dependency from `CFileStream` to `StreamWriter` This abstraction is meant decouple the writing of objects in order to extend its usability. The main objective is to reuse FastSerializer to stream data through the open IPC channel. - Moved the EventPipeSessionProvider* classes to their own file. - Added a more streamlined parsing achievable by defining a simpler binary protocol (by noahfalk). 1. Only one allocation is needed for the EventPipeProviderConfiguration array, no allocations or copies are needed for strings because we can refer to them directly out of the incoming command buffer 2. No change to the EventPipe API for enable is required. EventPipeProviderConfiguration retains its current behavior of not deleting the string pointers it holds. 3. No leaks happen because the command buffer owns the string memory and ensures that it stays alive for the duration of the Enable() call.
2019-03-09Two more instancesAndrew Au1-1/+0
2018-11-08EventPipe support for "Parameters" (#20796)José Rivero1-3/+34
These changes enable passing "arguments" to an EventSource.
2018-10-25Remove debug-only file writers. (#20612)Brian Robbins1-4/+0
2018-10-25Add EventPipe Config File Option MultiFileSec (#20548)Brian Robbins1-2/+25
2018-10-05Enable Config-File Based Control of EventPipe (#20238)Brian Robbins1-4/+0
2018-09-07Add Basic Out-of-Process EventPipe Control and Heap Snapshot Capture (#19720)Brian Robbins1-3/+0
2018-08-01Expose OSThreadId and TimeStamp on EventWrittenEventArgs (#19002)Brian Robbins1-5/+24
* Add EventWrittenEventArgs public properties OSThreadId and TimeStamp and plumb through OSThreadId. * Plumb ActivityId and RelatedActivityId to EventListener.
2018-07-02Dispatch Runtime Events to EventListener (#18649)Brian Robbins1-0/+22
2018-03-21Add More Process Information to EventPipe Traces (#17080)Brian Robbins1-6/+12
2018-01-29Add ActivityId Support to EventPipe (#16055)Brian Robbins1-0/+14
2018-01-25Create the concept of EventPipeSession and refactor EventPipe to use it. ↵Brian Robbins1-0/+9
Also expose COMPlus configuration variables to support session configuration and output file path. (#16018)
2018-01-02Retry: Enable EventPipe across Unix and Windows (#15611)Victor "Nate" Graf1-16/+18
* Revert "Revert "Enable EventPipe across Unix and Windows (#14772)" (#15609)" This reverts commit 302005ca8ae14eade37ddf4ac6e900617c1c166a. * Fix ARM build break * Use more explicit references to resolve build failures * Fix compat with python3 * Disable FeaturePerfTracing on Windows as it is not ready * Disable test for incomplete functionality * Fix test diabled patterns * Add license header * Use keyword types for managed code * Add message prefix * More precisly condition generation of eventing sources * Remove erroneously added changes
2017-12-21Revert "Enable EventPipe across Unix and Windows (#14772)" (#15609)Victor "Nate" Graf1-18/+16
This reverts commit 7524d72d4f0f634fe5407280b83c25181dc8c556.
2017-12-20Enable EventPipe across Unix and Windows (#14772)Victor "Nate" Graf1-16/+18
* [squashed] most work complete to enable EventPipe on Windows * Eventpipe now builds on Windows * Ensure evevntpipe is intialized on Windows * Resolve the location of python from build.cmd * Ensure eventing files are generated when needed * moving linkage declaration to cmake * create new event from constructor * enable FEATURE_EVENT_TRACE and FEATURE_PERF_TRACE everywhere * [WIP] checkpoint in fixing contarct errors * add another possible python location * Fix double delete bug in EventPipeConfiguration destructor * Fix typo in function name * Revert changes to .gitgnore * bump to netstandard1.6 in preperation for new version of TraceEvent * Revert changes to groovy files * revert changes to perf-prep scripts * add common.h and use nothrow * Fix issue which was causing double delete of configprovider * Add new test utilizing TraceEvent * Remove accidentally added local directory reference * Add comment to explain the addition of misc/tracepointprovider.cpp * Add back sys.exit(0) and refactor * Change conditional to be more direct * Better handle NULL config * Initialize m_deleteDefered * Eliminate obsolete field * Fix spelling error * Fix nits * Make smaple progiler timing functions easier to read * Move projects back to netstandard1.4 * Incomplete improvements to EventPipeTrace test * Add event integrity checks to test * Clean up some left over code * Add EventSource based test * Remove unused PAL tests on Windows * Fix Linux build breaks * Minor changes to CMake files * Remove //HACK for hack that was previously removed * Fix formatting and negate a #ifdef * Add conditional to ensure PERFTRACING is not enabled without EVENT_TRACE * Take lock on EventPipeProvider and EventPipeConfiguration destruction * Load winmm.dll at runtime * Change function name and compile conditions * Move typedef into #ifndef * Use the correct config in setup * Change lifecycle managment of EventPipeConfiguration's configuration provider * Enable EventPipe tests pri0 and disable broken tests * Replace python3 only error with python2 compatable one * Make common.csproj build pri0 * Change TraceEvent version to 2.0.2 to match published verison * Address cross build failure * Remove use of undefined variable * Add crossgen fix to .cmd * Use more specific types to avoid marshalling errors * Use Assert-style statements and remove one check * Fix cross arch build * Fix flipped branch * Bring build.cmd changes to build.sh * Fix cmake writing * Revert "Bring build.cmd changes to build.sh" This reverts commit 893c6492548d8bc9859ebba5b1b810aa630fac63. * remove stdlib.h * Fix out of order null check
2017-09-01Change identifier for EventProviders from GUID to string name (#13370)Victor "Nate" Graf1-2/+2
* [WIP] Changed event provider to user String identifiers * [WIP] Remove GUID from generated code * [WIP] Many small fixes * [WIP] Fix error in constructing GUID * Pass EventSource to abstract away GUID/Name references * Fix various small errors * Delay construction of SString objects * Change GUIDs to names * Change hardcoded GUID strings to names * Revert testing changes * Remove extra line * Use the EventSource name * Use provider full names * Use full-names for Rundown * Bump version number for eventpipe file * Address review comments
2017-08-24Remove unnecessary buffer copy from EventPipe::WriteEvent pipeline (#13347)Victor "Nate" Graf1-1/+80
* [WIP] Eliminate extra buffer copy with new api path * Copy blobs to a flat buffer is Rundown is on * Refactor to use payload class and dedupe code * Add contracts * Fix many small errors * Make names unambiguous * Add EventPipe::WriteEventBlob to ecalllist.h * Address code review * Add test and fix a buffer copy bug * Copy data instead of data pointer * Add optional output file arg to tests * Change failure return code * Renamed variables for clarity
2017-05-26Fix compile with disabled FEATURE_READYTORUN option (#11875)Petr Bred1-1/+1
- just remove FEATURE_READYTORUN definitions in clrdefinitions.cmake to turn off option Signed-off-by: Petr Bred <bredpetr@gmail.com>
2017-05-25Implement Activity ID / Related Activity ID for EventSources Writing to ↵Brian Robbins1-2/+3
EventPipe (#11904) * Implement thread-local storage of activity ids. * Plumb the activity id and related activity id into the trace file.
2017-05-24Indicate if thread time events are in managed or native code. (#11892)Brian Robbins1-1/+1
2017-05-16Allow provider deletion to be deferred until after tracing is stopped. (#11651)Brian Robbins1-0/+7
2017-05-15Write EventSource events with metadata to EventPipe (#11577)Xiangyang (Mark) Guo1-3/+5
* Fix EventPipe initialization. * rebase code with master, add prototype of event source metadata * fix define event * add null ptr checking * move WriteEvent metadata serialization to managed side * Fix enabled keywords for COMPlus_PerformanceTracing=1. * put parameter name into metadata, use WriteToBuffer * Write event metadata to the file. * allocate buffer in EventPipeEvent ctor * prevent double free * refactor code * AddEvent params reorder
2017-05-15Allow coniguration of sampling rate. (#11595)Brian Robbins1-0/+1
2017-05-12Enable Symbolic Rundown for EventPipe (#11582)Brian Robbins1-4/+34
2017-05-12EventPipe Circular Buffer Support and Ability to Start/Stop Tracing (#11507)Brian Robbins1-2/+69
2017-05-10Re-Factor EventSource to Support Writing to EventPipe (#11435)Brian Robbins1-0/+27
Re-Factor EventSource to Support Writing to EventPipe.
2017-05-06Log Events to EventPipe on Linux (#11433)Brian Robbins1-20/+45
* Implement the EventPipe object model for providers and events. * Plumb Runtime Events into EventPipe (#11145) Plumb runtime ETW events into the EventPipe. * Fix bug where all events except for SampleProfiler events were never enabled. * Plumb EventPipeEventInstance through the EventPipe. * Implement EventPipeFile and FastSerializer. * Write event contents to the EventPipeFile. * Only build EventPipe on Linux. * Conditionally add a sentinel value marking event end. * Send SampleProfiler events to the EventPipeFile. * Fix provider ID printing to JSON file. * Write the start date/time, timestamp, and clock frequency into the trace file. * Support unloading of EventPipeProviders. * Handle failure cases when we can't walk the stack or are shutting down. * Fix a bug where we pass a null src pointer to memcpy.
2017-04-03Basic EventPipe functionality that supports writing sample profile events to ↵Brian Robbins1-0/+154
JSON. SampleProfiler that globally suspends the runtime every 1ms to walk stacks and write them to the EventPipe.