Skip to content

Commit 722afa6

Browse files
committed
[IPC Protocol] Extend EventPipe command to configure a user_events eventpipe session
1 parent cd575ae commit 722afa6

File tree

1 file changed

+105
-1
lines changed

1 file changed

+105
-1
lines changed

documentation/design-docs/ipc-protocol.md

+105-1
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ enum class EventPipeCommandId : uint8_t
351351
CollectTracing2 = 0x03, // create/start a given session with/without rundown
352352
CollectTracing3 = 0x04, // create/start a given session with/without collecting stacks
353353
CollectTracing4 = 0x05, // create/start a given session with specific rundown keyword
354+
CollectTracing5 = 0x06, // create/start a given session with/without user_events
354355
}
355356
```
356357
See: [EventPipe Commands](#EventPipe-Commands)
@@ -406,6 +407,7 @@ enum class EventPipeCommandId : uint8_t
406407
CollectTracing2 = 0x03, // create/start a given session with/without rundown
407408
CollectTracing3 = 0x04, // create/start a given session with/without collecting stacks
408409
CollectTracing4 = 0x05, // create/start a given session with specific rundown keyword
410+
CollectTracing5 = 0x06, // create/start a given session with/without user_events
409411
}
410412
```
411413
EventPipe Payloads are encoded with the following rules:
@@ -608,7 +610,7 @@ Followed by an Optional Continuation of a `nettrace` format stream of events.
608610

609611
Command Code: `0x0205`
610612

611-
The `CollectTracing4` command is an extension of the `CollectTracing3` command - its behavior is the same as `CollectTracing3` command, except the requestRundown field is replaced by the rundownKeyword field to allow customizing the set of rundown events to be fired.
613+
The `CollectTracing4` command is an extension of the `CollectTracing3` command - its behavior is the same as `CollectTracing3` command, except the requestRundown field is replaced by the rundownKeyword field to allow customizing the set of rundown events to be fired.
612614

613615
A rundown keyword of `0x80020139` has the equivalent behavior as `CollectTracing3` with `requestRundown=true` and rundown keyword of `0` has the equivalent behavior as `requestRundown=false`.
614616

@@ -622,6 +624,7 @@ Header: `{ Magic; Size; 0x0205; 0x0000 }`
622624
* `uint circularBufferMB`: The size of the circular buffer used for buffering event data while streaming
623625
* `uint format`: 0 for the legacy NetPerf format and 1 for the NetTrace format
624626
* `ulong rundownKeyword`: Indicates the keyword for the rundown provider
627+
* `bool requestStackwalk`: Indicates whether stacktrace information should be recorded.
625628
* `array<provider_config> providers`: The providers to turn on for the streaming session
626629

627630
A `provider_config` is composed of the following data:
@@ -669,6 +672,107 @@ Payload
669672
```
670673
Followed by an Optional Continuation of a `nettrace` format stream of events.
671674

675+
### `CollectTracing5`
676+
677+
Command Code: `0x0206`
678+
679+
The `CollectTracing5` command is an extension of the `CollectTracing4` command. Its behavior is similar to `CollectTracing4`, but it introduces a new field to enable particular runtime events to be written under prescribed `user_events` tracepoints. This allows the runtime to register tracepoints based on the provider configurations passed in and write directly to the `user_events_data` file.
680+
681+
> Note available for .NET 10.0 and later.
682+
683+
#### Inputs:
684+
685+
Header: `{ Magic; Size; 0x0206; 0x0000 }`
686+
687+
* `uint circularBufferMB`: The size of the circular buffer used for buffering event data while streaming
688+
* `uint format`: 0 for the legacy NetPerf format and 1 for the NetTrace format
689+
* `ulong rundownKeyword`: Indicates the keyword for the rundown provider
690+
* `bool requestStackwalk`: Indicates whether stacktrace information should be recorded.
691+
* `bool userEventsRequested`: Indicates whether `user_events` should be enabled
692+
* `array<provider_config> providers`: The providers to turn on for the streaming session
693+
694+
A `provider_config` is composed of the following data:
695+
* `ulong keywords`: The keywords to turn on with this provider
696+
* `uint logLevel`: The level of information to turn on
697+
* `string provider_name`: The name of the provider
698+
* `string filter_data` (optional): Filter information for callbacks
699+
* `event_filter filter`: Defines rules for filtering this provider's Event IDs, using either an allow list or a deny list.
700+
* `tracepoint_config config` (required when `userEventsRequested` is true): Maps filtered Event IDs to tracepoints. If an Event ID is excluded by `event_filter`, it will not be written to any tracepoint.
701+
702+
A `event_filter` is comprised of the following data:
703+
* `bool allow`: 0 for deny list, 1 for allow list
704+
* `array<uint> event_ids`: List of Event IDs to deny or allow.
705+
706+
A `tracepoint_config` is comprised of the following data:
707+
* `string default_tracepoint_name`: The default tracepoint filtered Event IDs will be written to unless otherwise specified by `tracepoints`.
708+
* `array<tracepoint_set> tracepoints` (optional): Specifies alternate tracepoint subsets of Event IDs will be written to instead of the default tracepoint.
709+
710+
A `tracepoint_set` is comprised of the following data:
711+
* `string tracepoint_name`: The tracepoint that the following subset of Event IDs should be written to.
712+
* `array<uint> tracepoint_event_ids`: The Event IDs to be written to `tracepoint_name`.
713+
714+
> See ETW documentation for a more detailed explanation of Keywords, Filters, and Log Level.
715+
716+
#### Returns (as an IPC Message Payload):
717+
718+
Header: `{ Magic; 28; 0xFF00; 0x0000; }`
719+
720+
`CollectTracing5` returns:
721+
* `ulong sessionId`: the ID for the stream session starting on the current connection
722+
723+
##### Details:
724+
725+
Input:
726+
```
727+
Payload
728+
{
729+
uint circularBufferMB,
730+
uint format,
731+
ulong rundownKeyword,
732+
bool requestStackwalk,
733+
bool userEventsRequested,
734+
array<provider_config> providers
735+
}
736+
737+
provider_config
738+
{
739+
ulong keywords,
740+
uint logLevel,
741+
string provider_name,
742+
string filter_data (optional),
743+
event_filter filter,
744+
tracepoint_config config
745+
}
746+
747+
event_filter
748+
{
749+
bool allow,
750+
array<uint> event_ids
751+
}
752+
753+
tracepoint_config
754+
{
755+
string default_tracepoint_name,
756+
array<tracepoint_set> tracepoints
757+
}
758+
759+
tracepoint_set
760+
{
761+
string tracepoint_name,
762+
array<uint> event_ids
763+
}
764+
```
765+
766+
Returns:
767+
```c
768+
Payload
769+
{
770+
ulong sessionId
771+
}
772+
```
773+
774+
Followed by an Optional Continuation of a `nettrace` format stream of events or direct writes to the file descriptor if `userEventsRequested` is enabled.
775+
672776
### `StopTracing`
673777

674778
Command Code: `0x0201`

0 commit comments

Comments
 (0)