Skip to content

Speed scope - #114

Closed
adamsitnik wants to merge 4 commits into
dotnet:masterfrom
adamsitnik:speedScope
Closed

adamsitnik wants to merge 4 commits into
dotnet:masterfrom
adamsitnik:speedScope

Conversation

@adamsitnik

Copy link
Copy Markdown
Member

@vancem I decided to add the new argument --format to the dotnet-collect tool. IMHO output format of the collect command is more natural to me than new analysis command (we don't analyze anything here). Also the dotnet-collect has the concept of ETW/EventPipe and it was simply very easy to add it there.

If the user specifies --format speedscope I load the trace file and export it to a *.speedsope.json format. The default is just "trace" (does not change existing behavior)

Sample usage:

dotnet run -- --profile Default --format SpeedScope --config-path /Projects/SomeApp/bin/Release/netcoreapp3.0/SomeApp.eventpipeconfig --process-id 792

I added few provider names to the "default" profile. I needed to that to be able to get stack samples and symbols (rundown).

I tested it on macOS and Windows with .NET Core 3.0 and it works.

I am open to any ideas/suggestions/changes.

@adamsitnik
adamsitnik requested a review from vancem January 19, 2019 00:18
{
var stackSource = new MutableTraceEventStackSource(eventLog);

var computer = new ThreadTimeStackComputer(eventLog, symbolReader);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this line is throwing

EtwCollector.cs(86,36): error CS0618: 'ThreadTimeStackComputer' is obsolete: 'This is not obsolete but experimental, its interface is likely to change' 

in the CI builds :-)

@adamsitnik

Copy link
Copy Markdown
Member Author

@vancem told me that a new tool (dotnet trace) will be created soon and it's going to contain this feature so I am closing this PR

@adamsitnik adamsitnik closed this Mar 27, 2019
@josalem

josalem commented Apr 12, 2019

Copy link
Copy Markdown
Contributor

@adamsitnik - Would it be possible to incorporate these changes into the updated dotnet-trace tool? If you don't have time, I can take up the effort if you'd be willing to outline the work necessary.

@adamsitnik

Copy link
Copy Markdown
Member Author

Hi @josalem

Unfortunately, I don't have time now but I can outline the work necessary.

The logic that exports the data to a speedscope format lives in SpeedScopeStackSourceWriter.WriteStackViewAsJson which is part of the TraceEvent library (version 2.0.34+).
The method accepts a StackSource which is the provider of all profiling samples for the exporter. You can copy the code from this PR that allows for creating it from the EventPipe file.

Most probably the hardest thing will be choosing the new console argument name ;)

Please let me know if you need any help or something does not work as expected.

josalem pushed a commit to josalem/diagnostics that referenced this pull request Apr 19, 2019
@josalem josalem mentioned this pull request Apr 19, 2019
josalem pushed a commit to josalem/diagnostics that referenced this pull request Apr 19, 2019
josalem pushed a commit that referenced this pull request Apr 19, 2019
* Incorporate code from closed PR #114 to enable speedscope output:
* adds format option

* Actually add the converter...

* update dotnet-trace instructions

* Expanded on output format section of instructions

* Change protection level of TraceFileFormatConverter

* Updates in response to feedback

* Update src/Tools/dotnet-trace/TraceFileFormatConverter.cs

Co-Authored-By: josalem <josalem@microsoft.com>

* Update src/Tools/dotnet-trace/CommandLine/Options/CommonOptions.cs

Co-Authored-By: josalem <josalem@microsoft.com>

* Fix typos
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants