perf tools: Reorganize some structs to save space
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 5 Apr 2010 15:53:45 +0000 (12:53 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 8 Apr 2010 14:34:26 +0000 (11:34 -0300)
Using 'pahole --packable' I found some structs that could be reorganized
to eliminate alignment holes, in some cases getting them to be cacheline
multiples.

[acme@doppio linux-2.6-tip]$ codiff perf.old ~/bin/perf
builtin-annotate.c:
  struct perf_session    |   -8
  struct perf_header     |   -8
 2 structs changed

builtin-diff.c:
  struct sample_data         |   -8
 1 struct changed
  diff__process_sample_event |   -8
 1 function changed, 8 bytes removed, diff: -8

builtin-sched.c:
  struct sched_atom      |   -8
 1 struct changed

builtin-timechart.c:
  struct per_pid         |   -8
 1 struct changed
  cmd_timechart          |  -16
 1 function changed, 16 bytes removed, diff: -16

builtin-probe.c:
  struct perf_probe_point |   -8
  struct perf_probe_event |   -8
 2 structs changed
  opt_add_probe_event     |   -3
 1 function changed, 3 bytes removed, diff: -3

util/probe-finder.c:
  struct probe_finder      |   -8
 1 struct changed
  find_kprobe_trace_events |  -16
 1 function changed, 16 bytes removed, diff: -16

/home/acme/bin/perf:
 4 functions changed, 43 bytes removed, diff: -43
[acme@doppio linux-2.6-tip]$

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: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-sched.c
tools/perf/builtin-timechart.c
tools/perf/util/event.h
tools/perf/util/header.h
tools/perf/util/probe-event.h
tools/perf/util/probe-finder.h

index 4f5a03e43444ef2b9f02551557aae18dddf9ace7..5e59c0c40c4068e67b74afcca7a5f264b7efdd11 100644 (file)
@@ -68,10 +68,10 @@ enum sched_event_type {
 
 struct sched_atom {
        enum sched_event_type   type;
+       int                     specific_wait;
        u64                     timestamp;
        u64                     duration;
        unsigned long           nr;
-       int                     specific_wait;
        sem_t                   *wait_sem;
        struct task_desc        *wakee;
 };
index 266e7aa996d3932ea22273d967302fd326c5724c..369c1b490a9e257ded1a4838dc59eaf45c924ba4 100644 (file)
@@ -77,8 +77,6 @@ struct per_pid {
 
        struct per_pidcomm *all;
        struct per_pidcomm *current;
-
-       int painted;
 };
 
 
index a33b94952e34ee122d6183648ac1a4af00272e1c..7f7cf8539cfeb96557388e0c652dea6292eb61f2 100644 (file)
@@ -68,11 +68,11 @@ struct sample_data {
        u64 addr;
        u64 id;
        u64 stream_id;
-       u32 cpu;
        u64 period;
-       struct ip_callchain *callchain;
+       u32 cpu;
        u32 raw_size;
        void *raw_data;
+       struct ip_callchain *callchain;
 };
 
 #define BUILD_ID_SIZE 20
index 82a6af72d4ccd7d1bac9d80d7e0fd7b2d0751a32..c059f08cf87720db0c442ae20cd24da1b0816dfa 100644 (file)
@@ -47,13 +47,13 @@ int perf_file_header__read(struct perf_file_header *self,
 struct perf_header {
        int                     frozen;
        int                     attrs, size;
+       bool                    needs_swap;
        struct perf_header_attr **attr;
        s64                     attr_offset;
        u64                     data_offset;
        u64                     data_size;
        u64                     event_offset;
        u64                     event_size;
-       bool                    needs_swap;
        DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
 };
 
index cd308b0a4d96ebd1cdc6fae1b54b92fd32d063fe..9d99fc24c4fcd995eb45a53d501df22046fca878 100644 (file)
@@ -40,9 +40,9 @@ struct perf_probe_point {
        char            *file;          /* File path */
        char            *function;      /* Function name */
        int             line;           /* Line number */
+       bool            retprobe;       /* Return probe flag */
        char            *lazy_line;     /* Lazy matching pattern */
        unsigned long   offset;         /* Offset from function entry */
-       bool            retprobe;       /* Return probe flag */
 };
 
 /* Perf probe probing argument field chain */
index 3564f22954f1b18ddbd667ba33db29c16f988450..2a271321944f30f1afdfc9f81003072b66e71d03 100644 (file)
@@ -31,13 +31,13 @@ extern int find_line_range(int fd, struct line_range *lr);
 
 struct probe_finder {
        struct perf_probe_event *pev;           /* Target probe event */
-       int                     ntevs;          /* number of trace events */
        struct kprobe_trace_event *tevs;        /* Result trace events */
+       int                     ntevs;          /* number of trace events */
 
        /* For function searching */
+       int                     lno;            /* Line number */
        Dwarf_Addr              addr;           /* Address */
        const char              *fname;         /* Real file name */
-       int                     lno;            /* Line number */
        Dwarf_Die               cu_die;         /* Current CU */
        struct list_head        lcache;         /* Line cache for lazy match */