Differences between revisions 1 and 2
Revision 1 as of 2008-01-11 16:49:28
Size: 1086
Editor: DavidSmith
Comment:
Revision 2 as of 2008-01-11 16:53:18
Size: 1256
Editor: DavidSmith
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
A marker placed in code provides a hook to call a function (probe) that you can provide at runtime. A marker can be "on" (a probe is connected to it) or "off" (no probe is attached). When a marker is "off" it has no effect, except for adding a tiny time penalty (checking a condition for a branch) and space penalty (adding a few bytes for the function call at the end of the instrumented function and adds a data structure in a separate section). When a marker is "on", the function you provide is called each time the marker is executed, in the execution context of the caller. When the function provided ends its execution, it returns to the caller (continuing from the marker site).  . A marker placed in code provides a hook to call a function (probe) that you can provide at runtime. A marker can be "on" (a probe is connected to it) or "off" (no probe is attached). When a marker is "off" it has no effect, except for adding a tiny time penalty (checking a condition for a branch) and space penalty (adding a few bytes for the function call at the end of the instrumented function and adds a data structure in a separate section). When a marker is "on", the function you provide is called each time the marker is executed, in the execution context of the caller. When the function provided ends its execution, it returns to the caller (continuing from the marker site).
 . . You can put markers at important locations in the code. Markers are lightweight hooks that can pass an arbitrary number of parameters, described in a printk-like format string, to the attached probe function.
 . . They can be used for tracing and performance accounting.
Line 7: Line 9:
You can put markers at important locations in the code. Markers are lightweight hooks that can pass an arbitrary number of parameters, described in a printk-like format string, to the attached probe function.

They can be used for tracing and performance accounting.
== What does a marker in kernel code look like? ==
#include <linux/marker.h>
trace_mark(subsystem_event, "integer %d string %s", 123, "example string");

Using Markers

What are markers?

Here is some text taken from the kernel documentation that describes markers:

  • A marker placed in code provides a hook to call a function (probe) that you can provide at runtime. A marker can be "on" (a probe is connected to it) or "off" (no probe is attached). When a marker is "off" it has no effect, except for adding a tiny time penalty (checking a condition for a branch) and space penalty (adding a few bytes for the function call at the end of the instrumented function and adds a data structure in a separate section). When a marker is "on", the function you provide is called each time the marker is executed, in the execution context of the caller. When the function provided ends its execution, it returns to the caller (continuing from the marker site).
  • . You can put markers at important locations in the code. Markers are lightweight hooks that can pass an arbitrary number of parameters, described in a printk-like format string, to the attached probe function.
  • . They can be used for tracing and performance accounting.

What does a marker in kernel code look like?

#include <linux/marker.h> trace_mark(subsystem_event, "integer %d string %s", 123, "example string");

None: UsingMarkers (last edited 2009-02-21 01:51:00 by JoshStone)