perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

perfetto capture minor-fault is different from simpleperf.

Open lbknxy opened this issue 1 year ago • 2 comments

Hi, I use this simpleperf cmd to capture minor-faults:

adb shell 'simpleperf stat --group page-faults,minor-faults --interval 2 --cpu 7 -a --duration 5' > my_minor.txt

and meanwhile use perfetto cmd to capture trace:

adb shell 'perfetto -t 4s -b 80m -o /data/misc/perfetto-traces/trace sched freq idle am gfx view camera bionic input'

The result file my_minor.txt of simplperf is what I want, and minor faults are monotonically increasing.

Image

But, the result of perfetto is not, you can see from bellow image, minor-faults in perfetto is not monotonically increasing. It fluctuates at tag my_set and my_cpy .

Image

So why are Simplerperf and Perfetto different, or is there something wrong with my capture cmd ?

lbknxy avatar Dec 05 '25 07:12 lbknxy

Apologies for the delay.

I suspect that the graphs are actually plotting the same data but perfetto is showing the deltas whereas your graph is plotting the cumulative values.

Unfortunately, this is relying on a quirk of simpleperf where it emits the counter values via atrace, which is picked up by perfetto when they are run simultaneously. Perfetto is just showing the raw information gathered through atrace, so there's not a lot we can do in perfetto without simpleperf changing, which would presumably break other systems that depend on the data being in this format.

You can actually open simpleperf files directly in perfetto, or if you're only interested in the counter values you could record a perfetto trace with traced_perf configured to get perfetto to collect these counters directly.

stevegolton avatar Dec 08 '25 08:12 stevegolton

I see, thank you very much.

lbknxy avatar Dec 09 '25 09:12 lbknxy