public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
To: <a.p.zijlstra@chello.nl>, <paulus@samba.org>,
	Ingo Molnar <mingo@redhat.com>, <acme@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: question regarding -D flag in perf stat
Date: Wed, 14 Jan 2015 16:50:44 -0600	[thread overview]
Message-ID: <54B6F2C4.20701@amd.com> (raw)

Hi all,

I had a question regarding the intention of the -D flag after looking at 
perf stat numbers of the following workload:

main(){

int a=5, b=6;

int i;

#pragma omp for schedule(dynamic)

for (i=0; i<10000000; i++){

b=b+a;

}

return 0;

}

_Stats without delay:_

# perf stat -e cycles,instructions,cpu-clock,task-clock ../../test/a.out

Performance counter stats for '../../test/a.out':

    203,581,363,567 cycles #    1.500 GHz

      7,563,983,198 instructions #    0.04  insns per cycle

      135721.617844 cpu-clock (msec)

      135721.600586 task-clock (msec) # *5.985 CPUs utilized*

       22.678577620 seconds time elapsed (run time)

_Stats with delay of 10 seconds:_

# perf stat -D 10000 -e cycles,instructions,cpu-clock,task-clock 
../../test/a.out

b=363264281

Performance counter stats for '../../test/a.out':

    112,134,813,161 cycles #    1.500 GHz

      4,461,136,761 instructions #    0.04  insns per cycle

       74757.386789 cpu-clock (msec)

       74757.317781 task-clock (msec) # *3.324 CPUs utilized*

22.490237094 seconds time elapsed**(run time)*(delay time is not 
excluded here)*

The issue is that CPU utilization is calculated as 
task-clock/total-runtime which in the case of no delay is fine.
But for the delay case, the total run time should exclude the delay 
time. Right?
(and as a consequence, utilization would be calculated exclusive of the 
delay time which would give us CPU utilization only for the period 
during which perf actually collects info)

Or is this the way -D flag is intended to work?

Thanks for the clarifications,
-Aravind.

                 reply	other threads:[~2015-01-14 22:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54B6F2C4.20701@amd.com \
    --to=aravind.gopalakrishnan@amd.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox