우리가 이 과제를 수행하면서 가장 많이 사용하는 명령어는 Uftrace일 것이다.

Uftrace는 리눅스에서 기본으로 지원하는 함수 추적 툴인 Ftrace를 한 유저분께서 변형한 것이다.

https://github.com/namhyung/uftrace

 

GitHub - namhyung/uftrace: Function graph tracer for C/C++/Rust

Function graph tracer for C/C++/Rust. Contribute to namhyung/uftrace development by creating an account on GitHub.

github.com

 

 

함수 추적

$ sudo uftrace record [options] [command]

우리가 사용하는 옵션들 외 일부

-a: show arguments and return value of known functions

-A: show function arguments

-f: show FIELDs in the replay or graph output

-F: Only trace those FUNCs

-k: Trace kernel functions also(if supported)

-K: Trace kernel functions within DEPTH

-N: Don't trace those FUNCs

-R: Show function return values

-t: Hide small functions run less than the TIME

-v: Print debug messages

 

추적 결과 출력

$ ufrace replay [options]

원한다면 tui를 이용하는 등 다양한 방법으로 볼 수 있다. 나는 주로 파이프라이닝을 통해 결과를 텍스트 파일로 저장하여 분석한다.

 

 

+ Recent posts