Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754239Ab0KERGb (ORCPT ); Fri, 5 Nov 2010 13:06:31 -0400 Received: from ns.dcl.info.waseda.ac.jp ([133.9.216.194]:60964 "EHLO ns.dcl.info.waseda.ac.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752862Ab0KERGa (ORCPT ); Fri, 5 Nov 2010 13:06:30 -0400 From: Hitoshi Mitake To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, mitake@dcl.info.waseda.ac.jp, h.mitake@gmail.com, Ma Ling , Zhao Yakui , Peter Zijlstra , Arnaldo Carvalho de Melo , Paul Mackerras , Frederic Weisbecker , Steven Rostedt , Thomas Gleixner , "H. Peter Anvin" Subject: [PATCH] perf bench: add --prefault option for causing page faults before benchmark Date: Sat, 6 Nov 2010 02:06:25 +0900 Message-Id: <1288976785-15857-1-git-send-email-mitake@dcl.info.waseda.ac.jp> X-Mailer: git-send-email 1.7.1.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2349 Lines: 73 This patch adds --prefault option to perf bench mem memcpy. If user specify this option to perf bench mem memcpy, overhead of page faults will be removed from the score of memcpy(). Example of usage: | % ./perf bench mem memcpy -l 500MB | # Running mem/memcpy benchmark... | # Copying 500MB Bytes from 0x7fc036749010 to 0x7fc055b4a010 ... | | 628.526821 MB/Sec | mitake@X201i:~/linux/.../tools/perf% ./perf bench mem memcpy -l 500MB --prefault | # Running mem/memcpy benchmark... | # Copying 500MB Bytes from 0x7ff1b45e2010 to 0x7ff1d39e3010 ... | | 4.849256 GB/Sec Signed-off-by: Hitoshi Mitake Cc: Ma Ling Cc: Zhao Yakui Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: Paul Mackerras Cc: Frederic Weisbecker Cc: Steven Rostedt Cc: Thomas Gleixner Cc: H. Peter Anvin --- tools/perf/bench/mem-memcpy.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c index 38dae74..be31ddb 100644 --- a/tools/perf/bench/mem-memcpy.c +++ b/tools/perf/bench/mem-memcpy.c @@ -23,8 +23,9 @@ static const char *length_str = "1MB"; static const char *routine = "default"; -static bool use_clock = false; +static bool use_clock; static int clock_fd; +static bool prefault; static const struct option options[] = { OPT_STRING('l', "length", &length_str, "1MB", @@ -34,6 +35,8 @@ static const struct option options[] = { "Specify routine to copy"), OPT_BOOLEAN('c', "clock", &use_clock, "Use CPU clock for measuring"), + OPT_BOOLEAN('p', "prefault", &prefault, + "Cause page faults before memcpy()"), OPT_END() }; @@ -139,6 +142,10 @@ int bench_mem_memcpy(int argc, const char **argv, length_str, src, dst); } + + if (prefault) + routines[i].fn(dst, src, length); + if (use_clock) { init_clock(); clock_start = get_clock(); -- 1.7.1.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/