Topic
4 replies Latest Post - ‏2012-11-30T20:58:43Z by HB63_Chetan_Harsh
HB63_Chetan_Harsh
HB63_Chetan_Harsh
3 Posts
ACCEPTED ANSWER

Pinned topic Quantify reporting high cycles on sleep

‏2012-11-30T19:50:22Z |
Hi,

I have recently profiled my C/C++ application using quantify and the report looks puzzling to me.
The top 2 functions function time, % of root has:
sleep and another application function which is blocked on a read API on a pipe.

I would assume that neither sleep API nor a blocking read on a pipe/socket should result in CPU cycles.

Am I interpreting this data incorrectly? Help appreciated!

Thanks.
Updated on 2012-11-30T20:58:43Z at 2012-11-30T20:58:43Z by HB63_Chetan_Harsh
  • SystemAdmin
    SystemAdmin
    2948 Posts
    ACCEPTED ANSWER

    Re: Quantify reporting high cycles on sleep

    ‏2012-11-30T20:05:09Z  in response to HB63_Chetan_Harsh
    Hi Chetan,

    Without knowing the OS you're on and the exact system calls being used,
    I can only provide a general answer --- but here goes. In general,
    Quantify DOES measure system call time and will convert that measured
    time into some number of machine cycles. However, there are APIs and
    Quantify options which allow you to ignore system call time if desired.
    (e.g., you can use the -record-system-calls=no option on Linux/UNIX.)

    You can also avoid timing of specific operating system calls rather than
    ignore ALL system calls. (If you're on Linux/UNIX, search the online
    help for -avoid-recording-system-calls. You'll also notice that there
    is a "default list" of system calls that are ignored, and this may not
    include the system call that you're actually using.)

    Hope that helps explain what you're seeing,
    Don
  • HB63_Chetan_Harsh
    HB63_Chetan_Harsh
    3 Posts
    ACCEPTED ANSWER

    Re: Quantify reporting high cycles on sleep

    ‏2012-11-30T20:16:43Z  in response to HB63_Chetan_Harsh
    Thanks Don for quick reply.
    I'm using quantify 7.0.1.0-002 on RHEL 5.7 (32bit) OS.

    Your explanation does make sense, and to reiterate and verify that I understand this correct - the cycles reported against sleep() doesn't really indicate CPU usage, but is just perceived cycle (quantify converted the time spent into equivalent number of cycles).

    Correct?
    • SystemAdmin
      SystemAdmin
      2948 Posts
      ACCEPTED ANSWER

      Re: Quantify reporting high cycles on sleep

      ‏2012-11-30T20:30:01Z  in response to HB63_Chetan_Harsh
      Hi Chetan,

      That's correct. When Quantify is executing "your code", it
      actually looks at every instruction being executed and it
      attributes a number of machine cycles to each instruction
      being executed. When it comes to system calls, Quantify
      measures the time spent executing the system call and then
      converts that into machine cycles just so we have some common
      unit of measurement for computational purposes.

      You can use the -measure-timed-calls option to control HOW
      system calls are measured.

      Cheers,
      Don