Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Kernel trace : setup static filters to trace only specific processes: (3 Items)
   
Kernel trace : setup static filters to trace only specific processes  
Hello QNX Developers,

I need to setup kernel trace filters so only communication messages emitted by specific processes are recorded. I 
followed QNX documentation and wrote little helper util, but eventually tracing is performed only for the last process 
specified.

The core functionality of this util is based on following TraceEvent() call :
	TraceEvent(_NTO_TRACE_SETCLASSPID, int class, pid_t pid)

Usecase

1) Execute tracelogger : tracelogger -d1 -s 10 -f trace_mcd_`date -t`.kev
2) In another console, get required process ids :  pidin -f "aA" | grep -i  -E "eide|mcd|any_other"
3) Start tracing : ./mcd_event_filter 1 2 3
   
Note that in case of tracelogger is not running, setting filters will (legally) fail : ./mcd_event_filter: line:109 
function call TraceEvent() failed, errno(47): Operation canceled

Expected results :
 - kernel trace for communication messages (and other trace classes) caused by all these processes is enabled

Current behavior : 
- kernel trace only for the last (!) PID specified is available 

Could you please point me what`s wrong with this idea/util ? 

Is it possible to implement such filter without resorting to dynamic filtering ?

See attached source for the mentioned code.

Thank you!
Attachment: Text mcd_event_filter.cc 5.27 KB
Re: Kernel trace : setup static filters to trace only specific processes  
Hi Konstantin,

You will have to use dynamic filtering, the static pid filter is limited 
to one pid.

On 12-02-24 5:23 AM, Konstantin V wrote:
> Hello QNX Developers,
>
> I need to setup kernel trace filters so only communication messages emitted by specific processes are recorded. I 
followed QNX documentation and wrote little helper util, but eventually tracing is performed only for the last process 
specified.
>
> The core functionality of this util is based on following TraceEvent() call :
> 	TraceEvent(_NTO_TRACE_SETCLASSPID, int class, pid_t pid)
>
> Usecase
>
> 1) Execute tracelogger : tracelogger -d1 -s 10 -f trace_mcd_`date -t`.kev
> 2) In another console, get required process ids :  pidin -f "aA" | grep -i  -E "eide|mcd|any_other"
> 3) Start tracing : ./mcd_event_filter 1 2 3
>
> Note that in case of tracelogger is not running, setting filters will (legally) fail : ./mcd_event_filter: line:109 
function call TraceEvent() failed, errno(47): Operation canceled
>
> Expected results :
>   - kernel trace for communication messages (and other trace classes) caused by all these processes is enabled
>
> Current behavior :
> - kernel trace only for the last (!) PID specified is available
>
> Could you please point me what`s wrong with this idea/util ?
>
> Is it possible to implement such filter without resorting to dynamic filtering ?
>
> See attached source for the mentioned code.
>
> Thank you!
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post91763

-- 
cburgess@qnx.com
Re: Kernel trace : setup static filters to trace only specific processes  
Hello Colin,

It`s quite a pity.
Anyway, now it is clear, thank you!