| global serial |
| global startTime |
| global finalTime |
| global currentDepth |
| |
| |
| probe process(@1).function("*"){ |
| callFunction(probefunc()) |
| } |
| |
| probe process(@1).function("*").return{ |
| returnFunction(probefunc()) |
| } |
| |
| |
| function callFunction(probefunc) { |
| if (startTime == 0) { |
| startTime = gettimeofday_ns() |
| printf("<%s,,%d,,%d;\n", probefunc, serial, startTime) |
| } else |
| printf("<%s,,%d,,%d;\n", probefunc, serial, gettimeofday_ns()) |
| currentDepth++ |
| serial++ |
| } |
| |
| function returnFunction(probefunc) { |
| finalTime = gettimeofday_ns() |
| printf(">%s,,%d;\n", probefunc, finalTime) |
| currentDepth-- |
| } |
| |
| |
| probe end { |
| printf("-%d\n",finalTime); |
| printf("+%d\n",finalTime - startTime); |
| exit() |
| } |
| probe syscall.exit { |
| if (pid() == target()) { |
| finalTime = gettimeofday_ns() |
| } |
| } |