2009-09-28 21:32:55 +08:00
|
|
|
#ifndef __PERF_HIST_H
|
|
|
|
#define __PERF_HIST_H
|
|
|
|
|
2009-12-14 23:10:39 +08:00
|
|
|
#include <linux/types.h>
|
2009-09-28 21:32:55 +08:00
|
|
|
#include "callchain.h"
|
|
|
|
|
|
|
|
extern struct callchain_param callchain_param;
|
|
|
|
|
2009-12-14 23:10:39 +08:00
|
|
|
struct perf_session;
|
|
|
|
struct hist_entry;
|
|
|
|
struct addr_location;
|
|
|
|
struct symbol;
|
2010-03-05 23:51:06 +08:00
|
|
|
struct rb_root;
|
2009-12-14 23:10:39 +08:00
|
|
|
|
2010-03-05 23:51:06 +08:00
|
|
|
struct hist_entry *__perf_session__add_hist_entry(struct rb_root *hists,
|
2009-12-14 23:10:39 +08:00
|
|
|
struct addr_location *al,
|
|
|
|
struct symbol *parent,
|
2010-05-10 00:02:23 +08:00
|
|
|
u64 count);
|
2009-09-28 21:32:55 +08:00
|
|
|
extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *);
|
|
|
|
extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *);
|
2010-03-31 22:33:40 +08:00
|
|
|
int hist_entry__fprintf(struct hist_entry *self,
|
2010-03-12 07:12:44 +08:00
|
|
|
struct perf_session *pair_session,
|
|
|
|
bool show_displacement,
|
|
|
|
long displacement, FILE *fp,
|
|
|
|
u64 session_total);
|
2010-03-31 22:33:40 +08:00
|
|
|
int hist_entry__snprintf(struct hist_entry *self,
|
|
|
|
char *bf, size_t size,
|
|
|
|
struct perf_session *pair_session,
|
|
|
|
bool show_displacement, long displacement,
|
|
|
|
bool color, u64 session_total);
|
2009-12-14 23:10:39 +08:00
|
|
|
void hist_entry__free(struct hist_entry *);
|
|
|
|
|
2010-03-27 08:16:22 +08:00
|
|
|
u64 perf_session__output_resort(struct rb_root *hists, u64 total_samples);
|
2010-03-05 23:51:08 +08:00
|
|
|
void perf_session__collapse_resort(struct rb_root *hists);
|
|
|
|
size_t perf_session__fprintf_hists(struct rb_root *hists,
|
perf diff: Use perf_session__fprintf_hists just like 'perf record'
That means that almost everything you can do with 'perf report'
can be done with 'perf diff', for instance:
$ perf record -f find / > /dev/null
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.062 MB perf.data (~2699
samples) ] $ perf record -f find / > /dev/null
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.062 MB perf.data (~2687
samples) ] perf diff | head -8
9.02% +1.00% find libc-2.10.1.so [.] _IO_vfprintf_internal
2.91% -1.00% find [kernel] [k] __kmalloc
2.85% -1.00% find [kernel] [k] ext4_htree_store_dirent
1.99% -1.00% find [kernel] [k] _atomic_dec_and_lock
2.44% find [kernel] [k] half_md4_transform
$
So if you want to zoom into libc:
$ perf diff --dsos libc-2.10.1.so | head -8
37.34% find [.] _IO_vfprintf_internal
10.34% find [.] __GI_memmove
8.25% +2.00% find [.] _int_malloc
5.07% -1.00% find [.] __GI_mempcpy
7.62% +2.00% find [.] _int_free
$
And if there were multiple commands using libc, it is also
possible to aggregate them all by using --sort symbol:
$ perf diff --dsos libc-2.10.1.so --sort symbol | head -8
37.34% [.] _IO_vfprintf_internal
10.34% [.] __GI_memmove
8.25% +2.00% [.] _int_malloc
5.07% -1.00% [.] __GI_mempcpy
7.62% +2.00% [.] _int_free
$
The displacement column now is off by default, to use it:
perf diff -m --dsos libc-2.10.1.so --sort symbol | head -8
37.34% [.] _IO_vfprintf_internal
10.34% [.] __GI_memmove
8.25% +2.00% [.] _int_malloc
5.07% -1.00% +2 [.] __GI_mempcpy
7.62% +2.00% -1 [.] _int_free
$
Using -t/--field-separator can be used for scripting:
$ perf diff -t, -m --dsos libc-2.10.1.so --sort symbol | head -8
37.34, , ,[.] _IO_vfprintf_internal
10.34, , ,[.] __GI_memmove
8.25,+2.00%, ,[.] _int_malloc
5.07,-1.00%, +2,[.] __GI_mempcpy
7.62,+2.00%, -1,[.] _int_free
6.99,+1.00%, -1,[.] _IO_new_file_xsputn
1.89,-2.00%, +4,[.] __readdir64
$
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260978567-550-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-12-16 23:49:27 +08:00
|
|
|
struct perf_session *pair,
|
2010-03-05 23:51:08 +08:00
|
|
|
bool show_displacement, FILE *fp,
|
|
|
|
u64 session_total);
|
2009-09-28 21:32:55 +08:00
|
|
|
#endif /* __PERF_HIST_H */
|