On 11/16/15 5:12 PM, Arnaldo Carvalho de Melo wrote:
Em Mon, Nov 16, 2015 at 01:08:15PM -0500, Frank Ch. Eigler escreveu:
Olga.Kornievskaia wrote:

[...] say there are two tracepoints ?foobar_enter? and
?foobar_exit?. Each tracepoint logs a timestamp. I?d like to be able
to say that on average it takes that many time-units between ?enter?
and ?exit? tracepoints. [...]

For completeness, a complete systemtap implementation of this could look like:

# stap -e '
    global s, t%
    probe kernel.trace("foobar_enter") {
        t[tid()]=gettimeofday_us()
    }
    probe kernel.trace("foobar_exit") {
        if (tid() in t) { s <<< gettimeofday_us() - t[tid()] }
    }
    probe timer.s(5),end {
        printf("cumulative average us: %d\n", @avg(s))
    }
'

Is that done syncronously?

Interesting solution. How does it scale with CPUs and tasks?

--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to