summaryrefslogtreecommitdiff
path: root/src/vm/eventpipeprotocolhelper.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-07-02Add RundownRequested switch to EventPipe IPC protocol (#25495)Sung Yoon Whang1-1/+80
* Add RundownRequested switch to EventPipe IPC protocol * Fix linux build * make the rundownRequested field a bool * some renaming * Make a new command that has an option for disabling rundown instead of breaking change * code review feedback
2019-06-25Remove outputPath parameter for EventPipe IPC protocol (#25363)John Salem1-1/+0
2019-06-21Add EventPipe Processor Number support and make NetTrace the default … ↵Noah Falk1-9/+8
(#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-10Add support for the NetTrace EventPipe file formatnoahfalk1-0/+9
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-05-28Create the Concept of Multiple EventPipe Sessions (#24417)José Rivero1-1/+0
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-23Diagnostics IPC (#24582)John Salem1-59/+89
* Initial draft of structs and classes for Diagnostic Server IPC Protocol * Fix some syntax/name issues that weren't getting caught by intellisense in vscode for mac * * Add member checkers for Flatten and GetSize * Split Flatten impl to have a default version for simple, fixed-size structs * * Remove unnecessary abstract class * Add documentation about templates * * Change templating for IpcMessage class to be more limited (only on message creation and payload parsing) * flesh out parse and tryparse * add requirement for non-fixed-size payloads to implement a static TryParse(buffer, bufferlen) * refactor namespace to bottom of file * * moved DiagnosticsIpc namespace into diagnosticprotocol.h to avoid being referenced by debug-pal project * converted diagnostic server to use DiagnosticsIpc code * converted EventPipeProtocolHelper to use DiagnosticsIpc code * made EventPipe end to end use DiagnosticsIpc code * * Add ASSERTs where relevant * Refactor stream ownershpi back to previous way for collect tracing response * * Add contracts where applicable * * Updating GenerateCoreDump code to use new IPC work after rebase * * modify contract in DiagnosticProtocolHelper to be more restrictive * remove comments * Add comment documentation of SFINAE pattern above usage * simplify Has* checks * Fix function resolution for static member check * Add Constructor for rvalue references to IpcMessage * avoid code path that would result in a blocking read on 0 bytes * Fix silly strcmp bug * fix contractin EventPipeProtocolHelper * * Modify header declaration to make static initialization easier * fix type in template code * * Make all messages use Initialize instead of constructor for hydrating themselves, to make error paths easier * * Expand and streamline error model to match spec * Simplify writing error messages to a static function * memory management * *modify function signatures for SFINAE to remove clang warning * * add braces to static initialization to remove clang warnings * * modify IpcMessage::TryParseImpl, to reset the internal data pointer when passing back a reinterpret_cast to prevent double frees on destruction * Add notes on requirement that user free the memory for a payload * * fix bug in TryParse for generateCoreDump * change INT to uint32_t in GenerateCoreDump payloads * Remove unused error code * * rename Miscellaneous command set to Diagnostic * Remove unnecessary command ids in EventPipe * Rename Diagnostic command set to Dump * * Move payload into Holder to simplify cleanup * Add buffer holder to payloads to ensure the buffers are being cleaned up after use * updated Profiler attach to use IPC work after rebase * * Fix typos * Fix placement of ifdefs for profiler helpers * * Fix accidental char hidden in ifdef... * * Add ASSERT to signify we shouldn't be re-using IpcMessages * * fix another typo hidden behind inactive ifdef... * * Change errors to use HRESULTS to increase transparency * fix bug in profiler attach for checking if entire client data is in buffer
2019-04-20Tighten asserts (#24124)Andrew Au1-2/+2
2019-04-16[EventPipe] Minor bug fixes, and remove redundant/unused code. (#23956)José Rivero1-91/+44
- 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-12/+7
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-8/+81
- 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-0/+156
(#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.