From patchwork Fri Aug 3 07:43:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 174906 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 47C042C0091 for ; Fri, 3 Aug 2012 17:43:55 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4A3DA10BAB3; Fri, 3 Aug 2012 07:43:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L9ip+LadEhK1; Fri, 3 Aug 2012 07:43:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id EF13810B945; Fri, 3 Aug 2012 07:43:43 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 104048F75B for ; Fri, 3 Aug 2012 07:43:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 0BA5A31AFF for ; Fri, 3 Aug 2012 07:43:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q1QVZP2MVdhk for ; Fri, 3 Aug 2012 07:43:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (mail.free-electrons.com [88.190.12.23]) by silver.osuosl.org (Postfix) with ESMTP id 960FA269A1 for ; Fri, 3 Aug 2012 07:43:41 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id 29A6F18C; Fri, 3 Aug 2012 09:43:13 +0200 (CEST) Received: from localhost (tra42-5-83-152-246-54.fbx.proxad.net [83.152.246.54]) by mail.free-electrons.com (Postfix) with ESMTPSA id 35E6315E; Fri, 3 Aug 2012 09:43:04 +0200 (CEST) From: Gregory CLEMENT To: buildroot@uclibc.org Date: Fri, 3 Aug 2012 09:43:27 +0200 Message-Id: <1343979807-15024-1-git-send-email-gregory.clement@free-electrons.com> X-Mailer: git-send-email 1.7.9.5 Cc: Gregory CLEMENT Subject: [Buildroot] [PATCH] cachebench: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net This patch adds the cachebench package. Cachebench presents itself as a program to empirically determine some parameters about an architectures memory subsystem. It can be used to have an idea of the performance of the cache support. It has been integrated into LLCbench (Low Level Characterization Benchmarks), but currently only Cachebench is supported by Buildroot. The only difference with mainline is a patch which add a script to be able to generate data ready to bu used by gnuplot without having to use 'make' which is usually not present on embedded target. Signed-off-by: Gregory CLEMENT --- package/Config.in | 1 + package/cachebench/Config.in | 13 ++++ ...ipt-rules-of-Makefile-to-run-it-on-target.patch | 65 ++++++++++++++++++++ package/cachebench/cachebench.mk | 30 +++++++++ 4 files changed, 109 insertions(+) create mode 100644 package/cachebench/Config.in create mode 100644 package/cachebench/cachebench-0001-Convert-script-rules-of-Makefile-to-run-it-on-target.patch create mode 100644 package/cachebench/cachebench.mk diff --git a/package/Config.in b/package/Config.in index f308de7..163f1a7 100644 --- a/package/Config.in +++ b/package/Config.in @@ -17,6 +17,7 @@ source "package/xz/Config.in" endmenu menu "Debugging, profiling and benchmark" +source "package/cachebench/Config.in" source "package/bonnie/Config.in" source "package/dhrystone/Config.in" source "package/dstat/Config.in" diff --git a/package/cachebench/Config.in b/package/cachebench/Config.in new file mode 100644 index 0000000..b97c9ad --- /dev/null +++ b/package/cachebench/Config.in @@ -0,0 +1,13 @@ +config BR2_PACKAGE_CACHEBENCH + bool "cachebench" + help + + Cachebench presents itself as a program to empirically determine + some parameters about an architectures memory subsystem. It can + be used to have an idea of the performance of the cache + support. It has been integrated into LLCbench (Low Level + Characterization Benchmarks), but currently only Cachebench is + supported by Buildroot. + + http://icl.cs.utk.edu/projects/llcbench/cachebench.html + diff --git a/package/cachebench/cachebench-0001-Convert-script-rules-of-Makefile-to-run-it-on-target.patch b/package/cachebench/cachebench-0001-Convert-script-rules-of-Makefile-to-run-it-on-target.patch new file mode 100644 index 0000000..505a4fe --- /dev/null +++ b/package/cachebench/cachebench-0001-Convert-script-rules-of-Makefile-to-run-it-on-target.patch @@ -0,0 +1,65 @@ +From 6daded62de221ca0d97360523575b1c7230c8800 Mon Sep 17 00:00:00 2001 +From: Gregory CLEMENT +Date: Thu, 2 Aug 2012 22:33:36 +0200 +Subject: [PATCH] Convert script rules of Makefile to run it on target + +The benchmark is supposed to be run using the Makefile to be able to +get data ready to be used by gnuplot. On some target we don't have +Makefile available, so this script exctracted from the Makefile can be +used directly to run the benchmark, format data and make a tarball of +the result. +--- + cachebench/do_bench.sh | 40 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + create mode 100644 cachebench/do_bench.sh + +diff --git a/cachebench/do_bench.sh b/cachebench/do_bench.sh +new file mode 100644 +index 0000000..a80dcde +--- /dev/null ++++ b/cachebench/do_bench.sh +@@ -0,0 +1,40 @@ ++#!/bin/sh ++# Prefix of the output files produced by each benchmark ++ ++# if this fails, replace it with a regular name! ++Result_Prefix=$(hostname)-$(uname -m) ++# Datatype used for each memory reference. ++# Legal values are DOUBLE, CHAR, INT, FLOAT ++CB_Datatype=DOUBLE ++ ++# The number of seconds each test runs. ++CB_SecondsPerIteration=5 ++ ++# The number of times each test is run. ++CB_RepeatCount=1 ++ ++# Log base 2 of the maximum problem size tested in bytes ++CB_Memsize=29 ++ ++# The number of test sizes measured between powers of two ++CB_Resolution=2 ++ ++CBOPTS="-m $CB_Memsize -e $CB_RepeatCount -x $CB_Resolution -d $CB_SecondsPerIteration ++DATA=$CB_Datatype" ++mkdir -p results ++ ++cachebench $CBOPTS -r > results/${Result_Prefix}_cache_read.dat ++cachebench $CBOPTS -w > results/${Result_Prefix}_cache_write.dat ++cachebench $CBOPTS -b > results/${Result_Prefix}_cache_rmw.dat ++cachebench $CBOPTS -tr > results/${Result_Prefix}_cache_handread.dat ++cachebench $CBOPTS -tw > results/${Result_Prefix}_cache_handwrite.dat ++cachebench $CBOPTS -tb > results/${Result_Prefix}_cache_handrmw.dat ++cachebench $CBOPTS -s > results/${Result_Prefix}_cache_memset.dat ++cachebench $CBOPTS -p > results/${Result_Prefix}_cache_memcpy.dat ++ ++sed -e "s|TITLE|Memory Hierarchy Performance of ${Result_Prefix}|g" < /usr/share/cachebench/cachegraph.gp > results/${Result_Prefix}_cache.gp; echo "plot \"${Result_Prefix}_cache_read\" title 'read' with linespoints \\" >> results/${Result_Prefix}_cache.gp; for i in write rmw handread handwrite handrmw memset memcpy; do echo ", \"${Result_Prefix}_cache_$i.dat\" title '$i' with linespoints \\" >> results/${Result_Prefix}_cache.gp; done; ++ ++cd results; tar cf ${Result_Prefix}-cachebench-datafiles.tar ${Result_Prefix}_cache*.dat ${Result_Prefix}_cache.gp ++echo "" ++echo "Datafiles and GNUplot scripts are located in the results directory." ++echo "" +\ No newline at end of file +-- +1.7.9.5 + diff --git a/package/cachebench/cachebench.mk b/package/cachebench/cachebench.mk new file mode 100644 index 0000000..efe95d9 --- /dev/null +++ b/package/cachebench/cachebench.mk @@ -0,0 +1,30 @@ +############################################################# +# +# cachebench +# +############################################################# +CACHEBENCH_VERSION = 1.11 +CACHEBENCH_SOURCE = llcbench.tar.gz +CACHEBENCH_SITE = http://icl.cs.utk.edu/projects/llcbench/ +CACHEBENCH_LICENSE = GPLv3 +CACHEBENCH_LICENSE_FILES = COPYING + +define CACHEBENCH_CONFIGURE_CMDS + $(MAKE) -C $(@D) linux-lam +endef + +define CACHEBENCH_BUILD_CMDS + $(MAKE) BB_CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)" -C $(@D) cache-bench +endef + +define CACHEBENCH_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/cachebench/cachebench $(TARGET_DIR)/usr/bin/cachebench + $(INSTALL) -m 0755 -D $(@D)/cachebench/do_bench.sh $(TARGET_DIR)/usr/share/cachebench/do_bench.sh + cp $(@D)/cachebench/cachegraph.gp $(TARGET_DIR)/usr/share/cachebench/cachegraph.gp +endef + +define CACHEBENCH_UNINSTALL_TARGET_CMDS + $(RM) $(TARGET_DIR)/usr/bin/cachebench +endef + +$(eval $(generic-package))