通过kprobe在测量函数执行的时间

[root@localhost ~]# cd /sys/kernel/debug/tracing/
[root@localhost tracing]# ls
README                      current_tracer         hwlat_detector   printk_formats         set_ftrace_filter       stack_max_size      trace_marker         tracing_thresh
available_events            dyn_ftrace_total_info  instances        saved_cmdlines         set_ftrace_notrace      stack_trace         trace_marker_raw     uprobe_events
available_filter_functions  dynamic_events         kprobe_events    saved_cmdlines_size    set_ftrace_notrace_pid  stack_trace_filter  trace_options        uprobe_profile
available_tracers           enabled_functions      kprobe_profile   saved_tgids            set_ftrace_pid          synthetic_events    trace_pipe
buffer_percent              error_log              max_graph_depth  set_event              set_graph_function      timestamp_mode      tracing_cpumask
buffer_size_kb              events                 options          set_event_notrace_pid  set_graph_notrace       trace               tracing_max_latency
buffer_total_size_kb        free_buffer            per_cpu          set_event_pid          snapshot                trace_clock         tracing_on
[root@localhost tracing]# echo "p intel_get_link_ksettings" > kprobe_events
[root@localhost tracing]# echo "r intel_get_link_ksettings" >> kprobe_events
[root@localhost tracing]# echo 1 > events/kprobes/p_intel_get_link_ksettings_0/enable
[root@localhost tracing]# echo 1 > events/kprobes/r_intel_get_link_ksettings_0/enable
[root@localhost tracing]# ethtool -i enp189s0f0
driver: intel
version: 5.10.0-rc3-next-20201113tao
firmware-version: 1.9.29.16
expansion-rom-version:
bus-info: 0000:bd:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
[root@localhost tracing]# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0   #P:128
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
[root@localhost tracing]# ethtool -i enp189s0f0
driver: intel
version: 5.10.0-rc3-next-20201113tao
firmware-version: 1.9.29.16
expansion-rom-version:
bus-info: 0000:bd:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
[root@localhost tracing]# ethtool  enp189s0f0
Settings for enp189s0f0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full
        Link partner advertised pause frame use: No
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Current message level: 0x00000036 (54)
                               probe link ifdown ifup
        Link detected: yes
[root@localhost tracing]# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 2/2   #P:128
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
           <...>-63374   [066] d..1 529518.895323: p_intel_get_link_ksettings_0: (intel_get_link_ksettings+0x0/0x188 [intel])
           <...>-63374   [066] ...1 529518.895336: r_intel_get_link_ksettings_0: (ethtool_get_link_ksettings+0x1d0/0x240 <- intel_get_link_ksettings)
[root@localhost tracing]#

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值