Skip to content
  • Tom Zanussi's avatar
    tracing/filters: a better event parser · 8b372562
    Tom Zanussi authored
    
    
    Replace the current event parser hack with a better one.  Filters are
    no longer specified predicate by predicate, but all at once and can
    use parens and any of the following operators:
    
    numeric fields:
    
    ==, !=, <, <=, >, >=
    
    string fields:
    
    ==, !=
    
    predicates can be combined with the logical operators:
    
    &&, ||
    
    examples:
    
    "common_preempt_count > 4" > filter
    
    "((sig >= 10 && sig < 15) || sig == 17) && comm != bash" > filter
    
    If there was an error, the erroneous string along with an error
    message can be seen by looking at the filter e.g.:
    
    ((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; a real position should be used, but the error message
    should be useful even without it.
    
    To clear a filter, '0' can be written to the filter file.
    
    Filters can also be set or cleared for a complete subsystem by writing
    the same filter as would be written to an individual event to the
    filter file at the root of the subsytem.  Note however, that if any
    event in the subsystem lacks a field specified in the filter being
    set, the set will fail and all filters in the subsytem are
    automatically cleared.  This change from the previous version was made
    because using only the fields that happen to exist for a given event
    would most likely result in a meaningless filter.
    
    Because the logical operators are now implemented as predicates, the
    maximum number of predicates in a filter was increased from 8 to 16.
    
    [ Impact: add new, extended trace-filter implementation ]
    
    Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
    Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    Cc: fweisbec@gmail.com
    Cc: Li Zefan <lizf@cn.fujitsu.com>
    LKML-Reference: <1240905899.6416.121.camel@tropicana>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    8b372562