有没有办法根据网络接口名称(例如:eth1 或 eth2)过滤掉 trace-cmd 报告?
当我尝试在 trace-cmd 报告过滤器中使用“名称”作为 EVENT_FIELD 时,我什么也得不到。
以下是我使用的命令
[prap4test]$trace-cmd report -F 'net/netif_receive_skb:name=="eth1"'
version = 6
cpus=2
[prap4test]$
但我能够使用“len”作为 EVENT_FIELD
[prap4test]$trace-cmd report -F 'net/netif_receive_skb'
version = 6
cpus=2
trace-cmd-19979 [000] 499726.602505: netif_receive_skb: dev=eth2 skbaddr=0xffff8800e9bb0e00 len=84
sshd-21184 [000] 499726.603209: netif_receive_skb: dev=eth1 skbaddr=0xffff8800e9bb0f00 len=52
trace-cmd-19978 [000] 499727.809932: netif_receive_skb: dev=eth2 skbaddr=0xffff8800e9bb5000 len=46
trace-cmd-19979 [001] 499728.105372: netif_receive_skb: dev=eth2 skbaddr=0xffff8800e753cc00 len=328
trace-cmd-19978 [000] 499728.780571: netif_receive_skb: dev=eth1 skbaddr=0xffff8800e9bb0700 len=100
[prap4test]$trace-cmd report -F 'net/netif_receive_skb:len >= 50'
version = 6
cpus=2
trace-cmd-19979 [000] 499726.602505: netif_receive_skb: dev=eth2 skbaddr=0xffff8800e9bb0e00 len=84
sshd-21184 [000] 499726.603209: netif_receive_skb: dev=eth1 skbaddr=0xffff8800e9bb0f00 len=52
trace-cmd-19979 [001] 499728.105372: netif_receive_skb: dev=eth2 skbaddr=0xffff8800e753cc00 len=328
trace-cmd-19978 [000] 499728.780571: netif_receive_skb: dev=eth1 skbaddr=0xffff8800e9bb0700 len=100
以下是 netif_receive_skb 的事件格式
name: netif_receive_skb
ID: 991
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:unsigned int len; offset:16; size:4; signed:0;
field:__data_loc char[] name; offset:20; size:4; signed:1;
print fmt: "dev=%s skbaddr=%p len=%u", __get_str(name), REC->skbaddr, REC->len
在 trace-cmd-report 我发现以下详细信息
Note, the EVENT_FIELD is the field name as shown by an events format
(as displayed with *--events*), and not what is found in the output.
If the output shows "ID:foo" but the field that "foo" belongs to was
called "name" in the event format, then "name" must be used in the filter.
The same is true about values. If the value that is displayed is converted
by to a string symbol, the filter checks the original value and not the
value displayed. For example, to filter on all tasks that were in the
running state at a context switch:
-F 'sched/sched_switch : prev_state==0'
Although the output displays 'R', having 'prev_stat=="R"' will not work.
所以简而言之,我想知道根据“名称”EVENT_FIELD 过滤掉的命令
在此先感谢
prap4search