MacOs下面没有这个perf命令,但有类似的,也是非常方便,它就是 Instruments, 是xcode自带一个性能分析和自动化测试的工具。需要安装Xcode.以下是使用例子, 进行耗时的profile。
Instruments -t "Time Profiler" ./stm32flash -m 8n1 -b 115200 -w xx.hex -S 0x000c00:9000 -v /dev/tty.usbserial-14520
Instruments Trace Complete: instrumentscli0.trace
打开结果,使用open即可,就会打开图形界面,你就可以进行分析。
open instrumentscli0.trace