microsoft / Microsoft-Performance-Tools-Linux-Android

Linux, Android and Chromium Performance Tools built using the Microsoft Performance Toolkit. Cross-platform .NET Core + WPA GUI
MIT License
316 stars 34 forks source link

No Graphs visible #86

Closed Alois-xx closed 2 years ago

Alois-xx commented 2 years ago

I have downloaded the WPA Preview from the AppStore and used the launcher script. When I load an lttng or a perfetto trace I do see either no graphs, or just Trace Stats, but no useful graphs.

image

I see this exception

Unable to process 'file:///C:/tmp/SharedFolder/lttng/SlowUbuntu.ctf': System.Exception: No events - failure processing .ctf
   at PerfCds.PerfSourceParser.ProcessSource(ISourceDataProcessor`3 dataProcessor, ILogger logger, IProgress`1 progress, CancellationToken cancellationToken) in D:\a\1\s\Microsoft-Performance-Tools-Linux-Android\PerfCds\PerfSourceParser.cs:line 132
   at Microsoft.Performance.SDK.Runtime.Extensibility.SourceProcessingSession`3.ProcessSource(ILogger logger, IProgress`1 totalProgress, CancellationToken cancellationToken)
   at Microsoft.Performance.SDK.Processing.CustomDataProcessorWithSourceParser`3.ProcessAsyncCore(IProgress`1 progress, CancellationToken cancellationToken)
   at Microsoft.Performance.SDK.Processing.CustomDataProcessor.ProcessAsync(IProgress`1 progress, CancellationToken cancellationToken)
   at Microsoft.Performance.SDK.Runtime.ProcessingSourceExecutor.ExecuteAsync(CancellationToken cancellationToken)
Loaded Local Preferences from C:\Users\xxxxx\AppData\Local\Windows Performance Analyzer\Preferences.xml

Am I doing something wrong?

I have tried that the example perfetto traces which are linked in from the perfetto UI. There are no errors, but many disconnects?

[PerfettoCds.PerfettoDataProcessor]: Verbose - Querying for PerfettoStackProfileSymbol using SQL query: select id, type, name, source_file, line_number, symbol_set_id from stack_profile_symbol order by id
[PerfettoCds.PerfettoDataProcessor]: Verbose - trace_processor_shell.exe: [166.796] httpd.cc:193            [HTTP] Client disconnected
[PerfettoCds.PerfettoDataProcessor]: Verbose - trace_processor_shell.exe: [166.802] httpd.cc:186            [HTTP] New connection
[PerfettoCds.PerfettoDataProcessor]: Verbose - trace_processor_shell.exe: [166.802] httpd.cc:309            [HTTP] 0000 POST /rpc (body: 4 bytes).
[PerfettoCds.PerfettoDataProcessor]: Verbose - trace_processor_shell.exe: [166.803] httpd.cc:193            [HTTP] Client disconnected
[PerfettoCds.PerfettoDataProcessor]: Verbose - trace_processor_shell.exe: [166.810] httpd.cc:186            [HTTP] New connection
[PerfettoCds.PerfettoDataProcessor]: Verbose - trace_processor_shell.exe: [166.810] httpd.cc:309            [HTTP] 0000 POST /rpc (body: 109 bytes).
[PerfettoCds.PerfettoDataProcessor]: Verbose - Query for PerfettoStackProfileSymbol completed in 0.0143257s at 03/03/2022 06:21:00.169 UTC
[PerfettoCds.PerfettoDataProcessor]: Verbose - trace_processor_shell.exe: [166.811] httpd.cc:193            [HTTP] Client disconnected

In the end I get zero graphs from the example_android_trace_15s.pftrace

image

ETL files load fine.

ivberg commented 2 years ago

For LTTng, does this issue on the latest newly released 1.3.4 release? We just released a fix for a similar symptom. If you still have issues, please share the SlowUbuntu.ctf trace.

For Perfetto, I will try that repro file

Alois-xx commented 2 years ago

I have tried the latest 1.3.4 release. Either I am doing something wrong, or my regular WPA Profiles from the Windows 11 SDK WPA can interfere here? I have shared both files here: https://1drv.ms/u/s!AhcFq7XO98yJgtUhWI6FlrRrbRJOsw?e=H7YeEN

Alois-xx commented 2 years ago

I have installed it on another machine where I can see the graphs. It looks like it is a machine specific issue. Reinstalling the application did not the trick. I will further check.

CPU samples work now as well. For a .NET 6.0 app I do not get stacks because no metadata is present. The devs on Discord are helpful. If someone from the .NET team could open a design discussion on Github it would be great. I have also asked about your issue https://github.com/google/perfetto/issues/177.

As far as I could read through the lines tracing is working on Linux more or less by accident. There are not resources assigned to make it round on Linux, only on Android. I fear that feature will be a long standing one.

ivberg commented 2 years ago

Glad you got this working on another box @Alois-xx . It's certainly strange that on 1 box this only partially works with only some graphs. Never seen that personally. The tables should show as empty at the very least.

Also awesome that you got stacks working on Linux native code, even though as you said it's probably working by accident ;) I suspect that Perfetto would have to do some specific post data capture "rundown" work to capture these managed stacks. Likely something similar is done today to get managed Java stacks.

.NET folks currently recommend the https://aka.ms/perfcollect script to collect Linux perf & LTTng data. You can see in the script map files being generated, and ultimately used by perf to decode the stacks to text form on the capture box. Perfetto might have to do something similar since the stacks are resolved on-box and inserted into the trace.

For Linux tracing with CPU Scheduling & CPU Sampling, we currently recommend the combo of LTTng + perf. WPA can co-load on the same timeline all LTTng kernel events AND CPU sampling from the perf tool. Instructions are here how to capture this data - https://github.com/microsoft/Microsoft-Performance-Tools-Linux-Android/blob/develop/LinuxTraceLogCapture.md

ivberg commented 2 years ago

@brianrob what do you think about this or a good contact?

If someone from the .NET team could open a design discussion on Github it would be great.

brianrob commented 2 years ago

I just read through the issue, but I didn't quite catch what the design discussion is about. Can you help me out please?

ivberg commented 2 years ago

@alois-xx can comment more, but I think it would be something along the lines of this. If Perfetto wanted to capture .NET callstack info - what is the recommended method(s)? Do what aka.ms/perfcollect is doing, call some equivalent APIs, or something else?

brianrob commented 2 years ago

Ah. @Alois-xx, are you asking for someone from .NET to file an issue on Perfetto to facilitate symbol resolution? If so, I'm happy to participate in the discussion. It's probably easiest if you file something, and I can provide technical details on how we recommend doing this.

Alois-xx commented 2 years ago

@brianrob: I have opened a perfetto issue at https://github.com/google/perfetto/issues/259.

Perfcollect is nice. I would also like to get support for it in WPA and also dotnet-trace which writes .nettrace files. Currently the tool landscape is fragmenting a lot which makes it hard to keep track for which file format I need to use which tool. A common set of tools which work with anything would be great.

image

By the way: Where do I get crossgen2? There are a lot of talks about the improvements but somehow I did miss the part how I can get it. It is not part of the dotnet-sdk.

brianrob commented 2 years ago

Yup, there is fragmentation, but it is something that we are working on. Crossgen2 can be used via the dotnet SDK through this mechanism (it's used indirectly instead of directly called by the user): https://docs.microsoft.com/en-us/dotnet/core/deploying/ready-to-run#:~:text=There%20are%20two%20ways%20to%20publish%20your%20app,project.%20Publish%20the%20application%20without%20any%20special%20parameters.. Starting with .NET 6, this will use Crossgen2.

Also, I've just added some information to https://github.com/google/perfetto/issues/259. Thanks for filing it.