Using KernelShark to Analyze NI Linux Real-Time Trace Files

Updated Aug 21, 2026

Environment

Operating System

  • LabVIEW Real-Time (NI Linux Real-Time)

Other

  • KernelShark

KernelShark is a graphical trace analysis tool that allows engineers to inspect scheduling, interrupts, timers, and kernel activity recorded using Linux ftrace. It provides a timeline view and an event list that can be used to understand task execution and identify performance issues in NI Linux Real-Time systems.

This document introduces the basic workflow for opening, navigating, and filtering traces in KernelShark. Interpretation of specific troubleshooting scenarios (CPU contention, lock contention, interrupt-driven execution, etc.) is covered in the NI Linux RT Trace Interpretation Framework

Before using KernelShark, ensure that:

 

Opening a Trace

To open a trace file, follow the steps outlined below:

  1. Launch KernelShark.
  2. Select File >> Open Trace File.

This image shows how to open a trace file in KernelShark 

  1. Browse to the trace.dat file.
  2. Wait for the trace database to finish loading.

Once loaded, KernelShark will display two main areas: Graph and Event.

Understanding the User Interface

As mentioned before, the user interface is composed of the following elements:

  • Graph Area

Displays the information of the tasks executed per CPU or it can also show the data of a given task. Additionally, it also has a control area that can be used to navigate across the different plots.

The image shows the grap area presented in KernelShark

 The control area offers the following options:

This image explains the different buttons that are part of the control area

It also contains marker buttons that can be used to place up to two markers on the graph (or the event list). This feature can be used for calculating the time difference between two events. The result is displayed in the AB Delta section in seconds.

 

  • Event Area (List View)

It contains every recorded trace event in chronological order.

This image shows the event area of the user interface in KernelShark

Each entry includes:

    • CPU: the CPU that the event occurred on.
    • Timestamp: the timestamp of the event in seconds.
    • Task name: the name of the process that was running when the event occurred. Note: Linux may refer to tasks as threads or processes.
    • Process ID (PID): identifier for the process that was running.
    • Latency: shows the kernel execution state when each trace event occurred. It indicates whether interrupts were disabled, a reschedule was pending, the CPU was handling an interrupt, or preemption was disabled. For more details refer to the KernelShark documentation
    • Event: the name of the event that occurred when the process ran.
    • Event-specific information (Info): the data output of a particular event.

Additionally, you can use the Search section to look for a specific process or event.

Filtering

Considering the amount of data that can be captured in a trace file, KernelShark contains filters for both tasks and events, that can be used to display the most significant information for your investigation. To access the filters, navigate to the Filter menu on the toolbar.

This image displays where the Filter menu is on the toolbar

You can select a filter from the following options:

 

  • Show events. This option will display a dialog box with a list of events that are contained in the trace file. Here, you can select which events you want to visualize in KernelShark.

This image shows what happens when the Show Events filter is selected

 

  • Show tasks. This option will open the Tasks filter dialog box, from which one or multiple tasks can be selected.

This image displays the result of selecting the show tasks filter

 

  • Show CPUs. Use this option to open the CPU filter dialog box. If your system contains more than one CPU core, use this filter to display only the events and tasks that were captured for the specific CPU you selected.

 

This image shows the result of selecting Show CPUs as the filter option

It is important to mention that you can apply multiple filters to the trace file and create a custom advanced filter.

 

Common Tracepoints

When analyzing trace files in KernelShark, you may find the following common events or tracepoints:

 

TracepointPurpose
sched_switchCPU switches from one task to another
sched_wakeupTask becomes runnable
sched_wakingWake-up process initiated
timer/hrtimer_startHigh-resolution timer armed
timer/hrtimer_expire_entryHigh-resolution timer expires
irq_handler_entryHardware interrupt handler begins
irq_handler_exitHardware interrupt handler ends
softirq_entrySoftware interrupt processing begins
softirq_exitSoftware interrupt processing ends
futex_waitThread waits on synchronization object
futex_wakeWaiting thread is awakened
sys_enter_ioctlDevice/driver control request
sys_enter_recvmsgNetwork receive request
sys_enter_pollWait for I/O or file-descriptor events
sys_exit_clock_nanosleepProcess has exited a sleep state. This event is common in Timed Loops, when they begin running an iteration 
sys_enter_clock_nanosleepProcess has entered a sleep state. This event is common in Timed Loops, when they finish executing the logic that has been placed inside of them as part of the current iteration.