Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace2: add performance format target #1151

Merged
merged 4 commits into from
Mar 15, 2023

Conversation

ldennington
Copy link
Contributor

@ldennington ldennington commented Mar 14, 2023

This series adds the performance format target for TRACE2 tracing.

The first two patches are small fixes for bugs I noticed as I was testing the
performance format target. The first moves the FormatTargetTypes enum
from the specific Trace2StreamWriter class to the shared Trace2Writer
class. The second ensures the normal format event names are written in snake
case (rather than lowercase).

The third patch adds the ability to get the "depth" of the process. Because Sids
and depth are process-related concepts, it removes the SidManager class and
moved depth/sid-related properties and methods into the ProcessManager class.

The fourth patch adds the performance format target. It includes a few notable
components:

  1. A new GetMessage method to ensure message strings written to normal and
    performance targets are not duplicated.
  2. A new PerformanceFormatComponent class to track sizing of optional
    properties of performance format messages.
  3. A BuildSpan method that Trace2Message children use to create
    correctly-sized "spans" for optional properties of performance format
    messages. A span is a piece of the message beginning with a pipe (|) and
    ending just before the next pipe or the end of the message.
  4. A BuildTimeSpan method that adjusts spans for long/short times. In
    future, when we have events that include performance format string span
    components, we will need to add an additional method to handle them.

@ldennington ldennington force-pushed the performance-format-target branch 2 times, most recently from 729b32f to f731076 Compare March 14, 2023 16:10
@ldennington ldennington self-assigned this Mar 14, 2023
@ldennington ldennington marked this pull request as ready for review March 14, 2023 16:21
@ldennington ldennington force-pushed the performance-format-target branch from f731076 to 6ec1696 Compare March 14, 2023 16:23
Copy link
Collaborator

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a few suggestions on improving perf/caching values, simplifying the virtual methods on Trace2Message, and wondered if we could avoid reflection at all.

src/shared/Core/Trace2.cs Outdated Show resolved Hide resolved
src/shared/Core/Trace2.cs Outdated Show resolved Hide resolved
src/shared/Core/Trace2.cs Outdated Show resolved Hide resolved
src/shared/Core/Trace2.cs Outdated Show resolved Hide resolved
@ldennington ldennington force-pushed the performance-format-target branch from 6ec1696 to 850fa8b Compare March 14, 2023 23:55
@ldennington
Copy link
Contributor Author

ldennington commented Mar 15, 2023

@mjcheetham @jeffhostetler - I believe all feedback has been addressed with my latest push, but please do let me know if I missed anything.

Edit: I did push changes after originally posting this, but that was only to clean up some merge conflicts with the PR that @mjcheetham merged to main earlier today and to fix a Windows/.NET Framework breakage.

Move the FormatTargetTypes enum from the specific Trace2StreamWriter class
to the shared Trace2Writer class, since the Trace2FileWriter class also
uses values from this enum.
A previous patch [1] added the ability to write strings in snake case.
However, this was not applied to writing events in the normal format -
events that should be written as child_start or child_exit are currently
written as childstart and childexit. This patch corrects this issue.

[1]: 7d2a8cc
@ldennington ldennington force-pushed the performance-format-target branch 3 times, most recently from 9468840 to 26e9101 Compare March 15, 2023 04:15
The performance format target requires recording of process depth. We use
the number of forward slashes in the process's sid as a convenient way to
determine this. Because the sid and the depth are process-related
concepts, this change also moves sid/depth related properties into
ProcessManager.cs and removes the SidManager.cs class.
Add the performance format target for TRACE2 tracing. This change
includes a few notable components:

1. A new GetMessage method to ensure message strings written to normal and
performance targets are not duplicated.
2. A new PerformanceFormatComponent class to track sizing of optional
properties of performance format messages.
3. A BuildSpan method that Trace2Message children use to create
correctly-sized "spans" for optional properties of performance format
messages. A span is a piece of the message beginning with a pipe (|) and
ending just before the next pipe or the end of the message.
4. A BuildTimeSpan method that adjusts spans for long/short times. In
future, when we have events that include performance format string span
components, we will need to add an additional method to handle them.
@ldennington ldennington force-pushed the performance-format-target branch from 26e9101 to 59a2692 Compare March 15, 2023 16:31
Copy link
Collaborator

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Good stuff :)

src/shared/Core/Trace2.cs Show resolved Hide resolved
@ldennington ldennington merged commit 65e5a88 into git-ecosystem:main Mar 15, 2023
mjcheetham added a commit that referenced this pull request May 2, 2023
**Changes:**

- Support ports in URL-scoped config (#825)
- Support URL-scoped enterprise default settings (#1149)
- Add support for client TLS certificates (#1152)
- Add TRACE2 support(#1131, #1151, #1156, #1162)
- Better browser detection inside of WSL (#1148)
- Handle expired OAuth refresh token for generic auth (#1196)
- Target *-latest runner images in CI workflow (#1178)
- Various bug fixes:
  - Ensure we create a WindowsProcessManager on Windows (#1146)
  - Ensure we start child processes created with ProcessManager (#1177)
  - Fix app path name of Windows dropping file extension (#1181)
  - Ensure we init IEnvironment before SessionManager (#1167)
  - git: consistently read from stdout before exit wait (#1136)
  - trace2: guard against null pipe client in dispose (#1135)
- Make Avalonia UI the default Windows and move to in-process (#1207)
- Add Git configuration options for trace & debug (#1228)
- Transition from Nerdbank.GitVersioning to a version file (#1231)
- Add support for using the current Windows user for WAM on DevBox
(#1197)
- Various documentation updates:
  - org-rename: update references to GitCredentialManager (#1141)
  - issue templates: remove core suffix (#1180)
  - readme: add link to project roadmap (#1204)
  - docs: add bitbucket app password requirements (#1213)
  - .net tool: clarify install instructions (#1126)
  - docs: call out different GCM install paths in WSL docs (#1168)
  - docs: add trace2 to config/env documentation (#1230)
@ldennington ldennington deleted the performance-format-target branch July 12, 2023 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants