Messages in this thread | | | Date | Wed, 14 Jan 2015 16:50:44 -0600 | From | Aravind Gopalakrishnan <> | Subject | question regarding -D flag in perf stat |
| |
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.
| |