Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - tracing of kernel events: accessing event data with dynamic filtering: (3 Items)
   
tracing of kernel events: accessing event data with dynamic filtering  
I tried to filter MMAP events with dynamic filtering. 
As I want only MMAPs with flag for physical mapping active I tried to access the MMAP data provided in the handler 
callback function.
For this I called

TraceEvent(_NTO_TRACE_ADDEVENT, _NTO_TRACE_SYSTEM, _NTO_TRACE_SYS_MMAP);
TraceEvent(_NTO_TRACE_ADDEVENTHANDLER, _NTO_TRACE_SYSTEM, _NTO_TRACE_SYS_MMAP, eh_mmap, &e_d_mmap);

The event handler is called for each MMAP event, that's fine. But when I try to access the event data, I get only one 
argument (the pid of the caller):

int eh_mmap(event_data_t* e_d_mmap)
{
	int i = 0;
	while ( i < e_d_mmap->el_num )
	{
			unsigned data = e_d_mmap->data_array[i];
			kprintf("got event 0x%x data_%d: %u\n", _NTO_TRACE_GETEVENT(e_d_mmap->header), i, data);
			i++;
	}
        return 0;
}

Output:
got event 0x6 data_0: 4118

got event 0x6 data_0: 4118

...

If I open a kerneltrace in Momentics IDE I see this data for MMAP events:
Event, Time, Owner, Type, Data
46086, 558ms 302us, procnto-smp-instr (1) Thread 14 (14), MMap, pid 4118 addr 0x9ce2000 len 69632 flags 0x84002 name  
process adl

Does anyone know how I can access the complete data for MMAP in my handler function? (I tried already wide mode for 
event tracing).
Re: tracing of kernel events: accessing event data with dynamic filtering  
Hi Thomas,

I checked and due to a bug in the handling of this event, only the pid 
is passed.

I created COREOS-73647 to track this problem.

On 2014-04-11 6:43 AM, Thomas Schickentanz wrote:
> I tried to filter MMAP events with dynamic filtering.
> As I want only MMAPs with flag for physical mapping active I tried to access the MMAP data provided in the handler 
callback function.
> For this I called
>
> TraceEvent(_NTO_TRACE_ADDEVENT, _NTO_TRACE_SYSTEM, _NTO_TRACE_SYS_MMAP);
> TraceEvent(_NTO_TRACE_ADDEVENTHANDLER, _NTO_TRACE_SYSTEM, _NTO_TRACE_SYS_MMAP, eh_mmap, &e_d_mmap);
>
> The event handler is called for each MMAP event, that's fine. But when I try to access the event data, I get only one 
argument (the pid of the caller):
>
> int eh_mmap(event_data_t* e_d_mmap)
> {
> 	int i = 0;
> 	while ( i < e_d_mmap->el_num )
> 	{
> 			unsigned data = e_d_mmap->data_array[i];
> 			kprintf("got event 0x%x data_%d: %u\n", _NTO_TRACE_GETEVENT(e_d_mmap->header), i, data);
> 			i++;
> 	}
>          return 0;
> }
>
> Output:
> got event 0x6 data_0: 4118
>
> got event 0x6 data_0: 4118
>
> ...
>
> If I open a kerneltrace in Momentics IDE I see this data for MMAP events:
> Event, Time, Owner, Type, Data
> 46086, 558ms 302us, procnto-smp-instr (1) Thread 14 (14), MMap, pid 4118 addr 0x9ce2000 len 69632 flags 0x84002 name  
process adl
>
> Does anyone know how I can access the complete data for MMAP in my handler function? (I tried already wide mode for 
event tracing).
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post109893
> To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com

Re: tracing of kernel events: accessing event data with dynamic filtering  
Hi Colin,

Thanks for the update!

Tried first preload library with mmap wrapper but did not work for some of our processes. Thus I think dynamic filtering
 is another option for tracing specified mmap callls (like tr_lite tool for thread states).
Well, I shift my tool "mmap_tracer" to hibernate mode until mmap arguments are available in callback function.