일반적으로 리눅스에서 작업중 튜닝이 필요할때 프로파일링 작업을 한다.
가장 일반적인 방법이 컴파일 옵션에 -pg를 주고 pgrof로 프로파일링된 내용을 보는것인데
이것과는 조금 다른 프로파일링 기법이 있어서 소개한다.
이미 많은 개발자들이 사용하고 있는 valgrind의 서브 모듈인 callgrind가 바로 그것인데
아래에 간단한 사용법을 정리하였다
실행 방법
> valgrind --tool=callgrind ./test < input.txt > /dev/null
실행된 내용은 가지고 출력 파일을 생성한다
>callgrind_annotate callgrind.out.7838 > callgrind.out.7838.txt
사용법 보기
> callgrind_annotate --help
함수별 결과보기
> callgrind_annotate --inclusive=yes callgrind.out.7842 > callgrind.out.7842.txt
호출한 함수 목록 보기
>callgrind_annotate --inclusive=yes --tree=caller callgrind.out.7842 > callgrind.out.7842.txt
>많은 정보 보기
>callgrind_annotate --inclusive=yes --tree=both --context=100 --auto=yes --threshold=10 callgrind.out.11328 > callgrind.out.11328.txt
I <- instruction
D <- data
r <- read
w <- write
l <- level n cache
m <- memory
'C언어' 카테고리의 다른 글
변수 초기화(memset) (0) | 2007.03.19 |
---|---|
TRIE에 대하여 (0) | 2007.03.19 |
유니코드 (utf-8)관련 자료 수집 (0) | 2007.03.08 |
utf8를 유니코드(uni)로 변환 (euc-kr <-> utf-8) | (0) | 2007.02.15 |
유니코드(uni) 를 utf8로 변환 (euc-kr <-> utf-8) (0) | 2006.12.07 |