Think Different

这篇内容是对那些与众不同、敢于挑战现状的人们的致敬。他们或许被视为疯子,但正是这些人的疯狂想法和执着精神,改变了世界,推动了人类的进步。

向那些疯狂的家伙们致敬。
那些我行我素的家伙。
那些桀骜不驯的家伙。
那些惹事生非的家伙。
那些方孔中的圆桩。
他们总是异想天开,
既不喜欢循规蹈矩,
也不尊重既成事实。
你尽可以赞美他们,否定他们,引用他们,
质疑他们,颂扬抑或是诋毁他们。
不过惟独不能漠视他们。
因为他们进行着变革。
他们推动着人类的进程。
他们是别人眼里的疯子,
却是我们眼中的天才。
因为,只有疯狂到认为
自己能够改变世界的人,
才能真正做到这一点。

Here’s to the crazy ones.
The misfits.
The rebels.
The troublemakers.
The round pegs in the square holes.
The ones who see things differently.
They’re not fond of rules.
And they have no respect for the status quo.
You can quote them, disagree with them, glorify or vilify them.
About the only thing you can’t do is ignore them.
Because they change things.
They push the human race forward.
And while some see them as the crazy ones,
We see genius.
Because the people who are crazy enough to think
they can change the world,
Are the ones who do.

5. Event filtering ================== Trace events can be filtered in the kernel by associating boolean 'filter expressions' with them. As soon as an event is logged into the trace buffer, its fields are checked against the filter expression associated with that event type. An event with field values that 'match' the filter will appear in the trace output, and an event whose values don't match will be discarded. An event with no filter associated with it matches everything, and is the default when no filter has been set for an event. 5.1 Expression syntax --------------------- A filter expression consists of one or more 'predicates' that can be combined using the logical operators '&&' and '||'. A predicate is simply a clause that compares the value of a field contained within a logged event with a constant value and returns either 0 or 1 depending on whether the field value matched (1) or didn't match (0): field-name relational-operator value Parentheses can be used to provide arbitrary logical groupings and double-quotes can be used to prevent the shell from interpreting operators as shell metacharacters. The field-names available for use in filters can be found in the 'format' files for trace events (see section 4). The relational-operators depend on the type of the field being tested: The operators available for numeric fields are: ==, !=, <, <=, >, >=, & And for string fields they are: ==, !=, ~ The glob (~) accepts a wild card character (*,?) and character classes ([). For example: prev_comm ~ "*sh" prev_comm ~ "sh*" prev_comm ~ "*sh*" prev_comm ~ "ba*sh" 5.2 Setting filters ------------------- A filter for an individual event is set by writing a filter expression to the 'filter' file for the given event. For example: # cd /sys/kernel/debug/tracing/events/sched/sched_wakeup # echo "common_preempt_count > 4" > filter A slightly more involved example: # cd /sys/kernel/debug/tracing/events/signal/signal_generate # echo "((sig >= 10 && sig < 15) || sig == 17) && comm != bash" > filter If there is an error in the expression, you'll get an 'Invalid argument' error when setting it, and the erroneous string along with an error message can be seen by looking at the filter e.g.: # cd /sys/kernel/debug/tracing/events/signal/signal_generate # echo "((sig >= 10 && sig < 15) || dsig == 17) && comm != bash" > filter -bash: echo: write error: Invalid argument # cat filter ((sig >= 10 && sig < 15) || dsig == 17) && comm != bash ^ parse_error: Field not found Currently the caret ('^') for an error always appears at the beginning of the filter string; the error message should still be useful though even without more accurate position info. 5.3 Clearing filters -------------------- To clear the filter for an event, write a '0' to the event's filter file. To clear the filters for all events in a subsystem, write a '0' to the subsystem's filter file. 5.3 Subsystem filters --------------------- For convenience, filters for every event in a subsystem can be set or cleared as a group by writing a filter expression into the filter file at the root of the subsystem. Note however, that if a filter for any event within the subsystem lacks a field specified in the subsystem filter, or if the filter can't be applied for any other reason, the filter for that event will retain its previous setting. This can result in an unintended mixture of filters which could lead to confusing (to the user who might think different filters are in effect) trace output. Only filters that reference just the common fields can be guaranteed to propagate successfully to all events. Here are a few subsystem filter examples that also illustrate the above points: Clear the filters on all events in the sched subsystem: # cd /sys/kernel/debug/tracing/events/sched # echo 0 > filter # cat sched_switch/filter none # cat sched_wakeup/filter none Set a filter using only common fields for all events in the sched subsystem (all events end up with the same filter): # cd /sys/kernel/debug/tracing/events/sched # echo common_pid == 0 > filter # cat sched_switch/filter common_pid == 0 # cat sched_wakeup/filter common_pid == 0 Attempt to set a filter using a non-common field for all events in the sched subsystem (all events but those that have a prev_pid field retain their old filters): # cd /sys/kernel/debug/tracing/events/sched # echo prev_pid == 0 > filter # cat sched_switch/filter prev_pid == 0 # cat sched_wakeup/filter common_pid == 0 5.4 PID filtering ----------------- The set_event_pid file in the same directory as the top events directory exists, will filter all events from tracing any task that does not have the PID listed in the set_event_pid file. # cd /sys/kernel/debug/tracing # echo $$ > set_event_pid # echo 1 > events/enabled Will only trace events for the current task. To add more PIDs without losing the PIDs already included, use '>>'. # echo 123 244 1 >> set_event_pid全部翻译
07-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值