Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1208363 > unrolled thread

Announcing simple-pt -- a simple Processor Trace implementation for Linux

Started byAndi Kleen <andi@firstfloor.org>
First post2015-08-17 06:40 +0200
Last post2015-08-17 20:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Announcing simple-pt -- a simple Processor Trace implementation for  Linux Andi Kleen <andi@firstfloor.org> - 2015-08-17 06:40 +0200
    Re: Announcing simple-pt -- a simple Processor Trace implementation  for Linux Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-17 15:10 +0200
      Re: Announcing simple-pt -- a simple Processor Trace implementation  for Linux Andi Kleen <andi@firstfloor.org> - 2015-08-17 20:30 +0200

#1208363 — Announcing simple-pt -- a simple Processor Trace implementation for Linux

FromAndi Kleen <andi@firstfloor.org>
Date2015-08-17 06:40 +0200
SubjectAnnouncing simple-pt -- a simple Processor Trace implementation for Linux
Message-ID<pYkng-55o-25@gated-at.bofh.it>
Modern Intel Core CPUs (5th and 6th generation) have a Intel Processor Trace (PT) feature
to trace branch execution with low overhead. This is useful for performance analysis and debugging.

simple-pt is a simple standalone driver and decoder tool to implement PT on Linux.

Starting with Linux 4.1 Linux has an integrated PT implementation in perf
(see https://lwn.net/Articles/648154/).
simple-pt is an alternative implementation. It has many disadvantages over the perf PT
implementation, such as:
- needs to run as root
- no long term tracing or sampling with interrupts
- no support for interactive debugging (use gdb 7.10 on perf for that)
- no support for histograms
- somewhat experimental
- not as well supported as perf

On the positive side simple-pt is:
- simple
- standalone. No kernel changes needed. Could be ported to older kernels or other operating systems
- easy to modify and experiment with
- more ftrace like decoding tool
- support for kprobes based triggers
- modular “unix style” design with simple tools that do only one thing each
- BSD licensed

Example output:


        % sptcmd  -c tcall taskset -c 0 ./tcall
        cpu   0 offset 1027688,  1003 KB, writing to ptout.0
        ...
        Wrote sideband to ptout.sideband
        % sptdecode --sideband ptout.sideband --pt ptout.0 | less
        TIME      DELTA  INSNs   OPERATION
        frequency 32
        0        [+0]     [+   1] _dl_aux_init+436
                          [+   6] __libc_start_main+455 -> _dl_discover_osversion
        ...
                          [+  13] __libc_start_main+446 -> main
                          [+   9]     main+22 -> f1
                          [+   4]             f1+9 -> f2
                          [+   2]             f1+19 -> f2
                          [+   5]     main+22 -> f1
                          [+   4]             f1+9 -> f2
                          [+   2]             f1+19 -> f2
                          [+   5]     main+22 -> f1
        ...

Available from https://github.com/andikleen/simple-pt

-- 
ak@linux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1208575 — Re: Announcing simple-pt -- a simple Processor Trace implementation for Linux

FromFrederic Weisbecker <fweisbec@gmail.com>
Date2015-08-17 15:10 +0200
SubjectRe: Announcing simple-pt -- a simple Processor Trace implementation for Linux
Message-ID<pYskP-8di-25@gated-at.bofh.it>
In reply to#1208363
2015-08-17 6:31 GMT+02:00 Andi Kleen <andi@firstfloor.org>:
>
> Modern Intel Core CPUs (5th and 6th generation) have a Intel Processor Trace (PT) feature
> to trace branch execution with low overhead. This is useful for performance analysis and debugging.
>
> simple-pt is a simple standalone driver and decoder tool to implement PT on Linux.
>
> Starting with Linux 4.1 Linux has an integrated PT implementation in perf
> (see https://lwn.net/Articles/648154/).
> simple-pt is an alternative implementation. It has many disadvantages over the perf PT
> implementation, such as:
> - needs to run as root
> - no long term tracing or sampling with interrupts
> - no support for interactive debugging (use gdb 7.10 on perf for that)
> - no support for histograms
> - somewhat experimental
> - not as well supported as perf
>
> On the positive side simple-pt is:
> - simple
> - standalone. No kernel changes needed. Could be ported to older kernels or other operating systems
> - easy to modify and experiment with
> - more ftrace like decoding tool
> - support for kprobes based triggers
> - modular “unix style” design with simple tools that do only one thing each
> - BSD licensed
>
> Example output:
>
>
>         % sptcmd  -c tcall taskset -c 0 ./tcall
>         cpu   0 offset 1027688,  1003 KB, writing to ptout.0
>         ...
>         Wrote sideband to ptout.sideband
>         % sptdecode --sideband ptout.sideband --pt ptout.0 | less
>         TIME      DELTA  INSNs   OPERATION
>         frequency 32
>         0        [+0]     [+   1] _dl_aux_init+436
>                           [+   6] __libc_start_main+455 -> _dl_discover_osversion
>         ...
>                           [+  13] __libc_start_main+446 -> main
>                           [+   9]     main+22 -> f1
>                           [+   4]             f1+9 -> f2
>                           [+   2]             f1+19 -> f2
>                           [+   5]     main+22 -> f1
>                           [+   4]             f1+9 -> f2
>                           [+   2]             f1+19 -> f2
>                           [+   5]     main+22 -> f1

Nice. So I guess +x is the address offset. How hard would it be to
translate to file lines?

Thanks.

>         ...
>
> Available from https://github.com/andikleen/simple-pt
>
> --
> ak@linux.intel.com -- Speaking for myself only.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1208774 — Re: Announcing simple-pt -- a simple Processor Trace implementation for Linux

FromAndi Kleen <andi@firstfloor.org>
Date2015-08-17 20:30 +0200
SubjectRe: Announcing simple-pt -- a simple Processor Trace implementation for Linux
Message-ID<pYxkt-6Ss-3@gated-at.bofh.it>
In reply to#1208575
> >         % sptdecode --sideband ptout.sideband --pt ptout.0 | less
> >         TIME      DELTA  INSNs   OPERATION
> >         frequency 32
> >         0        [+0]     [+   1] _dl_aux_init+436
> >                           [+   6] __libc_start_main+455 -> _dl_discover_osversion
> >         ...
> >                           [+  13] __libc_start_main+446 -> main
> >                           [+   9]     main+22 -> f1
> >                           [+   4]             f1+9 -> f2
> >                           [+   2]             f1+19 -> f2
> >                           [+   5]     main+22 -> f1
> >                           [+   4]             f1+9 -> f2
> >                           [+   2]             f1+19 -> f2
> >                           [+   5]     main+22 -> f1
> 
> Nice. So I guess +x is the address offset. How hard would it be to
> translate to file lines?

Yes it's the address offset. Translating to lines wouldn't be too hard,
just needs to be implemented with a dwarf reader.

BTW the PT trace has all branches, just not the calls, but it's more
difficult to display them all in a nice way.

-Andi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web