perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

support of pprof files in Perfetto

Open nians opened this issue 6 years ago • 18 comments

We are trying to use perfetto as a platform that can analyze and present most of our perf traces, for systrace, proc stats , they are easy to query and present, but for pprof files, we haven't find a way to handle it

Could you consider implementing the support of pprof files? Thanks very much

nians avatar Feb 13 '20 11:02 nians

Thanks for getting in touch!

Could you elaborate a bit on that? Where do these pprof files come from - from Perfetto or from somewhere else? What would you like us to implement?

fmayer avatar Feb 22 '20 01:02 fmayer

I think what they mean is being able to import pprof files (not sure if the "perf.data" binary from linux's perf or the gperftools proto) and ingest them in trace processor / ui. @nians do you have an example file you'd be able to import, or at least the cmdline that generates it?

primiano avatar Feb 23 '20 20:02 primiano

@primiano yes, and perf.data is from Android simpleperf, which is same to Linux perf, and there is also tool in simpleperf project can convert perf.data to pprof files, an exampled file is here :[https://drive.google.com/open?id=1JybfYPYUe6OWpJpJQFasMStL5j8gMqP2] and can be shown in speedscope.com

It will be great that pprof files can be supported in trace_processor and web ui.

nians avatar Mar 03 '20 13:03 nians

It would be handy to be able to do this for chromium tracing as well. it seems perfetto can't deal with the output of pprof-style traces from --enable-profiling

caitp avatar Sep 22 '21 14:09 caitp

It would be handy to be able to do this for chromium tracing as well. it seems perfetto can't deal with the output of pprof-style traces from --enable-profiling

Not sure what you mean with this (you mean the chrome://tracing ui?). Eventually chrome://tracing will be replaced by ui.perfetto.dev, it's mainly a matter of time. Won't happen too soon though because tehre are various features missing that are blocking.

primiano avatar Sep 22 '21 14:09 primiano

Referring specifically to https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/profiling.md#Profiling-using-built_in-tcmalloc-profiler --- which in my experience, has worked better than perfetto traces. But being able to automate queries over a set of 100 startup traces with the trace processor shell, would be very nice to do. This isn't a thing at the moment.

caitp avatar Sep 22 '21 14:09 caitp

I have no idea how that works but it seems to emit some format that pprof understands, so it's either the google pprof proto or the perf.data.

which in my experience, has worked better than perfetto traces.

traces and callstack profiles they are two very different things and solve very different classes of problems. This statement makes little sense to me (even if you flip the direction of what works better). It's like saying "this car works way better than this boat"... i mean depends on where you want to go ;)

primiano avatar Sep 22 '21 14:09 primiano

"works better" in the sense that it produces more helpful data for my use case.

caitp avatar Sep 22 '21 14:09 caitp

This would be nice for Node programs that tend to have profile captures bigger than the average web page.

For example, the TypeScript team implemented support for profiling the compiler to help diagnose our own perf issues. This uses Node's built-in profiling support, but the output of these is massive and often can't be loaded into existing dev tools. Instead, we've been using pprof-nodejs to profile our compiler, but helping users self-service when they're unable to share code involves a lot of steps that we'd like to remove.

Ideally, they could produce output with pprof, and visualize their profiles in Perfetto.

DanielRosenwasser avatar Oct 08 '21 23:10 DanielRosenwasser

@DanielRosenwasser out of curiosity are those pprof profiles symzolized or require symbolization?

It's one of the things @ddiproietto and myself were trying to figure out recently (how symbolization should work).

primiano avatar Oct 11 '21 11:10 primiano

I honestly don't know - given that I would guess they're symbolized since I don't have to do any intermediate steps. My colleague @JakeBailey may have more context.

DanielRosenwasser avatar Oct 11 '21 18:10 DanielRosenwasser

I'm not entirely certain one way or the other; perhaps @nolanmar511 (who I believe is the maintainer of pprof-nodejs) can answer definitively.

My impression would be that they should be symbolized (by the hints given on https://github.com/google/pprof/blob/7c2eacd09c8d41a73b3f4404b97302f5cc78473d/proto/README.md#locations-functions-and-mappings).

I do recall having to ensure that I didn't change any of the JS code I wrote while I was using the profile, otherwise things broke, so the profiles seemingly don't encode everything, but maybe that's unrelated. IIRC when I'm profiling Go, I'm doing so with the the .test binary present from the go test run, and the readme above says Go is not symbolized.

jakebailey avatar Oct 11 '21 19:10 jakebailey

pprof-nodejs produces fully symbolized profiles (changing JS code should not cause issues -- feel free to file an issue with more details). Golang's profiles (generated with net/http/pprof or runtime/pprof) should also be fully symbolized. The pprof CLI (https://github.com/google/pprof) does have some utilities for handling unsymbolized profiles; I think this code is pretty much C/C++ profiles (and this symbolization logic requires that the binaries with sufficient debug information are available on the machine which the pprof CLI is running on and requires that those binaries are compiled with sufficient debug information).

Also, + @google/pprof-team and + @amchiclet (who is also on the Cloud Profiler team and is the person on our team looking into https://github.com/open-telemetry/oteps/issues/139, which is a proposal for adding profiling into open telemetry).

nolanmar511 avatar Oct 11 '21 20:10 nolanmar511

changing JS code should cause issues -- feel free to file an issue with more details

I assume you mean "should not cause issues"; I'll file an issue if I hit this again (don't want to derail this issue any further, I was just unfamiliar with the distinction of symbolized versus unsymbolized 😄).

jakebailey avatar Oct 11 '21 20:10 jakebailey

changing JS code should cause issues -- feel free to file an issue with more details

I assume you mean "should not cause issues"; I'll file an issue if I hit this again (don't want to derail this issue any further, I was just unfamiliar with the distinction of symbolized versus unsymbolized smile).

Thanks! Updated my previous comment.

nolanmar511 avatar Oct 11 '21 20:10 nolanmar511

Support for the perf.data format has been implemented for stack sampling at least. We'll be adding support for counters etc in upcoming releases but I think we've done enough to close this bug.

LalitMaganti avatar Nov 15 '23 17:11 LalitMaganti

Support for the perf.data format has been implemented for stack sampling at least. We'll be adding support for counters etc in upcoming releases but I think we've done enough to close this bug.

Hi @LalitMaganti, You mentioned couters etc will release in upcoming releases, is that means currently perfetto is not support to trace counters like HW cycles for a specific process like we always did in simpleperf with command "simpleperf stat -p process_name"

yanj403 avatar Nov 22 '23 06:11 yanj403

Hi, Yes, it means that currently perfetto doesn't support any counters, also those from simpleperf. Feel free to contribute if needed, adding support for counters should not be too difficult.

On Wed, Nov 22, 2023 at 6:17 AM yanj403 @.***> wrote:

Support for the perf.data format has been implemented for stack sampling at least. We'll be adding support for counters etc in upcoming releases but I think we've done enough to close this bug.

Hi Lalit, You mentioned couters etc will release in upcoming releases, is that means currently perfetto is not support to trace counters like HW cycles for a specific process like we always did in simpleperf with command "simpleperf stat -p "

— Reply to this email directly, view it on GitHub https://github.com/google/perfetto/issues/9#issuecomment-1822176320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ3CHTRKIICGQM4XRU4AK23YFWKHVAVCNFSM4KUQRW32U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGIYTONRTGIYA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

aMayzner avatar Nov 22 '23 11:11 aMayzner