diff options
| author | Ingo Molnar <mingo@elte.hu> | 2010-05-15 02:39:09 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-05-15 02:39:09 -0400 |
| commit | 7ebaa2838a751125c113072486334d7b4e63f9ad (patch) | |
| tree | b0081ab2236cc11f21e27e32d0fc221a467292f0 /tools/perf/util/util.c | |
| parent | 1ff3d7d79204612ebe2e611d2592f8898908ca00 (diff) | |
| parent | 3e1bbdc3a721f4b1ed44f4554402a8dbc60fa97f (diff) | |
Merge branch 'perf' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/core
Diffstat (limited to 'tools/perf/util/util.c')
| -rw-r--r-- | tools/perf/util/util.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index f9b890fde681..214265674ddd 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
| @@ -92,3 +92,25 @@ out_close_from: | |||
| 92 | out: | 92 | out: |
| 93 | return err; | 93 | return err; |
| 94 | } | 94 | } |
| 95 | |||
| 96 | unsigned long convert_unit(unsigned long value, char *unit) | ||
| 97 | { | ||
| 98 | *unit = ' '; | ||
| 99 | |||
| 100 | if (value > 1000) { | ||
| 101 | value /= 1000; | ||
| 102 | *unit = 'K'; | ||
| 103 | } | ||
| 104 | |||
| 105 | if (value > 1000) { | ||
| 106 | value /= 1000; | ||
| 107 | *unit = 'M'; | ||
| 108 | } | ||
| 109 | |||
| 110 | if (value > 1000) { | ||
| 111 | value /= 1000; | ||
| 112 | *unit = 'G'; | ||
| 113 | } | ||
| 114 | |||
| 115 | return value; | ||
| 116 | } | ||
