0

I would like to profile a code flow in kernel in order to understand where is the bottleneck. I found that function profiler does just that for me: https://lwn.net/Articles/370423/ Unfortunately the output I see doesn't make sense to me. From the link above, the output of the function profiler is:

 Function        Hit        Time              Avg
--------          ---       ----              ---   
schedule         22943    1994458706 us     86931.03 us

Where "Time" is the total time spend inside this function during the run. So if I have function_A that calls function_B, if I understood the output correctly, the "Time" measured for function_A includes the duration of function_B as well.

When I actualy run this on my pc I see another new column displayed for the output:

Function           Hit     Time          Avg          s^2   
--------           ---     ----          ---          ---           
__do_page_fault    3077   477270.5us    155.109 us  148746.9us
(more functions..)

What does s^2 stand for? It cant be standratd deviation because it's higher then the average...

I measured the total duration of this code flow from user space and got 400 ms. When summing up the s^2 column it came close to 400 ms. Which makes me think that perhaps is the "pure" time spent in __do_page_fault, that doest include the duration of the nested functions.

Is this correct? I didn't find any documentation of the s^2 column so I'm hesitant regarding my conclusions.

Thank you!

1 Answers1

0

You can see the code that calculates the s^2 column here. It seems like this is the variance (standard deviation squared). If you take the root out of the number in your example, you get 385 us, which is closer to the average in the example.

The standard deviation is still greater than the mean, but that is fine.

haggai_e
  • 4,689
  • 1
  • 24
  • 37