Stream: t-compiler/wg-self-profile

Topic: not seeing any data


nikomatsakis (Jun 18 2019 at 20:45, on Zulip):

So @Wesley Wiser -- I'm trying to get self-profile data out from the compiler and not seeing anything. When I run with -Zself-profile, basically, nothing seems to be being created.

nikomatsakis (Jun 18 2019 at 20:45, on Zulip):

The files should be named perf-* in current directory?

Wesley Wiser (Jun 18 2019 at 20:45, on Zulip):

Hmm

Wesley Wiser (Jun 18 2019 at 20:46, on Zulip):

The name changed about a month ago but yes, the files should be in your working directory

Wesley Wiser (Jun 18 2019 at 20:46, on Zulip):

Are you invoking rustc directly or via cargo?

nikomatsakis (Jun 18 2019 at 20:46, on Zulip):

via cargo, but when I use the -v option it does seem to be passing -Zself-profile

nikomatsakis (Jun 18 2019 at 20:47, on Zulip):

rustc --crate-name style components/style/lib.rs --color never --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -Zself-profile ...

Wesley Wiser (Jun 18 2019 at 20:47, on Zulip):

Hmm...

Wesley Wiser (Jun 18 2019 at 20:47, on Zulip):

Then, yeah, it should be enabled and outputting the current directory

Wesley Wiser (Jun 18 2019 at 20:51, on Zulip):

No chance you got a warning: failed to create profiler right?

nikomatsakis (Jun 18 2019 at 20:52, on Zulip):

no, I don't see that

nikomatsakis (Jun 18 2019 at 20:52, on Zulip):

I also tried @Wesley Wiser just doing rustc -Zself-profile

nikomatsakis (Jun 18 2019 at 20:52, on Zulip):

I must be doing something dumb

Wesley Wiser (Jun 18 2019 at 20:53, on Zulip):

You're not on a really old version of rustc are you?

Wesley Wiser (Jun 18 2019 at 20:55, on Zulip):

The profiler is tied into rustc::session::build_session_with_source_map() so I don't think there's a codepath which ignores the option

nikomatsakis (Jun 18 2019 at 20:56, on Zulip):

I just built it

nikomatsakis (Jun 18 2019 at 20:56, on Zulip):

the commit is from June 18

Wesley Wiser (Jun 18 2019 at 20:57, on Zulip):

Hmmm

Wesley Wiser (Jun 18 2019 at 20:57, on Zulip):

It doesn't sound like you're doing anything dumb :slight_smile:

Wesley Wiser (Jun 18 2019 at 20:58, on Zulip):

Unfortunately we don't have any trace!()ing around the profiler initialization.

nikomatsakis (Jun 18 2019 at 20:58, on Zulip):

oh wait

Wesley Wiser (Jun 18 2019 at 20:58, on Zulip):

I will look into this tonight and get back to you

nikomatsakis (Jun 18 2019 at 20:58, on Zulip):

I am seeing some output now

nikomatsakis (Jun 18 2019 at 20:58, on Zulip):

the file names do not have pid in them though

Wesley Wiser (Jun 18 2019 at 20:58, on Zulip):

I think they're {cratename}-{pid}.extension

nikomatsakis (Jun 18 2019 at 21:00, on Zulip):

ok,I have no idea why I wasn't seeing files before

nikomatsakis (Jun 18 2019 at 21:00, on Zulip):

but now I do

nikomatsakis (Jun 18 2019 at 21:00, on Zulip):

now I have to remember how to postprocess the data :)

Wesley Wiser (Jun 18 2019 at 21:01, on Zulip):

@nikomatsakis https://github.com/rust-lang/measureme/tree/master/summarize

nikomatsakis (Jun 18 2019 at 21:07, on Zulip):

@Wesley Wiser do you know what kinds of stuff winds up getting included in "macro expansion"

Wesley Wiser (Jun 18 2019 at 21:09, on Zulip):

@nikomatsakis https://github.com/rust-lang/rust/blob/9606f6fa64926a84d82e3c62dbdc57f5c10f756d/src/librustc_interface/passes.rs#L377-L452

Wesley Wiser (Jun 18 2019 at 21:09, on Zulip):

A lot it looks like

Wesley Wiser (Jun 18 2019 at 21:10, on Zulip):

I'm going to be afk for a few hours but I'll check back later tonight.

nikomatsakis (Jun 18 2019 at 21:13, on Zulip):

@Wesley Wiser ok, thanks

nikomatsakis (Jun 18 2019 at 21:13, on Zulip):

I'm going to try and figure out the flame graph stuff

nikomatsakis (Jun 18 2019 at 21:17, on Zulip):

isn't there some way to view this stuff in chrome or other tools?

lqd (Jun 18 2019 at 22:20, on Zulip):

@nikomatsakis yeah measureme has crox to produce profiling files in chrome's format https://github.com/rust-lang/measureme/tree/master/crox — as for other tools there's eg https://www.speedscope.app/ which can read flamegraphs in the usual format IIRC

Wesley Wiser (Jun 19 2019 at 00:55, on Zulip):

@nikomatsakis The stack collapse tool is https://github.com/rust-lang/measureme/tree/master/stack_collapse. You can use that to get a collapsed stacks file that can be input into the FlameGraph scripts. As @lqd mentioned, you can also just open the output of stack-collapse in speedscope.

nikomatsakis (Jun 19 2019 at 12:10, on Zulip):

I figured it out, thanks all. I'm trying to correlate the results with some other profiling data, I haven't yet fully succeeded -- but partly that's because gathering other data has proven hard.

nikomatsakis (Jun 19 2019 at 12:21, on Zulip):

I've also heard good things about profiler.firefox.com from @Alex Crichton; not sure wihich formats it can load

Last update: Nov 17 2019 at 07:50UTC