Skip to content

SpeedScopeExporter #842

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

Merged
merged 10 commits into from
Jan 18, 2019
Merged

SpeedScopeExporter #842

merged 10 commits into from
Jan 18, 2019

Conversation

adamsitnik
Copy link
Member

@vancem this is the initial version, WIP

Sample exported file: https://gist.github.com/adamsitnik/db8f40f4e84fd9c2975b7ce7b8b468c0 (you need to click the raw button and save it as file and then upload to https://www.speedscope.app/)

@codecov-io
Copy link

codecov-io commented Jan 6, 2019

Codecov Report

Merging #842 into master will increase coverage by 0.18%.
The diff coverage is 79.51%.

@@            Coverage Diff             @@
##           master     #842      +/-   ##
==========================================
+ Coverage    17.4%   17.58%   +0.18%     
==========================================
  Files         222      224       +2     
  Lines      137834   138440     +606     
  Branches    12203    12243      +40     
==========================================
+ Hits        23984    24345     +361     
- Misses     112912   113152     +240     
- Partials      938      943       +5
Flag Coverage Δ
#2017 17.58% <79.51%> (+0.18%) ⬆️
#Debug 17.58% <79.51%> (+0.18%) ⬆️
#Release ?
Impacted Files Coverage Δ
...c/TraceEvent/Stacks/SpeedScopeStackSourceWriter.cs 60.73% <60.73%> (ø)
...eEvent/TraceEvent.Tests/SpeedScopeExporterTests.cs 97.02% <97.02%> (ø)
src/FastSerialization/GrowableArray.cs 59.74% <0%> (-0.26%) ⬇️
src/PerfView/CommandProcessor.cs 0.17% <0%> (-0.01%) ⬇️
src/MemoryGraph/graph.cs 0% <0%> (ø) ⬆️
src/PerfView/Dialogs/RunCommandDialog.xaml.cs 0% <0%> (ø) ⬆️
src/PerfView/Dialogs/RunCommandDialog.xaml 0% <0%> (ø) ⬆️
src/PerfView/EventViewer/EventWindow.xaml 0% <0%> (ø) ⬆️
src/PerfView/EventViewer/EventWindow.xaml.cs 0% <0%> (ø) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a29af7e...d10c4f5. Read the comment docs.

public static class SpeedScopeExporter
{
/// <summary>
/// exports provided StackSource to a https://www.speedscope.app/ format
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also include the links to the documentation on the format that you put in an e-mail to me.


namespace Microsoft.Diagnostics.Tracing.Stacks
{
public static class SpeedScopeExporter
Copy link
Contributor

Choose a reason for hiding this comment

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

Call it SpeedScopeStackSourceWriter to be consistent with XmlStackSourceWriter.

@vancem
Copy link
Contributor

vancem commented Jan 7, 2019

Go ahead and make a user command 'NetPerfToSpeedScope' (like 'NewPerfToJson in https://github.com/Microsoft/perfview/pull/822/files) so that we have something immediately that we can use for demos.

I am OK with merging this with minimal testing (what you have is enough), as long as there are not known issues. Do you know of any issues?

@vancem
Copy link
Contributor

vancem commented Jan 17, 2019

Let me know when you are ready. Things that are left are

  1. Change namespace to ....Stacks.Formats
  2. Add PerfView user command

For 2. you can just paste this into the UserCommands.cs file

        /// <summary>
        /// Save Thread stacks from a NetPerf file into a *.speedscope.json file.
        /// </summary>
        /// <param name="netPerfFileName">The ETL file to convert</param>
        public void NetperfToSpeedScope(string netPerfFileName)
        {
            string outputName = Path.ChangeExtension(netPerfFileName, ".speedscope.json");

            string etlxFileName = TraceLog.CreateFromEventPipeDataFile(netPerfFileName);
            using (var eventLog = new TraceLog(etlxFileName))
            {
                var startStopSource = new MutableTraceEventStackSource(eventLog);
                // EventPipe currently only has managed code stacks.
                startStopSource.OnlyManagedCodeStacks = true;

                var computer = new SampleProfilerThreadTimeComputer(eventLog, App.GetSymbolReader(eventLog.FilePath));
                computer.GenerateThreadTimeStacks(startStopSource);

                SpeedScopeExporter.WriteStackViewAsJson(startStopSource, outputName);

                LogFile.WriteLine("[Converted {0} to {1}  Use https://www.speedscope.app/ to view.]", netPerfFileName, outputName);
            }
        }

@adamsitnik adamsitnik changed the title [WIP] SpeedScopeExporter SpeedScopeExporter Jan 17, 2019
@adamsitnik
Copy link
Member Author

@vancem I have fixed all issues, it's ready for final review and merge (if it passes the review ;) )

@vancem vancem merged commit e8307ef into microsoft:master Jan 18, 2019
@vancem
Copy link
Contributor

vancem commented Jan 18, 2019

LGTM

Thanks Adam for doing this! This gives us a viewing 'story' on Linux and Mac for netperf files.

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