OSDN Git Service

perf tools: Add new perf_atoll() function to parse string representing size in bytes
authorHitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Sun, 15 Nov 2009 11:36:53 +0000 (20:36 +0900)
committerIngo Molnar <mingo@elte.hu>
Sun, 15 Nov 2009 13:54:23 +0000 (14:54 +0100)
commitd2fb8b4151a92223da6a84006f8f248ebeb6677d
treea25e75e2338f6b678de94b8a5b24a77104f01a02
parent0ffa798d947f5f5e40690cc9d38e678080a34f87
perf tools: Add new perf_atoll() function to parse string representing size in bytes

This patch modifies util/string.[ch] to add new function:
perf_atoll() to parse string representing size in bytes.

This function parses (\d+)(b|B|kb|KB|mb|MB|gb|GB) (e.g. "256MB")
and returns its numeric value. (e.g. 268435456)

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1258285013-4759-1-git-send-email-mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/util/string.c
tools/perf/util/string.h