locktrace Command

Purpose

Controls kernel lock tracing.

Syntax

locktrace [ -r ClassName | -s ClassName | -S | -R | -l ]

Description

The locktrace command controls which kernel locks are being traced by the trace subsystem. The default is to trace none. If the machine has been rebooted after running the bosboot -L command, kernel lock tracing can be turned on or off for one or more individual lock classes, or for all lock classes. If bosboot -L was not run, lock tracing can only be turned on for all locks or none. The trace events collected in this case when locks are taken or missed (hook id 112), and released (hook id 113) do not have the lock class name available.

Flags

Item Description
-r classname Turns off lock tracing for all kernel locks belonging to the specified class. The option always fails if you did not run the bosboot -L command.
-s classname Turns on lock tracing for all kernel locks belonging to the specified class. The option always fails if you did not run the bosboot -L command. To trace several specific classes at the same time, run the locktrace command multiple times, with a specific lock class each time. You can enter up to 32 class names.
-R Turns off all lock tracing.
-S Turns on lock tracing for all locks regardless of their class membership.
-l Lists kernel lock tracing current status.

Examples

  1. To start tracing the SEM_LOCK_CLASS, enter the following command:
    locktrace -s SEM_LOCK_CLASS
  2. To stop all lock tracing, enter the following command:
    locktrace -R
  3. To reset previous lock trace entries and then trace the SEM_LOCK_CLASS and SHM_LOCK_CLASS lock classes, enter the following commands:
    locktrace -R 
    locktrace -s SEM_LOCK_CLASS
    locktrace -s SHM_LOCK_CLASS
    You can view current lock classes using the -l flag:
    locktrace -l
    The following output will be displayed:
    lock tracing enabled for classes:
      SHM_LOCK_CLASS
      SEM_LOCK_CLASS

File

Item Description
/usr/bin/locktrace Contains the locktrace command.
/usr/include/sys/lockname.h Contains the lock class names.