mac에서 사용되는 파일 (Xcode13 버전)

맥에 구축된 코드에 프로필을 사용하려면 리눅스에서 표준으로 사용하는 gprof를 사용할 수 없습니다.clang은 원래 -pg 옵션이 없습니다.
따라서 이전 버전의 맥에서는 iprofiiler라는 명령을 사용하여 프로필을 가져올 수 있습니다 Xcode13에서는 추천하지 않습니다.
(참조: https://apple.stackexchange.com/questions/415563/repeatedly-being-asked-to-install-command-line-tools
2021년 최신 Xcode13에서 사용할 수 있는 프로필xcrun, xctrace 사용 명령을 받아야 합니다.
사용 방법은 다음과 같다.
$ xcrun xctrace record --template 'Time Profiler' --launch -- ./a.out
실행 후 Launch_a.out_2021-12-21... 이런 디렉터리를 만들기 때문에 오픈 명령으로 이 디렉터리를 열면 Instruments에서 설정 파일을 볼 수 있습니다.
image.png
Time Profiller, Allocations, CPU Profile 등 template의 매개 변수로 사용할 수 있으며 Instruments가 새로 제작될 때 나타나는 대화상자에서 확인할 수 있습니다.
그러나 대부분의 용도는 Time Profile을 사용할 수 있습니다.

더 자세한 사용 방법은 다음 명령을 실행하면 도움이 될 것입니다.
$ xcrun xctrace record
One of the following options is required: --all-processes, --launch -- command [arguments], --attach <pid|name>
usage: xctrace record [<options>] [--attach | --all-processes | --launch -- command ]

description:
    Perform a new recording on the specified device and target with the given template

options:
    --output <path>                        Output .trace file to the given path
    --append-run                           Appends a new run to an existing trace file
    --template <path|name>                 Record using given trace template name or path
...
참고 자료
- https://qiita.com/yohm/items/450fbae1ee0aebe1261e
- https://qiita.com/yohm/items/24e7859f18b1bedcad65

좋은 웹페이지 즐겨찾기