2011-01-27 4 views

답변

2

Do Core i3/5/7 CPUs provide a mechanism to measure IPC?에 대한 내 대답을보고 모니터 이름을 사용하여 IPC를 계산하십시오. pebs 사용과 pfmon의 2 실점이 있습니다

pfmon --smpl-module=pebs -ecpu_clk_unhalted --inv=1 --counter-mask=1 --long-smpl-periods=2660000 -uk -- foo 

pfmon --smpl-module=pebs -einstructions_retired --inv=1 --counter-mask=1 --long-smpl-periods=2660000 -uk -- foo 

:

은 예, IPC의 대략적인 값을 얻을 수 pfmon/pebs을 사용하는 것이 가능하다. 그들은 전체 programm 및 각 함수에 대한 instructions_retired 및 cpu_clk_unhalted 샘플 수의 비율을 제공합니다.

PEBS는 2660000 번째 이벤트 (위의 pfmon 실행)가있을 때마다 샘플을 제공합니다. pfmon이 시작되면 특수한 msr 레지스터에서 성능 이벤트를 카운트하도록 CPU에 요청합니다. CPU는 프로세스에 대한 이벤트를 계산하고 OS는 context_switch에 다른 프로세스의 MSR을 저장합니다. 또한 pfmon은 이벤트 카운터의 값이> 2660000 이상일 때 예외를 주도록 CPU에 요청합니다. 예외가 발생하면 pfmon은 현재 명령어의 EIP를 기록하고 함수 이름으로 변환하고 성능 모니터를 재설정합니다.

IPC의 계산은 리눅스 커널 perf 도구 매우 간단 PS

: https://perf.wiki.kernel.org/index.php/Tutorial

프로세스 별 :

perf stat -B -ecycles:u,instructions:u dd if=/dev/zero of=/dev/null count=2000000 

2000000+0 records in 
2000000+0 records out 
1024000000 bytes (1.0 GB) copied, 1.91559 s, 535 MB/s 

Performance counter stats for 'dd if=/dev/zero of=/dev/null count=2000000': 

    1,993,541,603 cycles 
     764,086,803 instructions    #  0.383 IPC 

     1.916930613 seconds time elapsed 

시스템 전체 (-a 스위치)

perf stat -B -ecycles:u,instructions:u -a sleep 5 

Performance counter stats for 'sleep 5': 

     766,271,289 cycles 
     596,796,091 instructions    #  0.779 IPC 

     5.001191353 seconds time elapsed 
+0

이 vtune 지침입니까? Windows 또는 Linux에서이 기능을 사용할 수 있습니까? –

+0

이것은 정확한 이벤트 기반 샘플링 (PEBS) 모드의 Linux에서 pfmon입니다. http://perfmon2.sourceforge.net/ – osgx

관련 문제