Linux?????????perf??ü??
???????????? ???????[ 2013/9/3 16:08:08 ] ????????
????????????
????The column 'Overhead' indicates the percentage of the overall samples collected in the corresponding function. The second column reports the process from which the samples were collected. In per-thread/per-process mode?? this is always the name of the monitored command. But in cpu-wide mode?? the command can vary. The third column shows the name of the ELF image where the samples came from. If a program is dynamically linked?? then this may show the name of a shared library. When the samples come from the kernel?? then the pseudo ELF image name [kernel.kallsyms] is used. The fourth column indicates the privilege level at which the sample was taken?? i.e. when the program was running when it was interrupted:
????[.] : user level
????[k]: kernel level
????[g]: guest kernel level (virtualization)
????[u]: guest os user space
????[H]: hypervisor
????The final column shows the symbol name.
??????????????????????t1 ?????е? foo1() ???????????????????????? 100 ?????????? longa() ??????????????????????????? foo1 ?? foo2??????????????????????
???????????????д????????????н???????仨???? string ?????????????string ?? C++ ??????????????д???? STL ??????????????????????????????й?????? string ?????????????????????ù???????????????????
??????? perf ?? -g ???????????????????
????perf record -g -e cpu-clock ./test1
????perf report
???????????????????ж?λ?????????????н????
????perf record????????????
????-f?????????????.data????
????-c??????????count?β??????
????-p?????????
????-t????????
????4.2 perf report??????????
????-k?????δ?????????????????????????????????
????--report??cpu????cpu?г?????
????5.???tracepoint
?????? perf ???? tick ??????в???????????????????????е? hot spot??????????????? tracepoint ?????????
??????????????? tracepoint ?????????????????????????????????????????Щ???????????????????????????????????????顣???????????????????????????????????????????ó??????????????????????
????????????????????????????????????????????????ó?????????便?????????????????á????????????
???????????? ls ????????? sys_enter ??? tracepoint ??????
[root@ovispoly /]# perf stat -e raw_syscalls:sys_enter ls
bin dbg etc lib media opt root
selinux sys usr
boot dev home lost+found mnt proc sbin srv
tmp var
Performance counter stats for 'ls':
101 raw_syscalls:sys_enter
0.003434730 seconds time elapsed
[root@ovispoly /]# perf record -e raw_syscalls:sys_enter ls
[root@ovispoly /]# perf report
Failed to open .lib/ld-2.12.so?? continuing without symbols
# Samples: 70
#
# Overhead Command Shared Object Symbol
# ........ ............... ............... ......
#
97.14% ls ld-2.12.so [.] 0x0000000001629d
2.86% ls [vdso] [.] 0x00000000421424
#
# (For a higher level overview?? try: perf report --sort comm??dso)
#
????????????????????? ls ????????????????????? ( ???????? 101 ?? )?????????????????????Щ??? (97% ???????? ld-2.12.so ?? )??
??????????????棬??????????????????????????????純?? foo() ?з???????????????????????????????а???????????Щ????????????á?
???????????? strace ?????????????鰡?????????????????????????????? strace ?????? perf ???????Щ?????????????????? -e ????????????
???????? tracepoint ????????????????????????????????????? tracepoint ??????????????????????????????????????????????ò????????顣
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11