Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds /timetrace command to generate a flame graph from an input trace (…
…#8) * Accepts a new command-line switch to output Chrome's trace instead of WPA's (still does nothing useful with it other than checking it's provided) * Refactors DoAnalyze and DoStop to separate WPA and Chrome trace outputs * Refactors new arguments into the same line There's no apparent max line length to cut them and looks like out arguments are the ones to get cut to the next line * Adds new analyzer to recreate the execution hierarchy, starts adding data * Updates entry's StopTimestamp when its associated activity ends * Adds a new view to export to Chrome trace's JSON, uses nlohmann library Exported entry names are the raw activity names, for now * Removes leftover comment * Creates auxiliary class to calculate ProcessId and ThreadId remappings of entries, to keep subhierarchies packed together * Moves ChromeFlameGraphView into the new subfolder, to keep related classes together * Calculates ProcessId remapping for root entries in the flame graph * Renames method and creates new one to calculate ThreadId remaps It will consume some data that's not yet calculated * Calculates local ThreadId for entries, starts working on calculating the required number of ThreadId to fit a given hierarchy * Calculates and applies new ThreadId for all entries so they are tightly packed with their hierarchies * Adds the ability to filter entries in the Chrome trace to keep output file manageable Currently allows filtering templates via /templates flag and both templates and functions that last for little time * Adds names to TemplateInstantiation activities * Removes "TODO: cache" comments for entry names, could be an interesting optimization for memory however * Fixes spacing on error message * Fixes "/stop /chrometrace", which wasn't working * Moves ChromeFlameGraphView::AddEntry to an internal function to prevent including nlohmann\json.hpp from the header * Adds documentation bit * Removes indentation from internal namespace, similar to other places in the code * Updates README.md to include /chrometrace option * Fixes /start arguments section in README.md * Updates README.md to give a little description of the new files * Adds some extra data to Chrome trace: command line, useful environment variables (check BuildExplorerView.cpp for reference) and compiler/linker tool version, path, working directory * Compiler/Linker's tool path may not be available if the analyzed project was compiled with an old toolset version (i.e. v141) * Assumes symbol keys are unique (after re-reading the SDK's docs) * Fixes wrong .h/.cpp placement in filters * Adds type to constants * Refactor for improved understandability * Renames flame graph options to make it vendor-independent, switches to edge://tracing in README.md * Renames TimeTraceFlameGraphView to TimeTraceGenerator The View suffix is related to WPA * Moves filters around to separate WPA-related files from TimeTrace-related ones * Prevent copying pair * Removes size_t to int warning by using iterators * Refactors opening bracket for if and else whose body is just one line, to match the rest of the codebase * Adds path from FileInput and FileOutput events to Compiler and Linker entries * Removes namespace from method signature, it's already part of an using clause * Modifies how TemplateInstantiations are filtered: if root passes, full hierarchy passes (children don't get filtered) * Adds Invocation ID to Compiler and Linker entries, much like ContextBuilder does * Enforces /timetrace to be placed right before the output file * Moves files into a new physical structure to match solution Filters (modified in commit 986da76) * Updates "Overview of the code" section in README.md to match the new physical structure of files and folders * Updates /stop and /analyze commands documentation to make /timetrace option clearer * Prints /stop and /analyze command line hints in two lines: one for the original command and other for the /timetrace version * Uses bool operator instead of the explicit != nullptr check * Promotes check out of the if statement * Functions and types from the Microsoft::Cpp:BuildInsights::Internal aren't meant to be used * Uses CP_UTF8 codepage when converting between std::wstring and std::string * Updates variable names to match new class name (leftover from previous refactors) * Removes leftover code from previous refactor * Refactors activity filtering from TimeTraceGenerator to ExecutionHierarchy Thanks to this, TimeTraceGenerator deals with real leaf entries instead of entries that may end up being leafs if all their children get filtered out It will now output one X trace event instead of a pair of B and E types next to each other * Adds screenshot of the /timetrace option and uses it in README.md * Renames Thread activities to reflect their parent (i.e. Thread within CodeGeneration becomes CodeGenerationThread) * Invocation activities can have several FileInput and FileOutput events Pad number of FileInput/FileOutput with leading zeroes to keep them sorted as they were emitted (or else viewer would show 1 then 10s, 2 then 20s, ...) * Updates timetrace media for README.me to include latest changes in activity names * Refactors OnFinishRootTemplateInstantiation and OnFinishNestedTemplateInstantiation into OnFinishTemplateInstantiation There was a bug in CppBuildInsights v1.0.0 that forced us to separate them, but with v1.1.0 that bug is gone and they can be merged * Fixing a problem that occurs due to a rare bug in the linker that causes it to sometimes emit FileInput events with an empty path. Co-authored-by: Kevin Cadieux <[email protected]>
- Loading branch information