TraceEvent() question

(QNX 6.3 SP1)

I’m using TraceEvent(_NTO_TRACE_ADDCLASSEVHANDLER, _NTO_TRACE_THREAD, …)
and it’s not quite clear to me from the docs how event_data_t.data_array
is used.

Is data_array used only by user-defined code? Can I set it to NULL if
I don’t use it?

Hello Angela

What I’ve been told is that data_array is what the event handler
receives the data in. Exactly how much of it is used is related to the
type of event. It is crucial that this is defined and that it is large
enough to handle the data that is passed into the appropriate event
handler for that event.

So judging from that, I think that it can’t be NULL because it must be
there to hold data, regardless if you are going to use the data or not.

Thanks,
Rodney


Angela_Lin@ca.ibm.com wrote:

(QNX 6.3 SP1)

I’m using TraceEvent(_NTO_TRACE_ADDCLASSEVHANDLER, _NTO_TRACE_THREAD, …)
and it’s not quite clear to me from the docs how event_data_t.data_array
is used.

Is data_array used only by user-defined code? Can I set it to NULL if
I don’t use it?

Hi Angela,

The same data that would be logged in the trace log is copied into the data_array.

So, for example, Thread state changes events have a PID and a TID (and in wide mode they have PRIORITY and POLICY)
so 4 words will be used.

The array must be big enough to hold the largest event that you could possibly be handling.

Otherwise your data segment will be corrupted, since there is no limit check done when copying the data.

There are no event handlers for user events, so you don’t need to worry about that.

The longest events are typically the process create name events.

Angela_Lin@ca.ibm.com wrote:

(QNX 6.3 SP1)

I’m using TraceEvent(_NTO_TRACE_ADDCLASSEVHANDLER, _NTO_TRACE_THREAD, …)
and it’s not quite clear to me from the docs how event_data_t.data_array
is used.

Is data_array used only by user-defined code? Can I set it to NULL if
I don’t use it?

Thanks.

I can’t seem to find a complete table of the event data arguments in the
docs.
(The table in the SAT Appendix covers only kernel calls.)

Nevertheless, I’m using fast mode, so I suppose I’m covered as long as
data_array is
at least as big as an event buffer slot (16 bytes)?

That’s because there isn’t a complete table. Only the kernel calls are doc’d (I should PR that!)

The payload of a simple event is two words, so the smallest data_array usage will be 8 bytes.
The largest will be at least 34 words (136 bytes) ( that’s the largest proc_create_name event )

Cheers,

Colin

Angela_Lin@ca.ibm.com wrote:

Thanks.

I can’t seem to find a complete table of the event data arguments in the
docs.
(The table in the SAT Appendix covers only kernel calls.)

Nevertheless, I’m using fast mode, so I suppose I’m covered as long as
data_array is
at least as big as an event buffer slot (16 bytes)?

I was under the impression that, in fast mode, all events are simple
events.
Is that not correct? Does the event handler function still get passed
full combine events?

cburgess@qnx.com wrote:

That’s because there isn’t a complete table. Only the kernel calls are
doc’d (I should PR that!)

The payload of a simple event is two words, so the smallest data_array
usage will be 8 bytes.
The largest will be at least 34 words (136 bytes) ( that’s the largest
proc_create_name event )

Cheers,

Colin

Angela_Lin@ca.ibm.com > wrote:
Thanks.

I can’t seem to find a complete table of the event data arguments in
the
docs.
(The table in the SAT Appendix covers only kernel calls.)

Nevertheless, I’m using fast mode, so I suppose I’m covered as long as

data_array is
at least as big as an event buffer slot (16 bytes)?

In fast mode, MOST events will be simple, but definately not all…

Yes, the event handler gets passed the buffer before it is split up into
simple events.

Angela_Lin@ca.ibm.com wrote:

I was under the impression that, in fast mode, all events are simple
events.
Is that not correct? Does the event handler function still get passed
full combine events?

cburgess@qnx.com > wrote:

That’s because there isn’t a complete table. Only the kernel calls are

doc’d (I should PR that!)

The payload of a simple event is two words, so the smallest data_array

usage will be 8 bytes.

The largest will be at least 34 words (136 bytes) ( that’s the largest

proc_create_name event )

Cheers,

Colin

Angela_Lin@ca.ibm.com > wrote:

Thanks.

I can’t seem to find a complete table of the event data arguments in

the

docs.
(The table in the SAT Appendix covers only kernel calls.)

Nevertheless, I’m using fast mode, so I suppose I’m covered as long as


data_array is
at least as big as an event buffer slot (16 bytes)?