[EventPipe] Adding an IPC server to handle out of process communication. (#23106)
authorJosé Rivero <jorive@microsoft.com>
Mon, 18 Mar 2019 17:23:30 +0000 (10:23 -0700)
committerGitHub <noreply@github.com>
Mon, 18 Mar 2019 17:23:30 +0000 (10:23 -0700)
commit4497df34cbe3d8bf7a21828714a3cf764da16e98
tree894fc03e621e498cf6b5b33a34fdbb3c63c7d10a
parentb88f2f635b02c130ae00b4d8aee3e766a60698d5
[EventPipe] Adding an IPC server to handle out of process communication. (#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.
33 files changed:
src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipe.cs
src/debug/debug-pal/CMakeLists.txt
src/debug/debug-pal/unix/diagnosticsipc.cpp [new file with mode: 0644]
src/debug/debug-pal/win/diagnosticsipc.cpp [new file with mode: 0644]
src/debug/inc/diagnosticsipc.h [new file with mode: 0644]
src/inc/stresslog.h
src/pal/inc/pal.h
src/pal/src/thread/process.cpp
src/vm/CMakeLists.txt
src/vm/ceemain.cpp
src/vm/common.h
src/vm/diagnosticserver.cpp [new file with mode: 0644]
src/vm/diagnosticserver.h [new file with mode: 0644]
src/vm/diagnosticsprotocol.h [new file with mode: 0644]
src/vm/eventpipe.cpp
src/vm/eventpipe.h
src/vm/eventpipeconfiguration.cpp
src/vm/eventpipeconfiguration.h
src/vm/eventpipeeventinstance.h
src/vm/eventpipeeventsource.cpp
src/vm/eventpipefile.cpp
src/vm/eventpipeinternal.cpp [new file with mode: 0644]
src/vm/eventpipeinternal.h [new file with mode: 0644]
src/vm/eventpipeprotocolhelper.cpp [new file with mode: 0644]
src/vm/eventpipeprotocolhelper.h [new file with mode: 0644]
src/vm/eventpipeprovider.h
src/vm/eventpipesession.cpp
src/vm/eventpipesession.h
src/vm/eventpipesessionprovider.cpp [new file with mode: 0644]
src/vm/eventpipesessionprovider.h [new file with mode: 0644]
src/vm/fastserializer.cpp
src/vm/fastserializer.h
src/vm/mscorlib.cpp