systemtap_with_examples
  • Introduction
  • Installation
    • Build systap from source
    • Build package from source
  • Systemtap Language
    • Syntax
    • Variables
    • Control Flow
    • Function & Macro
    • TypeCase
    • Guru Mode
    • Probe Point
    • Predefined Functions
  • Examples
    • Call Graph
    • Dump Stack Trace
    • Duration
    • CPU Performance
    • Network DEV Analysis
    • KVM MMU
  • Reference
Powered by GitBook
On this page

Was this helpful?

  1. Examples

Duration

Here is an example to measure duration of a function call.

global time
probe vfs.read
{
    time[tid()] = gettimeofday_ns();
}
probe vfs.read.return
{
    if(time[tid()]) {
        printf("vfs.read by %s took %d ns to execute\n",
            execname(), gettimeofday_ns() - time[tid()]);
        delete time[tid()];
        exit();
    }
}
PreviousDump Stack TraceNextCPU Performance

Last updated 6 years ago

Was this helpful?