profiler icon indicating copy to clipboard operation
profiler copied to clipboard

Can't load perf profile.

Open emilio opened this issue 2 years ago • 7 comments

Trying to upload this profile taken with perf as per the instructions fails in all browsers. Maybe the profile is too big? But it seems to try to do JSON.parse which is suspicious.

┆Issue is synchronized with this Jira Task

emilio avatar Mar 02 '23 12:03 emilio

The perf.data file is much smaller.

emilio avatar Mar 02 '23 12:03 emilio

The error is indeed that it's too big, the underlying error I get (in the web console) is NS_ERROR_OUT_OF_MEMORY when trying to decode the file as UTF-8. We should try to use the stream API for this nowadays...

perf.data is smaller but doesn't have symbolication information as far as I know. (I also get a 403 Forbidden error when I try to access it BTW).

julienw avatar Mar 02 '23 14:03 julienw

Once I publish the next version of samply, we should update our instructions to recommend samply load perf.data instead. @emilio, can you try that on your profile?

mstange avatar Mar 02 '23 19:03 mstange

It seems like if the file size of the perf.txt generated by perf script is larger than 500MB, Firefox profiler would report such error: Error: Unserializing the profile failed: SyntaxError: Unexpected end of JSON input which occurs at the source code reading the perf file.

jingchangshi avatar Apr 09 '23 15:04 jingchangshi

Can you try generating the perf data using --call-graph dwarf option. I was stuck at the same thing, but trying this sorted it out for me.

Dhull442 avatar Apr 21 '23 06:04 Dhull442

It seems like if the file size of the perf.txt generated by perf script is larger than 500MB, Firefox profiler would report such error: Error: Unserializing the profile failed: SyntaxError: Unexpected end of JSON input which occurs at the source code reading the perf file.

As you can see from this code, this codepath should be reached when it is not a perf profile. Therefore I believe that the text format you're using isn't recognized by our perf format detection. Can you please share the command you used as well as the perf script output with us?

Like markus mentioned above, you can also try loading perf.data directly using samply.

julienw avatar Apr 21 '23 08:04 julienw

Once I publish the next version of samply, we should update our instructions to recommend samply load perf.data instead. @emilio, can you try that on your profile?

$ ./samply load perf.data 
Could not parse the input file as JSON: expected value at line 1 column 1
If this is a perf.data file, please use `samply import` instead.

And next i run: $ ./samply import perf.data cmd line: /usr/bin/perf record -e cycles --switch-events --sample-cpu --all-cpus --per-thread --timestamp --call-graph dwarf --aio -z -p 2628 --output=perf.data event cpu-clock Could not find segment or section overlapping the file offset range 0x1000..0x2000 Could not find segment or section overlapping the file offset range 0x26000..0x17b000 Local server listening at http://127.0.0.1:3000 Press Ctrl+C to stop. ^C

And result is: https://github.com/firefox-devtools/profiler/issues/5118

minzak avatar Sep 05 '24 14:09 minzak