Events and the Kernel

http://qnx.com/developers/docs/7.1/index.html#com.qnx.doc.sat/topic/events.html

qnx 内核产生内核事件

  • kernel calls
  • scheduling activity
  • interrupt handling
  • thread/process creation, destruction, and state changes

In addition, the instrumented kernel also inserts “artificial” events for:

  • time events
  • user events that may be used as “marker flags

Kernel Buffer Management

Each buffer is of a fixed size and is divided into a fixed number of slots:

  • Event buffer slots per buffer: 1024
  • Event buffer slot size: 16 bytes
  • Buffer size: 16 KB

简单的内核事件一个slot 够了,组合复杂事件需要多个slot 保存

当一个buffer 满了,proc-to 就会发生_NTO_HOOK_TRACE synthetic interrupt通知data-capture 程序读准备好可以取数据

 To ensure this never happens, the instrumented kernel requests a buffer flush at the high-water mark.

The high-water mark is set at an efficient, yet conservative, level:

  • around 70% (_TRACEBUF_MAX_EVENTS) for linear mode
  • around 95% (_TRACEBUF_MAX_EVENTS_RING) for ring mode

由于中断里不能保存buffer ,因此系统在buffer填充达到一个水位就产生中断通知取数据

Capturing Trace Data

抓事件程序与内核交互,将内核发送事件保存到文件系统,抓取配置

  • buffer allocations (size)
  • which events and classes of events to log (filtering)
  • whether to log the events in wide mode or fast mode

抓取程序:

You can control the capture of data via qconn (under the control of the IDE), tracelogger (from the command line), or directly from your application. All three approaches use the TraceEvent() function to control the instrumented kernel:

tracelogger 抓取模式

ModeOptionThe kernel:tracelogger:
Continuous-cLogs eventsCaptures the events, and continues to do so until terminated
Daemon-d1Doesn't log eventsaWaits passivelya
Iterations (the default)-nLogs eventsCaptures num_buffers of data and then terminates
Ring-rLogs eventsDoesn't capture events until it gets a SIGINT signal, or an application calls TraceEvent()b with a command of _NTO_TRACE_STOP
Time-based-sLogs eventsCaptures events for the specified number of seconds

By default, the instrumented kernel and tracelogger collect data in fast mode; to switch to wide mode, specify the -w option when you start tracelogger

By default, tracelogger captures all events from all classes, but you can disable the tracing of events from the classes as follows

To disable this class:Specify:
Kernel calls-F1
Interrupt-F2
Process-F3
Thread-F4
Virtual thread-F5
Communication-F6
System-F7

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值