Post

Replies

Boosts

Views

Activity

Reply to FIXED_CYCLES and FIXED_INSTRUCTIONS and sampling speed
Thanks for looking into this. If I understand correctly there is some ambiguity over what is going on here and you are making an educated guess on what is happening. It does sound likely that stack sampling activities are contributing to the measured instruction and cycle counts. It would be great if when selecting HW Counters option rather than Time Profiling option, that stack sampling was disabled. Capturing HW Counter (PMU) data is very light-weight and does not need to be done often. As requested I have re-run some captures for a heavier application with both low and high frequency sampling. This time I captured on an iPad. I selected Safari Browser and loaded the Speedometer 2.1 benchmark in it as a repeatable test. Here is a screenshot in low frequency sampling mode (other settings as per above post - i.e. 2 x counters CYCL and INSTR + deferred capture). Here is the equiv High Freq sampling screenshot: As you can see even though I have captured all processes on the iPad the INSTR and CYCL counts of all processes are very different. Just for the top process (com.apple.WebKit.WebContent) Low Freq - INSTR = 232B, CYCL = 84.5B ==> IPC = 2.75 High Freq- INSTR = 285B, CYCL = 110B ==> IPC = 2.59 Looking at all platform activity (to capture indirect work from Safari) Low Freq - INSTR = 257B, CYCL = 99.3B ==> IPC = 2.59 High Freq- INSTR = 327B, CYCL = 137B ==> IPC = 2.38 Now, since it is clear there is some sort of overhead in the HW Counts here (perhaps due to stack sampling), it's hard to trust either sets of numbers (low or high sampling freq). Is there any way to disable stack sampling? If not is there any way to calculate and remove the overhead of stack sampling accurately?
May ’23
Reply to FIXED_CYCLES and FIXED_INSTRUCTIONS and sampling speed
OK, here is a real example, based on Instruments 14.3 running on an M1 Macbook Pro with MacOS 13.3.1 Open Instruments on Macbook and select CPU Counters only for profiling Select Recording Options -> Sample By: Time Add events for Instructions and Cycles only Select Deferred Recording Mode in Global Options Open the Clock App (noting the moving second hand - i.e. App is active) In Instruments select the clock app as the target process to monitor Click record for 10s+ In Instruments select exactly a 10s region (to show counter values for this exact 10s period of the clock app) This capture is 1ms Sampling based capture. In Recording Options -> select High Frequency Sampling Click record for 10s+ In Instruments select exactly a 10s region (to show counter values for this exact 10s period of the clock app) This capture is based on 100us Sampling based capture. Instruments reports the following on my M1 Macbook: Without High Frequency Sampling Clock App - Samples = 127, Total Instructions ~= 4M, Total Cycles ~= 23.6M With High Frequency Sampling Clock App - Samples = 940, Total Instructions ~= 33.5M, Total Cycles ~= 122.7M As you can see there is a huge delta between the numbers with the same app running and only difference is the sampling speed setting. Can you help me to understand why there is a big difference and if there is an accurate way to capture the actual number of Instructions and Cycles being used by an App (in this case Clock app as an example)?
Apr ’23
Reply to FIXED_CYCLES and FIXED_INSTRUCTIONS and sampling speed
Thanks for looking into this. If I understand correctly there is some ambiguity over what is going on here and you are making an educated guess on what is happening. It does sound likely that stack sampling activities are contributing to the measured instruction and cycle counts. It would be great if when selecting HW Counters option rather than Time Profiling option, that stack sampling was disabled. Capturing HW Counter (PMU) data is very light-weight and does not need to be done often. As requested I have re-run some captures for a heavier application with both low and high frequency sampling. This time I captured on an iPad. I selected Safari Browser and loaded the Speedometer 2.1 benchmark in it as a repeatable test. Here is a screenshot in low frequency sampling mode (other settings as per above post - i.e. 2 x counters CYCL and INSTR + deferred capture). Here is the equiv High Freq sampling screenshot: As you can see even though I have captured all processes on the iPad the INSTR and CYCL counts of all processes are very different. Just for the top process (com.apple.WebKit.WebContent) Low Freq - INSTR = 232B, CYCL = 84.5B ==> IPC = 2.75 High Freq- INSTR = 285B, CYCL = 110B ==> IPC = 2.59 Looking at all platform activity (to capture indirect work from Safari) Low Freq - INSTR = 257B, CYCL = 99.3B ==> IPC = 2.59 High Freq- INSTR = 327B, CYCL = 137B ==> IPC = 2.38 Now, since it is clear there is some sort of overhead in the HW Counts here (perhaps due to stack sampling), it's hard to trust either sets of numbers (low or high sampling freq). Is there any way to disable stack sampling? If not is there any way to calculate and remove the overhead of stack sampling accurately?
Replies
Boosts
Views
Activity
May ’23
Reply to FIXED_CYCLES and FIXED_INSTRUCTIONS and sampling speed
Just to add, that not being able to trust the Instruction counts in particular is concerning. I hope the Instruments authors are able to provide some insight.
Replies
Boosts
Views
Activity
Apr ’23
Reply to FIXED_CYCLES and FIXED_INSTRUCTIONS and sampling speed
OK, here is a real example, based on Instruments 14.3 running on an M1 Macbook Pro with MacOS 13.3.1 Open Instruments on Macbook and select CPU Counters only for profiling Select Recording Options -> Sample By: Time Add events for Instructions and Cycles only Select Deferred Recording Mode in Global Options Open the Clock App (noting the moving second hand - i.e. App is active) In Instruments select the clock app as the target process to monitor Click record for 10s+ In Instruments select exactly a 10s region (to show counter values for this exact 10s period of the clock app) This capture is 1ms Sampling based capture. In Recording Options -> select High Frequency Sampling Click record for 10s+ In Instruments select exactly a 10s region (to show counter values for this exact 10s period of the clock app) This capture is based on 100us Sampling based capture. Instruments reports the following on my M1 Macbook: Without High Frequency Sampling Clock App - Samples = 127, Total Instructions ~= 4M, Total Cycles ~= 23.6M With High Frequency Sampling Clock App - Samples = 940, Total Instructions ~= 33.5M, Total Cycles ~= 122.7M As you can see there is a huge delta between the numbers with the same app running and only difference is the sampling speed setting. Can you help me to understand why there is a big difference and if there is an accurate way to capture the actual number of Instructions and Cycles being used by an App (in this case Clock app as an example)?
Replies
Boosts
Views
Activity
Apr ’23