[PATCH 04/10] perf sort: Align cpu column to right

From: Namhyung Kim
Date: Thu Dec 27 2012 - 04:14:31 EST


From: Namhyung Kim <namhyung.kim@xxxxxxx>

Since cpu number is a natural number, it'd be more appropriate
aligning it to right.

Before:

# Overhead CPU Command: Pid Shared Object
# ........ ... ................. .....................
#
8.91% 8 gnome-shell: 1497 perf-1497.map
8.90% 7 gnome-shell: 1497 perf-1497.map
8.86% 9 gnome-shell: 1497 perf-1497.map
8.83% 6 gnome-shell: 1497 perf-1497.map
8.81% 10 gnome-shell: 1497 perf-1497.map
7.44% 5 gnome-shell: 1497 perf-1497.map
6.20% 3 gnome-shell: 1497 perf-1497.map
5.10% 0 gnome-shell: 1497 perf-1497.map

After:

# Overhead CPU Command: Pid Shared Object
# ........ ... ................. .....................
#
8.91% 8 gnome-shell: 1497 perf-1497.map
8.90% 7 gnome-shell: 1497 perf-1497.map
8.86% 9 gnome-shell: 1497 perf-1497.map
8.83% 6 gnome-shell: 1497 perf-1497.map
8.81% 10 gnome-shell: 1497 perf-1497.map
7.44% 5 gnome-shell: 1497 perf-1497.map
6.20% 3 gnome-shell: 1497 perf-1497.map
5.10% 0 gnome-shell: 1497 perf-1497.map

Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/util/sort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 8b6d70bd749b..a36051b34901 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -331,7 +331,7 @@ sort__cpu_cmp(struct hist_entry *left, struct hist_entry *right)
static int hist_entry__cpu_snprintf(struct hist_entry *self, char *bf,
size_t size, unsigned int width)
{
- return repsep_snprintf(bf, size, "%-*d", width, self->cpu);
+ return repsep_snprintf(bf, size, "%*d", width, self->cpu);
}

struct sort_entry sort_cpu = {
--
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/