1global tracing
2
3function basename:string(path:string)
4{
5    last_token = token = tokenize(path, "/");
6    while (token != "") {
7        last_token = token;
8        token = tokenize("", "/");
9    }
10    return last_token;
11}
12
13probe process.mark("function__entry")
14{
15    funcname = user_string($arg2);
16
17    if (funcname == "start") {
18        tracing = 1;
19    }
20}
21
22probe process.mark("function__entry"), process.mark("function__return")
23{
24    filename = user_string($arg1);
25    funcname = user_string($arg2);
26    lineno = $arg3;
27
28    if (tracing) {
29        printf("%d\t%s:%s:%s:%d\n", gettimeofday_us(), $$name,
30               basename(filename), funcname, lineno);
31    }
32}
33
34probe process.mark("function__return")
35{
36    funcname = user_string($arg2);
37
38    if (funcname == "start") {
39        tracing = 0;
40    }
41}
42