Introduction

KernelShark is a front end reader of trace-cmd output. "trace-cmd record" and "trace-cmd extract" create a trace.dat file. kernelshark can read this file and produce a graph and list view of its data.

Source Code

(Build binaries from this tree as it has latest updates available as compared to the binaries installed from apt-get for example)

Tutorials

Common Trace Events

Here is a list of common trace events which can be useful while reading trace logs.

(Mostly copied from include/trace/events/ directory)

Timer Subsystem

timer_init

Called when the timer is initialized.

timer_start

Called when the timer is Started.

timer_expire_entry

Called immediately before the timer callback. Allows to determine timer latency.

timer_expire_exit

Called immediately after the timer callback returns. When used in combination with the timer_expire_entry tracepoint we can determine the runtime of the timer callback function.

timer_cancel

Called when the timer is canceled. This gets called before timer_expire_entry tracepoint as well via detach_expired_timer().

hrtimer_init

Called when the hrtimer is initialized.

hrtimer_start

Called when the hrtimer is started.

hrtimer_expire_entry

Called immediately before the hrtimer callback. Allows to determine the timer latency.

hrtimer_expire_exit

Called immediately after the hrtimer callback returns. When used in combination with the hrtimer_expire_entry tracepoint we can determine the runtime of the callback function.

hrtimer_cancel

Called when the hrtimer is canceled. This gets called before hrtimer_expire_entry tracepoint as well via debug_deactivate().

IRQ Subsystem

irq_handler_entry

Called immediately before the irq action handler. The struct irqaction pointed to by @action contains various information about the handler, including the device name, @action->name, and the device id, @action->dev_id. When used in conjunction with the irq_handler_exit tracepoint, we can figure out irq handler latencies.

irq_handler_exit

Called immediately after the irq action handler returns. If the @ret value is set to IRQ_HANDLED, then we know that the corresponding @action->handle scuccessully handled this irq. Otherwise, the irq might be a shared irq line, or the irq was not handled successfully. Can be used in conjunction with the irq_handler_entry to understand irq handler latencies.

softirq_entry

Called immediately before the softirq handler. When used in combination with the softirq_exit tracepoint we can determine the softirq handler runtine.

softirq_exit

Called immediately after the softirq handler returns. When used in combination with the softirq_entry tracepoint we can determine the softirq handler runtine.

softirq_raise

Called immediately when a softirq is raised. When used in combination with the softirq_entry tracepoint we can determine the softirq raise to run latency.

Scheduler

sched_kthread_stop

Tracepoint at the beginning of kthread_stop, performed to end a kthread.

sched_kthread_stop_ret

Tracepoint at the end of kthread_stop.

sched_switch

Tracepoint for task switches, performed by the scheduler.

sched_migrate_task

Tracepoint for a task being migrated.

sched_process_wait

Tracepoint for a waiting task.

sched_process_fork

Tracepoint for do_fork.

sched_process_exec

Tracepoint for exec.

sched_pi_setprio

Tracepoint for showing priority inheritance modifying a tasks priority.

sched_wakeup

Tracepoint at beginning of marking a task runnable and performing wakeup-preemption.

sched_wakeup_new

Tracepoint for waking up a newly created task for the first time.

sched_process_free

Tracepoint for freeing a task.

sched_process_exit

Tracepoint for a task exiting.

sched_wait_task

Tracepoint for waiting on task to unschedule.

sched_stat_wait

Tracepoint for accounting wait time (time the task is runnable but not actually running due to scheduler contention).

sched_stat_sleep

Tracepoint for accounting sleep time (time the task is not runnable, including iowait, see below).

sched_stat_iowait

Tracepoint for accounting iowait time (time the task is not runnable due to waiting on IO to complete).

sched_stat_blocked

Tracepoint for accounting blocked time (time the task is in uninterruptible).

sched_stat_runtime

Tracepoint for accounting runtime (Time the task is executing on a CPU).

sched_pi_setprio

Tracepoint for showing priority inheritance modifying a tasks priority.

sched_process_hang

Workqueue Subsystem

workqueue_queue_work

Called when a work gets queued. This event occurs when a work is queued immediately or once a delayed work is actually queued on a workqueue (ie: once the delay has been reached).

workqueue_activate_work

Called when a work gets activated. This event occurs when a queued work is put on the active queue, which happens immediately after queueing unless @max_active limit is reached.

workqueue_execute_start

Called immediately before the workqueue callback. Allows to track workqueue execution.

workqueue_execute_end

Called immediately after the workqueue callback.

WorkingGroups/PowerManagement/Resources/Tools/KernelShark (last modified 2013-12-03 06:01:39)