28.5. 지정된 이벤트에 대한 통계 가져오기
perf stat 명령을 사용하여 특정 이벤트를 볼 수 있습니다.
절차
perf stat기능을 사용하여 컨텍스트 전환 수를 확인합니다.# perf stat -e context-switches -a sleep 5 Performance counter stats for 'sleep 5': 15,619 context-switches 5.002060064 seconds time elapsed결과는 5초, 15619 컨텍스트 전환이 발생했음을 보여줍니다.
스크립트를 실행하여 파일 시스템 활동을 봅니다. 다음은 예제 스크립트입니다.
# for i in {1..100}; do touch /tmp/$i; sleep 1; done다른 터미널에서
perf stat명령을 실행합니다.# perf stat -e ext4:ext4_request_inode -a sleep 5 Performance counter stats for 'sleep 5': 5 ext4:ext4_request_inode 5.002253620 seconds time elapsed결과는 스크립트에서 5개의 파일을 생성하도록 요청하여 5개의
inode요청이 있음을 나타내는 메시지를 표시한 것으로 표시됩니다.