Conversation
Support for CTF Folder open based on new SDK NuGet Preview that supports folder open.
This PR adds a plugin for displaying generic events from Perfetto traces. Added a new "PerfettoCds" project to the solution. Keeping this in a separate "perfetto" feature branch while I work on it.
Data is gathered from the Perfetto trace through trace_processor_shell.exe. Trace_processor_shell.exe opens an interface that allows for making SQL queries over HTTP/RPC to localhost. All the trace data is retrieved with SQL queries. Data is serialized over the HTTP interface with Protobuf objects. The original TraceProcessor protobuf object (trace_processor.proto) and the C# conversions are included in the project.
PerfettoSourceParser will start the trace_processor_shell.exe process. SQL Queries will be made over HTTP and the protobuf output will be converted to objects of type PerfettoSqlEvent. One query will be made per SQL table. Each query will produce events of the same type and will be processed by their own individual source cooker. For a complete generic event, we need data from 5 tables: slice, args, thread_track, thread, and process. A composite cooker will then take all the data gathered from each individual source cooker and join them to create the final generic event.
For example, for the slice table, the process goes like this:
Perform a SQL query into the Perfetto trace through trace_processor_shell.exe ("select * from slice"). Returns a QueryResult object
Convert QueryResult object into individual PerfettoSliceEvents. One event for each row in the SQL table
PerfettoSliceCooker will process/store all the PerfettoSliceEvents.
Once all the other tables have also finished, PerfettoGenericEventCooker will gather all the events from each cooker and do a join on them to create complete PerfettoGenericEvent objects.
Create WPA table of PerfettoGenericEvents
…sing /rpc endpoint (#22) * Working RPC bidirectional * Updated Perfetto plugin to use the latest trace_processor_shell.exe (v17.0 from July '21). This mainly included updating the proto files * Switched to using the /rpc endpoint in trace_processor_shell, which utilizes a bidirectional pipe that passes back and forth the same stream object. This is the new, preferred way to query trace_processor_shell. The old way used individual endpoints (/query, /status) for each request. These are being deprecated. * Added EndTimestamp column
Added table and event processing for CPU scheduling events. These events list the timing, priority, CPU, and state for processes + threads.
…ogcat (#24) Added 3 new tables to the Perfetto plugin. Logcat events - Displays all the logcat messages logged during the trace in simple linear timeline. Moved this table to a separate "Android" table group. CPU frequency scaling - Displays the frequency chart for each CPU and how it changes. When the CPU goes idle, the CPU frequency is displayed as 0. Ftrace events - Displays all the remaining events in the Raw table, which is a lot of the Ftrace events. These are displayed in simple timeline grouped by CPU Also moved a couple tools that were used by multiple projects to a shared Utility project.
…le (#25) In Windows traces, the Provider name of each event is output along with all the event fields. Perfetto does not output the original provider name or GUID for an event. This change adds a workaround for that. It adds support for the loading of an optional XML file that has a mapping between a Provider Name and a Provider GUID. If the user then instruments their code to output the provider GUID as a debug annotation value with a specific key, the full Provider Name will be retrieved for that GUID and added as a column to the GenericEvent viewer. The ProviderMapping.xml file needs to be placed in the plugin directory with all the binaries. Also upped the retry count for waiting for trace_processor_shell to respond
… properly (#26) Gathered the timing information from the clock_snapshot and trace_bounds tables so that the UTC wall clock time for the start of the trace can be calculated. Needed to switch to using RelativeTimestamps for the data output events so that they can be properly aligned relative to the wall clock time. RelativeTimestamps are calculated in the source cookers.
…ources (#27) We wanted to set up a NuGet pipeline in the Perfetto repo, but the Perfetto team does not want to maintain another packaging pipeline, even if we set it up. We could publish the package ourselves, but I don't think we want to maintain that and it seems weird for Microsoft to publish a NuGet package for Google tools. Perfetto does publish to CIPD, GCS, and GitHub releases, so I made some VS build tasks to download a specific release from GitHub and copy the .exe we want to the the build directory. Also added unique names for the 2 DataSources, since that messed up some scenarios in WPA (like using wpaexporter).
Edge traces are missing the required UTC clocks for gathering the absolute trace start time and that caused the DataSourceInfo to not be initialized, which causes no events to be displayed. Added support to default to DateTime.Now for missing absolute trace start. Also added a couple new value types for args.
#29) * Support correct absolute trace start time for Chromium Perfetto traces. Add support for metadata table parsing
A few small changes before I merge the Perfetto branch into develop. Changed path for Perfetto plugin in build pipeline Updated main README to include Perfetto information Restructured and added more Perfetto unit tests
Merging Perfetto feature branch into develop
… Perfetto support (#33)
…U counters (#34) With the STAT_CPU_TIMES config option, CPU counter events are captured based on counter values from the /proc/stat file. At regular interval through the trace, multiple CPU counter events (user, user_nice, system, IO, interrupts, softIRQ, idle) are recorded. By looking at the change of these counter values from one event to the next, you can graph CPU usage percentage for each category. Added separate table to graph all these CPU counters. data_sources: { config { name: "linux.sys_stats" sys_stats_config { stat_period_ms: 1000 stat_counters: STAT_CPU_TIMES stat_counters: STAT_FORK_COUNT } } }
…ry (#35) Added table that displays memory for each process based on /proc//status Added table that displays overall system memory based on /proc/meminfo Reorganized table groups into "Perfetto - Android", "Perfetto - Events", and "Perfetto - System" Reorganized namespaces and PerfettoPluginConstants
…tests (#36) Added % CPU usage graphs to CPU scheduler view. Removed the idle thread('swapper') from CPU scheduler graphs Added unit tests for new memory tables
* Updated Perfetto plugin docs
A type of Generic Events were being excluded from the previous generic event query. Generic events can come with a thread and a process, or just with a process. We were missing out on the latter. Added a query for the process_track table which allows us to query events that only have a process. Modified the giant LINQ query to use LEFT OUTER JOIN syntax because there are 2 valid paths now. Added a table config to better view process-only Generic Events and also a table config that shows Generic Event activity. Unit tests needed to be updated because the output changed slightly
Fixed CPU usage % was not showing up in table. Had projection order backwards. Made this table config first You can't set the default table in each table group, it is sorted alphabetically. Putting a space in the name makes it first though. Made a couple of the more interesting tables first
…erfetto UI but bubbles longest running activities to the top. Fix other views as well. (#44)
…tionships (#45) Add tracking of parent depth level in order to show parent/child relationships and more closely match Perfetto UI. Also fix various scalar data types that can come across as optional / nullable.
…t Hierarchical / Stack view (#46) * Add ParentTree to GenericEvents and provide new non-default Hierarchical / Stack view of this named "Perfetto Trace Events - Process-Thread-ParentNameTree"
…be viewed inline as diagnostics w/o dissapearing. Also hide the window popup for a more seamless UI expereince. (#47)
Made some memory optimizations to help improve the sluggishness in WPA when viewing large traces. Memory optimizations reduce memory usage by about 50%. UI is more responsive now. Optimizations include Used string interning on the high-count string fields Switched the variable length argument fields from List to string[] Changed bunch of longs to ints. These are mostly ID fields. Confirmed they are int or smaller within Perfetto Table renaming Removed redundant "Perfetto" from all tables and column config names Added column configs that graph by StartTime instead of duration for GenericEvents Added fix for duplicate GUIDs
* Align GenericEvents process & thread display with CPU Scheduling to make it easier to find the exact thread that is consuming CPU between tables
* First check-in of initial CPU sampling verifying we get some basic data with sample & proc/thread. * Upgrade all NuGet deps including Performance.SDK to 0.109.24 (fix breaking changes). Add trace processor shell logging to Perfetto UT * Walk the stack and produce StackWalk Module!Function array as well as Instruction Pointer (IP) Module & Function * Add some Unit Tests for CPU Sampling and a small Android 12 trace with CPU Sampling
Changes to csproj files for NuGet packaging
* Add wake info in scheduling table. * Address feedback comments. * Address feedback comments 2. * Add launchSetting.json in .gitignore. * Update thread name in unit test.
Added table for GPU counters. Also fixed a few SDK deprecations.
* Add previous CPU scheduling event info. * Update comments.
* Fix crash when we have no CPU sampling stack * Fix some warnings due to upcoming API deprecations in 1.0 Toolkit SDK
Use SDK v1.0.9-rc1
* Changes for 1.2 release which can now include Perfetto support. Also compatible with public Store Windows Performance Analyzer Preview which supports 1.0 RC SDK. Rev version to 1.2 and standardize package version, AssemblyVersion, and FileVersion into just 1 version.
KyleStorck
approved these changes
Nov 21, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.