objtool: Add a statistics mode
Have it print a few numbers which can be used to size the hashtables. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lkml.kernel.org/r/20200324160924.321381240@infradead.org
This commit is contained in:
@@ -239,6 +239,7 @@ static int decode_instructions(struct objtool_file *file)
|
||||
struct symbol *func;
|
||||
unsigned long offset;
|
||||
struct instruction *insn;
|
||||
unsigned long nr_insns = 0;
|
||||
int ret;
|
||||
|
||||
for_each_sec(file, sec) {
|
||||
@@ -274,6 +275,7 @@ static int decode_instructions(struct objtool_file *file)
|
||||
|
||||
hash_add(file->insn_hash, &insn->hash, insn->offset);
|
||||
list_add_tail(&insn->list, &file->insn_list);
|
||||
nr_insns++;
|
||||
}
|
||||
|
||||
list_for_each_entry(func, &sec->symbol_list, list) {
|
||||
@@ -291,6 +293,9 @@ static int decode_instructions(struct objtool_file *file)
|
||||
}
|
||||
}
|
||||
|
||||
if (stats)
|
||||
printf("nr_insns: %lu\n", nr_insns);
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
|
Reference in New Issue
Block a user