[PAHOLE] In --packable show just the savings when not in verbose mode
Example: [acme@filo pahole]$ pahole -P -e examples/dccp.ko.x86_64 | sort -k2 -nr | head -20 hh_cache: 112 softnet_data: 64 task_struct: 56 net_device: 56 module: 32 inet_hashinfo: 32 zone: 24 device: 24 thread_struct: 16 super_block: 16 mm_struct: 16 dccp_sock: 16 block_device: 16 socket: 8 signal_struct: 8 sighand_struct: 8 rt6_info: 8 proto: 8 pglist_data: 8 nf_bridge_info: 8 [acme@filo pahole]$ Some may well be false positives or gcc DWARF emitter artifacts, checking... Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
This commit is contained in:
parent
ef79438fc2
commit
57ff4ea736
16
pahole.c
16
pahole.c
|
@ -158,7 +158,13 @@ static void print_classes(void (*formatter)(const struct structure *s))
|
|||
struct structure *pos;
|
||||
|
||||
list_for_each_entry(pos, &structures__list, node)
|
||||
formatter(pos);
|
||||
if (show_packable && !global_verbose) {
|
||||
const struct class *c = pos->class;
|
||||
const size_t savings = (class__size(c) -
|
||||
class__size(c->priv));
|
||||
printf("%s: %zd\n", class__name(c), savings);
|
||||
} else
|
||||
formatter(pos);
|
||||
}
|
||||
|
||||
static struct cu *cu__filter(struct cu *cu)
|
||||
|
@ -172,7 +178,7 @@ static struct cu *cu__filter(struct cu *cu)
|
|||
return cu;
|
||||
}
|
||||
|
||||
static int class__packable(const struct class *self, const struct cu *cu)
|
||||
static int class__packable(struct class *self, const struct cu *cu)
|
||||
{
|
||||
struct class *clone;
|
||||
size_t savings;
|
||||
|
@ -185,8 +191,12 @@ static int class__packable(const struct class *self, const struct cu *cu)
|
|||
return 0;
|
||||
class__reorganize(clone, cu, 0, stdout);
|
||||
savings = class__size(self) - class__size(clone);
|
||||
if (savings != 0) {
|
||||
self->priv = clone;
|
||||
return 1;
|
||||
}
|
||||
class__delete(clone);
|
||||
return savings != 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void class__dupmsg(const struct class *self, const struct cu *cu,
|
||||
|
|
Loading…
Reference in New Issue