diff options
author | Jiri Olsa <jolsa@redhat.com> | 2013-09-01 06:36:13 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-09 10:24:20 -0400 |
commit | 27050f530dc4fd88dc93d85c177e000efe970d12 (patch) | |
tree | 2d73d0b265fb05f74c2dfb00a83ee0241c736097 /tools/perf/util/util.c | |
parent | 994a1f78b191df0c9d6caca3f3afb03e247aff26 (diff) |
perf tools: Add possibility to specify mmap size
Adding possibility to specify mmap size via -m/--mmap-pages
by appending unit size character (B/K/M/G) to the
number, like:
$ perf record -m 8K ls
$ perf record -m 2M ls
The size is rounded up appropriately to follow perf
mmap restrictions.
If no unit is specified the number provides pages as
of now, like:
$ perf record -m 8 ls
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1378031796-17892-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/util.c')
-rw-r--r-- | tools/perf/util/util.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index ccfdeb62f576..ab71d6216803 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -361,3 +361,28 @@ int parse_nsec_time(const char *str, u64 *ptime) | |||
361 | *ptime = time_sec * NSEC_PER_SEC + time_nsec; | 361 | *ptime = time_sec * NSEC_PER_SEC + time_nsec; |
362 | return 0; | 362 | return 0; |
363 | } | 363 | } |
364 | |||
365 | unsigned long parse_tag_value(const char *str, struct parse_tag *tags) | ||
366 | { | ||
367 | struct parse_tag *i = tags; | ||
368 | |||
369 | while (i->tag) { | ||
370 | char *s; | ||
371 | |||
372 | s = strchr(str, i->tag); | ||
373 | if (s) { | ||
374 | unsigned long int value; | ||
375 | char *endptr; | ||
376 | |||
377 | value = strtoul(str, &endptr, 10); | ||
378 | if (s != endptr) | ||
379 | break; | ||
380 | |||
381 | value *= i->mult; | ||
382 | return value; | ||
383 | } | ||
384 | i++; | ||
385 | } | ||
386 | |||
387 | return (unsigned long) -1; | ||
388 | } | ||