Skip to content

Commit

Permalink
perf annotate browser: Compact 'nop' output
Browse files Browse the repository at this point in the history
Just suppress the nop operands, future infrastructure that will record
the instruction lenght (and its contents) in struct ins will allow
rendering them as nopN, i.e. nop5 for a 5-byte nop.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-qddbeglfzqdlal8vj2yaj67y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Arnaldo Carvalho de Melo committed May 7, 2012
1 parent 5417072 commit b9818e9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tools/perf/util/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ bool ins__is_jump(const struct ins *ins)
return ins->ops == &jump_ops;
}

static int nop__scnprintf(struct ins *ins __used, char *bf, size_t size,
struct ins_operands *ops __used)
{
return scnprintf(bf, size, "%-6.6s", "nop");
}

static struct ins_ops nop_ops = {
.scnprintf = nop__scnprintf,
};

/*
* Must be sorted by name!
*/
Expand Down Expand Up @@ -154,6 +164,9 @@ static struct ins instructions[] = {
{ .name = "jrcxz", .ops = &jump_ops, },
{ .name = "js", .ops = &jump_ops, },
{ .name = "jz", .ops = &jump_ops, },
{ .name = "nop", .ops = &nop_ops, },
{ .name = "nopl", .ops = &nop_ops, },
{ .name = "nopw", .ops = &nop_ops, },
};

static int ins__cmp(const void *name, const void *insp)
Expand Down

0 comments on commit b9818e9

Please sign in to comment.