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>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
994a1f78b1
commit
27050f530d
@@ -361,3 +361,28 @@ int parse_nsec_time(const char *str, u64 *ptime)
|
||||
*ptime = time_sec * NSEC_PER_SEC + time_nsec;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long parse_tag_value(const char *str, struct parse_tag *tags)
|
||||
{
|
||||
struct parse_tag *i = tags;
|
||||
|
||||
while (i->tag) {
|
||||
char *s;
|
||||
|
||||
s = strchr(str, i->tag);
|
||||
if (s) {
|
||||
unsigned long int value;
|
||||
char *endptr;
|
||||
|
||||
value = strtoul(str, &endptr, 10);
|
||||
if (s != endptr)
|
||||
break;
|
||||
|
||||
value *= i->mult;
|
||||
return value;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return (unsigned long) -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user