Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] New package: cache-calibrator
@ 2013-01-29  8:31 Stephan Hoffmann
  2013-01-29  8:52 ` Thomas Petazzoni
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Stephan Hoffmann @ 2013-01-29  8:31 UTC (permalink / raw)
  To: buildroot

The Calibrator is a small C program that is supposed to analyze
a computers (cache-) memory system and extract the following
parameters:

    number of cache levels
    for each cache level:
        its size
        its linesize
        its access/miss latency
    main memory access latency
    number of TLB levels
    for each TLB level:
        its capacity (i.e. number of entries)
        the pagesize used
        the TLB miss latency

http://homepages.cwi.nl/~manegold/Calibrator/

It is also recommended as a load generator for realtime testing in:

https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#Benchmarking

Signed-off-by: Stephan Hoffmann <sho@relinux.de>
---
 package/Config.in                                  |    1 +
 package/cache-calibrator/Config.in                 |   13 +++
 ...calibrator-Fix-conflicting-round-function.patch |  108 ++++++++++++++++++++
 package/cache-calibrator/cache-calibrator.mk       |   21 ++++
 4 files changed, 143 insertions(+), 0 deletions(-)
 create mode 100644 package/cache-calibrator/Config.in
 create mode 100644 package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
 create mode 100644 package/cache-calibrator/cache-calibrator.mk

diff --git a/package/Config.in b/package/Config.in
index ebd9817..e6682fc 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -19,6 +19,7 @@ endmenu
 
 menu "Debugging, profiling and benchmark"
 source "package/bonnie/Config.in"
+source "package/cache-calibrator/Config.in"
 source "package/dhrystone/Config.in"
 source "package/dstat/Config.in"
 source "package/dmalloc/Config.in"
diff --git a/package/cache-calibrator/Config.in b/package/cache-calibrator/Config.in
new file mode 100644
index 0000000..6425cd0
--- /dev/null
+++ b/package/cache-calibrator/Config.in
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_CACHE_CALIBRATOR
+	bool "cache-calibrator"
+	help
+	  Cache calibrator is a small C program that is
+	  supposed to analyze a computers (cache-) memory
+	  system and extract useful information
+
+	  http://homepages.cwi.nl/~manegold/Calibrator/
+
+	  It is also recommended as a load generator for
+	  realtime testing in:
+
+	  https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO
diff --git a/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
new file mode 100644
index 0000000..71181a6
--- /dev/null
+++ b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
@@ -0,0 +1,108 @@
+From 39ac7268c4350040976005da98daf10edf676d3e Mon Sep 17 00:00:00 2001
+From: Stephan Hoffmann <sho@relinux.de>
+Date: Mon, 28 Jan 2013 17:32:10 +0100
+Subject: [PATCH] Fix conflicting round() function
+
+calibrator.c defines a local round() function that conflicts
+with the one from the standard library.
+
+This is fixed by renaming the local function.
+
+Signed-off-by: Stephan Hoffmann <sho@relinux.de>
+---
+ calibrator.c |   30 +++++++++++++++---------------
+ 1 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/calibrator.c b/calibrator.c
+index e045dfd..8471c04 100644
+--- a/calibrator.c
++++ b/calibrator.c
+@@ -128,7 +128,7 @@ void ErrXit(char *format, ...) {
+ 	exit(1);
+ }
+ 
+-lng round(dbl x)
++lng lng_round(dbl x)
+ {
+ 	return (lng)(x + 0.5);
+ }
+@@ -890,16 +890,16 @@ void plotCache(cacheInfo *cache, lng **result, lng MHz, char *fn, FILE *fp, lng
+ 	fprintf(fp, ")\n");
+ 	fprintf(fp, "set y2tics");
+ 	for (l = 0, s = " ("; l <= cache->levels; l++, s = ", ") {
+-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
+-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
+ 	}
+ 	for (y = 1; y <= yh; y *= 10) {
+ 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
+ 	}
+ 	fprintf(fp, ")\n");
+ 	for (l = 0; l <= cache->levels; l++) {
+-		if (!delay)	z = (dbl)round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
+-			else	z = (dbl)round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
++		if (!delay)	z = (dbl)lng_round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
++			else	z = (dbl)lng_round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
+ 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
+ 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
+ 	}
+@@ -986,16 +986,16 @@ void plotTLB(TLBinfo *TLB, lng **result, lng MHz, char *fn, FILE *fp, lng delay)
+ 	fprintf(fp, "%s'<L1>' %ld)\n", s, TLB->mincachelines);
+ 	fprintf(fp, "set y2tics");
+ 	for (l = 0, s = " ("; l <= TLB->levels; l++, s = ", ") {
+-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
+-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
+ 	}
+ 	for (y = 1; y <= yh; y *= 10) {
+ 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
+ 	}
+ 	fprintf(fp, ")\n");
+ 	for (l = 0; l <= TLB->levels; l++) {
+-		if (!delay)	z = (dbl)round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
+-			else	z = (dbl)round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
++		if (!delay)	z = (dbl)lng_round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
++			else	z = (dbl)lng_round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
+ 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
+ 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
+ 	}
+@@ -1023,9 +1023,9 @@ void printCPU(cacheInfo *cache, lng MHz, lng delay)
+ 	FILE	*fp = stdout;
+ 		
+ 	fprintf(fp, "CPU loop + L1 access:    ");
+-	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), round(CYperIt(cache->latency1[0])));
++	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), lng_round(CYperIt(cache->latency1[0])));
+ 	fprintf(fp, "             ( delay:    ");
+-	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            round(CYperIt(delay)));
++	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            lng_round(CYperIt(delay)));
+ 	fprintf(fp, "\n");
+ 	fflush(fp);
+ }
+@@ -1047,8 +1047,8 @@ void printCache(cacheInfo *cache, lng MHz)
+ 			fprintf(fp, " %3ld KB ", cache->size[l] / 1024);
+ 		}
+ 		fprintf(fp, " %3ld bytes ", cache->linesize[l + 1]);
+-		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
+-		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), lng_round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), lng_round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
+ 	}
+ 	fprintf(fp, "\n");
+ 	fflush(fp);
+@@ -1075,9 +1075,9 @@ void printTLB(TLBinfo *TLB, lng MHz)
+ 		} else {
+ 			fprintf(fp, "  %3ld KB  ", TLB->pagesize[l + 1] / 1024);
+ 		}
+-		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), lng_round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
+ /*
+-		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), lng_round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
+ */
+ 		fprintf(fp, "\n");
+ 	}
+-- 
+1.7.0.4
+
diff --git a/package/cache-calibrator/cache-calibrator.mk b/package/cache-calibrator/cache-calibrator.mk
new file mode 100644
index 0000000..8abc647
--- /dev/null
+++ b/package/cache-calibrator/cache-calibrator.mk
@@ -0,0 +1,21 @@
+#############################################################
+#
+# cache-calibrator
+#
+#############################################################
+
+CACHE_CALIBRATOR_SOURCE = calibrator.c
+CACHE_CALIBRATOR_SITE = http://homepages.cwi.nl/~manegold/Calibrator/src
+CACHE_CALIBRATOR_EXTRACT_CMDS = cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(D)
+CACHE_CALIBRATOR_LICENSE = Cache calibrator license
+CACHE_CALIBRATOR_LICENSE_FILES = calibrator.c
+
+define CACHE_CALIBRATOR_BUILD_CMDS
+	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/calibrator.c -o $(@D)/cache_calibrator -lm
+endef
+
+define CACHE_CALIBRATOR_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/cache_calibrator $(TARGET_DIR)/usr/bin/cache_calibrator
+endef
+
+$(eval $(generic-package))
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH] New package: cache-calibrator
  2013-01-29  8:31 [Buildroot] [PATCH] New package: cache-calibrator Stephan Hoffmann
@ 2013-01-29  8:52 ` Thomas Petazzoni
  2013-01-29  9:07 ` Peter Korsgaard
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2013-01-29  8:52 UTC (permalink / raw)
  To: buildroot

Dear Stephan Hoffmann,

On Tue, 29 Jan 2013 09:31:55 +0100, Stephan Hoffmann wrote:

> +CACHE_CALIBRATOR_SOURCE = calibrator.c
> +CACHE_CALIBRATOR_SITE = http://homepages.cwi.nl/~manegold/Calibrator/src
> +CACHE_CALIBRATOR_EXTRACT_CMDS = cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(D)

I'd prefer to see this below, right before the BUILD_CMDS, as follows:

define CACHE_CALIBRATOR_EXTRACT_CMDS
	cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(@D)
endef

Even though it doesn't change anything, we generally try to use:

VARIABLE = value

for things that are just "values". And:

define VARIABLE_CMDS
	...
endef

for variables that contain commands.

Thanks,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH] New package: cache-calibrator
  2013-01-29  8:31 [Buildroot] [PATCH] New package: cache-calibrator Stephan Hoffmann
  2013-01-29  8:52 ` Thomas Petazzoni
@ 2013-01-29  9:07 ` Peter Korsgaard
  2013-01-29  9:15 ` Stephan Hoffmann
  2013-01-29  9:53 ` [Buildroot] [PATCH v3] " Stephan Hoffmann
  3 siblings, 0 replies; 11+ messages in thread
From: Peter Korsgaard @ 2013-01-29  9:07 UTC (permalink / raw)
  To: buildroot

>>>>> "Stephan" == Stephan Hoffmann <sho@relinux.de> writes:

 Stephan> The Calibrator is a small C program that is supposed to analyze
 Stephan> a computers (cache-) memory system and extract the following
 Stephan> parameters:

Could you please clearly state (E.G. by naming it PATCHv2) that this
superseeds your early patch and note (under the --- line) what you have
changed for future submissions, thanks.

 Stephan>     number of cache levels
 Stephan>     for each cache level:
 Stephan>         its size
 Stephan>         its linesize
 Stephan>         its access/miss latency
 Stephan>     main memory access latency
 Stephan>     number of TLB levels
 Stephan>     for each TLB level:
 Stephan>         its capacity (i.e. number of entries)
 Stephan>         the pagesize used
 Stephan>         the TLB miss latency

 Stephan> http://homepages.cwi.nl/~manegold/Calibrator/

 Stephan> It is also recommended as a load generator for realtime testing in:

 Stephan> https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#Benchmarking

 Stephan> Signed-off-by: Stephan Hoffmann <sho@relinux.de>
 Stephan> ---
 Stephan>  package/Config.in                                  |    1 +
 Stephan>  package/cache-calibrator/Config.in                 |   13 +++
 Stephan>  ...calibrator-Fix-conflicting-round-function.patch |  108 ++++++++++++++++++++
 Stephan>  package/cache-calibrator/cache-calibrator.mk       |   21 ++++
 Stephan>  4 files changed, 143 insertions(+), 0 deletions(-)
 Stephan>  create mode 100644 package/cache-calibrator/Config.in
 Stephan>  create mode 100644 package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
 Stephan>  create mode 100644 package/cache-calibrator/cache-calibrator.mk

 Stephan> diff --git a/package/Config.in b/package/Config.in
 Stephan> index ebd9817..e6682fc 100644
 Stephan> --- a/package/Config.in
 Stephan> +++ b/package/Config.in
 Stephan> @@ -19,6 +19,7 @@ endmenu
 
 Stephan>  menu "Debugging, profiling and benchmark"
 Stephan>  source "package/bonnie/Config.in"
 Stephan> +source "package/cache-calibrator/Config.in"
 Stephan>  source "package/dhrystone/Config.in"
 Stephan>  source "package/dstat/Config.in"
 Stephan>  source "package/dmalloc/Config.in"
 Stephan> diff --git a/package/cache-calibrator/Config.in b/package/cache-calibrator/Config.in
 Stephan> new file mode 100644
 Stephan> index 0000000..6425cd0
 Stephan> --- /dev/null
 Stephan> +++ b/package/cache-calibrator/Config.in
 Stephan> @@ -0,0 +1,13 @@
 Stephan> +config BR2_PACKAGE_CACHE_CALIBRATOR
 Stephan> +	bool "cache-calibrator"
 Stephan> +	help
 Stephan> +	  Cache calibrator is a small C program that is
 Stephan> +	  supposed to analyze a computers (cache-) memory
 Stephan> +	  system and extract useful information
 Stephan> +
 Stephan> +	  http://homepages.cwi.nl/~manegold/Calibrator/
 Stephan> +
 Stephan> +	  It is also recommended as a load generator for
 Stephan> +	  realtime testing in:
 Stephan> +
 Stephan> +	  https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO
 Stephan> diff --git a/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
 Stephan> new file mode 100644
 Stephan> index 0000000..71181a6
 Stephan> --- /dev/null
 Stephan> +++ b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
 Stephan> @@ -0,0 +1,108 @@
 Stephan> +From 39ac7268c4350040976005da98daf10edf676d3e Mon Sep 17 00:00:00 2001
 Stephan> +From: Stephan Hoffmann <sho@relinux.de>
 Stephan> +Date: Mon, 28 Jan 2013 17:32:10 +0100
 Stephan> +Subject: [PATCH] Fix conflicting round() function
 Stephan> +
 Stephan> +calibrator.c defines a local round() function that conflicts
 Stephan> +with the one from the standard library.
 Stephan> +
 Stephan> +This is fixed by renaming the local function.
 Stephan> +
 Stephan> +Signed-off-by: Stephan Hoffmann <sho@relinux.de>
 Stephan> +---
 Stephan> + calibrator.c |   30 +++++++++++++++---------------
 Stephan> + 1 files changed, 15 insertions(+), 15 deletions(-)
 Stephan> +
 Stephan> +diff --git a/calibrator.c b/calibrator.c
 Stephan> +index e045dfd..8471c04 100644
 Stephan> +--- a/calibrator.c
 Stephan> ++++ b/calibrator.c
 Stephan> +@@ -128,7 +128,7 @@ void ErrXit(char *format, ...) {
 Stephan> + 	exit(1);
 Stephan> + }
 Stephan> + 
 Stephan> +-lng round(dbl x)
 Stephan> ++lng lng_round(dbl x)
 Stephan> + {
 Stephan> + 	return (lng)(x + 0.5);
 Stephan> + }
 Stephan> +@@ -890,16 +890,16 @@ void plotCache(cacheInfo *cache, lng **result, lng MHz, char *fn, FILE *fp, lng
 Stephan> + 	fprintf(fp, ")\n");
 Stephan> + 	fprintf(fp, "set y2tics");
 Stephan> + 	for (l = 0, s = " ("; l <= cache->levels; l++, s = ", ") {
 Stephan> +-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
 Stephan> +-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
 Stephan> ++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
 Stephan> ++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
 Stephan> + 	}
 Stephan> + 	for (y = 1; y <= yh; y *= 10) {
 Stephan> + 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
 Stephan> + 	}
 Stephan> + 	fprintf(fp, ")\n");
 Stephan> + 	for (l = 0; l <= cache->levels; l++) {
 Stephan> +-		if (!delay)	z = (dbl)round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
 Stephan> +-			else	z = (dbl)round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
 Stephan> ++		if (!delay)	z = (dbl)lng_round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
 Stephan> ++			else	z = (dbl)lng_round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
 Stephan> + 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
 Stephan> + 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
 Stephan> + 	}
 Stephan> +@@ -986,16 +986,16 @@ void plotTLB(TLBinfo *TLB, lng **result, lng MHz, char *fn, FILE *fp, lng delay)
 Stephan> + 	fprintf(fp, "%s'<L1>' %ld)\n", s, TLB->mincachelines);
 Stephan> + 	fprintf(fp, "set y2tics");
 Stephan> + 	for (l = 0, s = " ("; l <= TLB->levels; l++, s = ", ") {
 Stephan> +-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
 Stephan> +-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
 Stephan> ++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
 Stephan> ++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
 Stephan> + 	}
 Stephan> + 	for (y = 1; y <= yh; y *= 10) {
 Stephan> + 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
 Stephan> + 	}
 Stephan> + 	fprintf(fp, ")\n");
 Stephan> + 	for (l = 0; l <= TLB->levels; l++) {
 Stephan> +-		if (!delay)	z = (dbl)round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
 Stephan> +-			else	z = (dbl)round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
 Stephan> ++		if (!delay)	z = (dbl)lng_round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
 Stephan> ++			else	z = (dbl)lng_round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
 Stephan> + 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
 Stephan> + 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
 Stephan> + 	}
 Stephan> +@@ -1023,9 +1023,9 @@ void printCPU(cacheInfo *cache, lng MHz, lng delay)
 Stephan> + 	FILE	*fp = stdout;
 Stephan> + 		
 Stephan> + 	fprintf(fp, "CPU loop + L1 access:    ");
 Stephan> +-	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), round(CYperIt(cache->latency1[0])));
 Stephan> ++	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), lng_round(CYperIt(cache->latency1[0])));
 Stephan> + 	fprintf(fp, "             ( delay:    ");
 Stephan> +-	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            round(CYperIt(delay)));
 Stephan> ++	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            lng_round(CYperIt(delay)));
 Stephan> + 	fprintf(fp, "\n");
 Stephan> + 	fflush(fp);
 Stephan> + }
 Stephan> +@@ -1047,8 +1047,8 @@ void printCache(cacheInfo *cache, lng MHz)
 Stephan> + 			fprintf(fp, " %3ld KB ", cache->size[l] / 1024);
 Stephan> + 		}
 Stephan> + 		fprintf(fp, " %3ld bytes ", cache->linesize[l + 1]);
 Stephan> +-		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
 Stephan> +-		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
 Stephan> ++		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), lng_round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
 Stephan> ++		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), lng_round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
 Stephan> + 	}
 Stephan> + 	fprintf(fp, "\n");
 Stephan> + 	fflush(fp);
 Stephan> +@@ -1075,9 +1075,9 @@ void printTLB(TLBinfo *TLB, lng MHz)
 Stephan> + 		} else {
 Stephan> + 			fprintf(fp, "  %3ld KB  ", TLB->pagesize[l + 1] / 1024);
 Stephan> + 		}
 Stephan> +-		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
 Stephan> ++		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), lng_round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
 Stephan> + /*
 Stephan> +-		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
 Stephan> ++		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), lng_round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
 Stephan> + */
 Stephan> + 		fprintf(fp, "\n");
 Stephan> + 	}
 Stephan> +-- 
 Stephan> +1.7.0.4
 Stephan> +
 Stephan> diff --git a/package/cache-calibrator/cache-calibrator.mk b/package/cache-calibrator/cache-calibrator.mk
 Stephan> new file mode 100644
 Stephan> index 0000000..8abc647
 Stephan> --- /dev/null
 Stephan> +++ b/package/cache-calibrator/cache-calibrator.mk
 Stephan> @@ -0,0 +1,21 @@
 Stephan> +#############################################################
 Stephan> +#
 Stephan> +# cache-calibrator
 Stephan> +#
 Stephan> +#############################################################
 Stephan> +
 Stephan> +CACHE_CALIBRATOR_SOURCE = calibrator.c
 Stephan> +CACHE_CALIBRATOR_SITE = http://homepages.cwi.nl/~manegold/Calibrator/src
 Stephan> +CACHE_CALIBRATOR_EXTRACT_CMDS = cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(D)

Please use the normal define CACHE_CLIBRATOR_.. syntax. Have a look at
package/devmem2 for an example.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH] New package: cache-calibrator
  2013-01-29  8:31 [Buildroot] [PATCH] New package: cache-calibrator Stephan Hoffmann
  2013-01-29  8:52 ` Thomas Petazzoni
  2013-01-29  9:07 ` Peter Korsgaard
@ 2013-01-29  9:15 ` Stephan Hoffmann
  2013-01-29  9:21   ` Stephan Hoffmann
  2013-01-29  9:53 ` [Buildroot] [PATCH v3] " Stephan Hoffmann
  3 siblings, 1 reply; 11+ messages in thread
From: Stephan Hoffmann @ 2013-01-29  9:15 UTC (permalink / raw)
  To: buildroot

The Calibrator is a small C program that is supposed to analyze
a computers (cache-) memory system and extract the following
parameters:

    number of cache levels
    for each cache level:
        its size
        its linesize
        its access/miss latency
    main memory access latency
    number of TLB levels
    for each TLB level:
        its capacity (i.e. number of entries)
        the pagesize used
        the TLB miss latency

http://homepages.cwi.nl/~manegold/Calibrator/

It is also recommended as a load generator for realtime testing in:

https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#Benchmarking

Signed-off-by: Stephan Hoffmann <sho@relinux.de>
---
v2: Review by Arnout Vandecappelle
	Fix License
	Use $(TARGET_CFLAGS) and $(TARGET_LDFLAGS)
	Fix Typo
	Remove $(CACHE_CALIBRATOR_DIR) 
v3: Review by Thomas Petazzoni
	Fix CACHE_CALIBRATOR_EXTRACT_CMDS

 package/Config.in                                  |    1 +
 package/cache-calibrator/Config.in                 |   13 +++
 ...calibrator-Fix-conflicting-round-function.patch |  108 ++++++++++++++++++++
 package/cache-calibrator/cache-calibrator.mk       |   24 +++++
 4 files changed, 146 insertions(+), 0 deletions(-)
 create mode 100644 package/cache-calibrator/Config.in
 create mode 100644 package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
 create mode 100644 package/cache-calibrator/cache-calibrator.mk

diff --git a/package/Config.in b/package/Config.in
index ebd9817..e6682fc 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -19,6 +19,7 @@ endmenu
 
 menu "Debugging, profiling and benchmark"
 source "package/bonnie/Config.in"
+source "package/cache-calibrator/Config.in"
 source "package/dhrystone/Config.in"
 source "package/dstat/Config.in"
 source "package/dmalloc/Config.in"
diff --git a/package/cache-calibrator/Config.in b/package/cache-calibrator/Config.in
new file mode 100644
index 0000000..6425cd0
--- /dev/null
+++ b/package/cache-calibrator/Config.in
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_CACHE_CALIBRATOR
+	bool "cache-calibrator"
+	help
+	  Cache calibrator is a small C program that is
+	  supposed to analyze a computers (cache-) memory
+	  system and extract useful information
+
+	  http://homepages.cwi.nl/~manegold/Calibrator/
+
+	  It is also recommended as a load generator for
+	  realtime testing in:
+
+	  https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO
diff --git a/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
new file mode 100644
index 0000000..71181a6
--- /dev/null
+++ b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
@@ -0,0 +1,108 @@
+From 39ac7268c4350040976005da98daf10edf676d3e Mon Sep 17 00:00:00 2001
+From: Stephan Hoffmann <sho@relinux.de>
+Date: Mon, 28 Jan 2013 17:32:10 +0100
+Subject: [PATCH] Fix conflicting round() function
+
+calibrator.c defines a local round() function that conflicts
+with the one from the standard library.
+
+This is fixed by renaming the local function.
+
+Signed-off-by: Stephan Hoffmann <sho@relinux.de>
+---
+ calibrator.c |   30 +++++++++++++++---------------
+ 1 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/calibrator.c b/calibrator.c
+index e045dfd..8471c04 100644
+--- a/calibrator.c
++++ b/calibrator.c
+@@ -128,7 +128,7 @@ void ErrXit(char *format, ...) {
+ 	exit(1);
+ }
+ 
+-lng round(dbl x)
++lng lng_round(dbl x)
+ {
+ 	return (lng)(x + 0.5);
+ }
+@@ -890,16 +890,16 @@ void plotCache(cacheInfo *cache, lng **result, lng MHz, char *fn, FILE *fp, lng
+ 	fprintf(fp, ")\n");
+ 	fprintf(fp, "set y2tics");
+ 	for (l = 0, s = " ("; l <= cache->levels; l++, s = ", ") {
+-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
+-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
+ 	}
+ 	for (y = 1; y <= yh; y *= 10) {
+ 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
+ 	}
+ 	fprintf(fp, ")\n");
+ 	for (l = 0; l <= cache->levels; l++) {
+-		if (!delay)	z = (dbl)round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
+-			else	z = (dbl)round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
++		if (!delay)	z = (dbl)lng_round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
++			else	z = (dbl)lng_round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
+ 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
+ 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
+ 	}
+@@ -986,16 +986,16 @@ void plotTLB(TLBinfo *TLB, lng **result, lng MHz, char *fn, FILE *fp, lng delay)
+ 	fprintf(fp, "%s'<L1>' %ld)\n", s, TLB->mincachelines);
+ 	fprintf(fp, "set y2tics");
+ 	for (l = 0, s = " ("; l <= TLB->levels; l++, s = ", ") {
+-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
+-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
+ 	}
+ 	for (y = 1; y <= yh; y *= 10) {
+ 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
+ 	}
+ 	fprintf(fp, ")\n");
+ 	for (l = 0; l <= TLB->levels; l++) {
+-		if (!delay)	z = (dbl)round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
+-			else	z = (dbl)round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
++		if (!delay)	z = (dbl)lng_round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
++			else	z = (dbl)lng_round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
+ 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
+ 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
+ 	}
+@@ -1023,9 +1023,9 @@ void printCPU(cacheInfo *cache, lng MHz, lng delay)
+ 	FILE	*fp = stdout;
+ 		
+ 	fprintf(fp, "CPU loop + L1 access:    ");
+-	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), round(CYperIt(cache->latency1[0])));
++	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), lng_round(CYperIt(cache->latency1[0])));
+ 	fprintf(fp, "             ( delay:    ");
+-	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            round(CYperIt(delay)));
++	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            lng_round(CYperIt(delay)));
+ 	fprintf(fp, "\n");
+ 	fflush(fp);
+ }
+@@ -1047,8 +1047,8 @@ void printCache(cacheInfo *cache, lng MHz)
+ 			fprintf(fp, " %3ld KB ", cache->size[l] / 1024);
+ 		}
+ 		fprintf(fp, " %3ld bytes ", cache->linesize[l + 1]);
+-		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
+-		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), lng_round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), lng_round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
+ 	}
+ 	fprintf(fp, "\n");
+ 	fflush(fp);
+@@ -1075,9 +1075,9 @@ void printTLB(TLBinfo *TLB, lng MHz)
+ 		} else {
+ 			fprintf(fp, "  %3ld KB  ", TLB->pagesize[l + 1] / 1024);
+ 		}
+-		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), lng_round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
+ /*
+-		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), lng_round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
+ */
+ 		fprintf(fp, "\n");
+ 	}
+-- 
+1.7.0.4
+
diff --git a/package/cache-calibrator/cache-calibrator.mk b/package/cache-calibrator/cache-calibrator.mk
new file mode 100644
index 0000000..a36bb8a
--- /dev/null
+++ b/package/cache-calibrator/cache-calibrator.mk
@@ -0,0 +1,24 @@
+#############################################################
+#
+# cache-calibrator
+#
+#############################################################
+
+CACHE_CALIBRATOR_SOURCE = calibrator.c
+CACHE_CALIBRATOR_SITE = http://homepages.cwi.nl/~manegold/Calibrator/src
+CACHE_CALIBRATOR_LICENSE = Cache calibrator license
+CACHE_CALIBRATOR_LICENSE_FILES = calibrator.c
+
+define CACHE_CALIBRATOR_EXTRACT_CMDS
+	cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(D)
+endef
+
+define CACHE_CALIBRATOR_BUILD_CMDS
+	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/calibrator.c -o $(@D)/cache_calibrator -lm
+endef
+
+define CACHE_CALIBRATOR_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/cache_calibrator $(TARGET_DIR)/usr/bin/cache_calibrator
+endef
+
+$(eval $(generic-package))
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH] New package: cache-calibrator
  2013-01-29  9:15 ` Stephan Hoffmann
@ 2013-01-29  9:21   ` Stephan Hoffmann
  2013-01-29  9:25     ` Peter Korsgaard
  2013-01-29  9:36     ` Thomas Petazzoni
  0 siblings, 2 replies; 11+ messages in thread
From: Stephan Hoffmann @ 2013-01-29  9:21 UTC (permalink / raw)
  To: buildroot

Hello all,

I tried to add a PATCHv3 to the header using "git send-email
--subject-prefix PATCHv3", but this obviously did not work. Does anybody
have an idea why?

Kind regards

Stephan

Am 29.01.2013 10:15, schrieb Stephan Hoffmann:
> The Calibrator is a small C program that is supposed to analyze
> a computers (cache-) memory system and extract the following
> parameters:
>
>     number of cache levels
>     for each cache level:
>         its size
>         its linesize
>         its access/miss latency
>     main memory access latency
>     number of TLB levels
>     for each TLB level:
>         its capacity (i.e. number of entries)
>         the pagesize used
>         the TLB miss latency
>
> http://homepages.cwi.nl/~manegold/Calibrator/
>
> It is also recommended as a load generator for realtime testing in:
>
> https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#Benchmarking
>
> Signed-off-by: Stephan Hoffmann <sho@relinux.de>
> ---
> v2: Review by Arnout Vandecappelle
> 	Fix License
> 	Use $(TARGET_CFLAGS) and $(TARGET_LDFLAGS)
> 	Fix Typo
> 	Remove $(CACHE_CALIBRATOR_DIR) 
> v3: Review by Thomas Petazzoni
> 	Fix CACHE_CALIBRATOR_EXTRACT_CMDS
>
>  package/Config.in                                  |    1 +
>  package/cache-calibrator/Config.in                 |   13 +++
>  ...calibrator-Fix-conflicting-round-function.patch |  108 ++++++++++++++++++++
>  package/cache-calibrator/cache-calibrator.mk       |   24 +++++
>  4 files changed, 146 insertions(+), 0 deletions(-)
>  create mode 100644 package/cache-calibrator/Config.in
>  create mode 100644 package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
>  create mode 100644 package/cache-calibrator/cache-calibrator.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index ebd9817..e6682fc 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -19,6 +19,7 @@ endmenu
>  
>  menu "Debugging, profiling and benchmark"
>  source "package/bonnie/Config.in"
> +source "package/cache-calibrator/Config.in"
>  source "package/dhrystone/Config.in"
>  source "package/dstat/Config.in"
>  source "package/dmalloc/Config.in"
> diff --git a/package/cache-calibrator/Config.in b/package/cache-calibrator/Config.in
> new file mode 100644
> index 0000000..6425cd0
> --- /dev/null
> +++ b/package/cache-calibrator/Config.in
> @@ -0,0 +1,13 @@
> +config BR2_PACKAGE_CACHE_CALIBRATOR
> +	bool "cache-calibrator"
> +	help
> +	  Cache calibrator is a small C program that is
> +	  supposed to analyze a computers (cache-) memory
> +	  system and extract useful information
> +
> +	  http://homepages.cwi.nl/~manegold/Calibrator/
> +
> +	  It is also recommended as a load generator for
> +	  realtime testing in:
> +
> +	  https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO
> diff --git a/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
> new file mode 100644
> index 0000000..71181a6
> --- /dev/null
> +++ b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
> @@ -0,0 +1,108 @@
> +From 39ac7268c4350040976005da98daf10edf676d3e Mon Sep 17 00:00:00 2001
> +From: Stephan Hoffmann <sho@relinux.de>
> +Date: Mon, 28 Jan 2013 17:32:10 +0100
> +Subject: [PATCH] Fix conflicting round() function
> +
> +calibrator.c defines a local round() function that conflicts
> +with the one from the standard library.
> +
> +This is fixed by renaming the local function.
> +
> +Signed-off-by: Stephan Hoffmann <sho@relinux.de>
> +---
> + calibrator.c |   30 +++++++++++++++---------------
> + 1 files changed, 15 insertions(+), 15 deletions(-)
> +
> +diff --git a/calibrator.c b/calibrator.c
> +index e045dfd..8471c04 100644
> +--- a/calibrator.c
> ++++ b/calibrator.c
> +@@ -128,7 +128,7 @@ void ErrXit(char *format, ...) {
> + 	exit(1);
> + }
> + 
> +-lng round(dbl x)
> ++lng lng_round(dbl x)
> + {
> + 	return (lng)(x + 0.5);
> + }
> +@@ -890,16 +890,16 @@ void plotCache(cacheInfo *cache, lng **result, lng MHz, char *fn, FILE *fp, lng
> + 	fprintf(fp, ")\n");
> + 	fprintf(fp, "set y2tics");
> + 	for (l = 0, s = " ("; l <= cache->levels; l++, s = ", ") {
> +-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
> +-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
> ++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
> ++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
> + 	}
> + 	for (y = 1; y <= yh; y *= 10) {
> + 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
> + 	}
> + 	fprintf(fp, ")\n");
> + 	for (l = 0; l <= cache->levels; l++) {
> +-		if (!delay)	z = (dbl)round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
> +-			else	z = (dbl)round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
> ++		if (!delay)	z = (dbl)lng_round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
> ++			else	z = (dbl)lng_round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
> + 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
> + 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
> + 	}
> +@@ -986,16 +986,16 @@ void plotTLB(TLBinfo *TLB, lng **result, lng MHz, char *fn, FILE *fp, lng delay)
> + 	fprintf(fp, "%s'<L1>' %ld)\n", s, TLB->mincachelines);
> + 	fprintf(fp, "set y2tics");
> + 	for (l = 0, s = " ("; l <= TLB->levels; l++, s = ", ") {
> +-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
> +-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
> ++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
> ++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
> + 	}
> + 	for (y = 1; y <= yh; y *= 10) {
> + 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
> + 	}
> + 	fprintf(fp, ")\n");
> + 	for (l = 0; l <= TLB->levels; l++) {
> +-		if (!delay)	z = (dbl)round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
> +-			else	z = (dbl)round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
> ++		if (!delay)	z = (dbl)lng_round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
> ++			else	z = (dbl)lng_round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
> + 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
> + 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
> + 	}
> +@@ -1023,9 +1023,9 @@ void printCPU(cacheInfo *cache, lng MHz, lng delay)
> + 	FILE	*fp = stdout;
> + 		
> + 	fprintf(fp, "CPU loop + L1 access:    ");
> +-	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), round(CYperIt(cache->latency1[0])));
> ++	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), lng_round(CYperIt(cache->latency1[0])));
> + 	fprintf(fp, "             ( delay:    ");
> +-	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            round(CYperIt(delay)));
> ++	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            lng_round(CYperIt(delay)));
> + 	fprintf(fp, "\n");
> + 	fflush(fp);
> + }
> +@@ -1047,8 +1047,8 @@ void printCache(cacheInfo *cache, lng MHz)
> + 			fprintf(fp, " %3ld KB ", cache->size[l] / 1024);
> + 		}
> + 		fprintf(fp, " %3ld bytes ", cache->linesize[l + 1]);
> +-		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
> +-		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
> ++		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), lng_round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
> ++		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), lng_round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
> + 	}
> + 	fprintf(fp, "\n");
> + 	fflush(fp);
> +@@ -1075,9 +1075,9 @@ void printTLB(TLBinfo *TLB, lng MHz)
> + 		} else {
> + 			fprintf(fp, "  %3ld KB  ", TLB->pagesize[l + 1] / 1024);
> + 		}
> +-		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
> ++		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), lng_round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
> + /*
> +-		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
> ++		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), lng_round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
> + */
> + 		fprintf(fp, "\n");
> + 	}
> +-- 
> +1.7.0.4
> +
> diff --git a/package/cache-calibrator/cache-calibrator.mk b/package/cache-calibrator/cache-calibrator.mk
> new file mode 100644
> index 0000000..a36bb8a
> --- /dev/null
> +++ b/package/cache-calibrator/cache-calibrator.mk
> @@ -0,0 +1,24 @@
> +#############################################################
> +#
> +# cache-calibrator
> +#
> +#############################################################
> +
> +CACHE_CALIBRATOR_SOURCE = calibrator.c
> +CACHE_CALIBRATOR_SITE = http://homepages.cwi.nl/~manegold/Calibrator/src
> +CACHE_CALIBRATOR_LICENSE = Cache calibrator license
> +CACHE_CALIBRATOR_LICENSE_FILES = calibrator.c
> +
> +define CACHE_CALIBRATOR_EXTRACT_CMDS
> +	cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(D)
> +endef
> +
> +define CACHE_CALIBRATOR_BUILD_CMDS
> +	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/calibrator.c -o $(@D)/cache_calibrator -lm
> +endef
> +
> +define CACHE_CALIBRATOR_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/cache_calibrator $(TARGET_DIR)/usr/bin/cache_calibrator
> +endef
> +
> +$(eval $(generic-package))


-- 
reLinux     -    Stephan Hoffmann
Am Schmidtgrund 124    50765 K?ln
Tel. +49.221.95595-19    Fax: -64
www.reLinux.de     sho at reLinux.de

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH] New package: cache-calibrator
  2013-01-29  9:21   ` Stephan Hoffmann
@ 2013-01-29  9:25     ` Peter Korsgaard
  2013-01-29  9:36     ` Thomas Petazzoni
  1 sibling, 0 replies; 11+ messages in thread
From: Peter Korsgaard @ 2013-01-29  9:25 UTC (permalink / raw)
  To: buildroot

>>>>> "Stephan" == Stephan Hoffmann <sho@relinux.de> writes:

 Stephan> Hello all, I tried to add a PATCHv3 to the header using "git
 Stephan> send-email --subject-prefix PATCHv3", but this obviously did
 Stephan> not work. Does anybody have an idea why?

The easiest is afaik to use --annotate which will open the email up in a
text editor so you can tweak subject / add your changelog.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH] New package: cache-calibrator
  2013-01-29  9:21   ` Stephan Hoffmann
  2013-01-29  9:25     ` Peter Korsgaard
@ 2013-01-29  9:36     ` Thomas Petazzoni
  1 sibling, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2013-01-29  9:36 UTC (permalink / raw)
  To: buildroot

Dear Stephan Hoffmann,

On Tue, 29 Jan 2013 10:21:45 +0100, Stephan Hoffmann wrote:

> I tried to add a PATCHv3 to the header using "git send-email
> --subject-prefix PATCHv3", but this obviously did not work. Does anybody
> have an idea why?

I routinely use --subject-prefix="PATCH v3" and it works perfectly fine
here.

Thanks,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v3] New package: cache-calibrator
  2013-01-29  8:31 [Buildroot] [PATCH] New package: cache-calibrator Stephan Hoffmann
                   ` (2 preceding siblings ...)
  2013-01-29  9:15 ` Stephan Hoffmann
@ 2013-01-29  9:53 ` Stephan Hoffmann
  2013-01-29 17:47   ` Arnout Vandecappelle
  2013-01-29 20:33   ` Peter Korsgaard
  3 siblings, 2 replies; 11+ messages in thread
From: Stephan Hoffmann @ 2013-01-29  9:53 UTC (permalink / raw)
  To: buildroot

The Calibrator is a small C program that is supposed to analyze
a computers (cache-) memory system and extract the following
parameters:

    number of cache levels
    for each cache level:
        its size
        its linesize
        its access/miss latency
    main memory access latency
    number of TLB levels
    for each TLB level:
        its capacity (i.e. number of entries)
        the pagesize used
        the TLB miss latency

http://homepages.cwi.nl/~manegold/Calibrator/

It is also recommended as a load generator for realtime testing in:

https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#Benchmarking

Signed-off-by: Stephan Hoffmann <sho@relinux.de>
---
v2: Review by Arnout Vandecappelle
	Fix License
	Use $(TARGET_CFLAGS) and $(TARGET_LDFLAGS)
	Fix Typo
	Remove $(CACHE_CALIBRATOR_DIR) 
v3: Review by Thomas Petazzoni
	Fix CACHE_CALIBRATOR_EXTRACT_CMDS

 package/Config.in                                  |    1 +
 package/cache-calibrator/Config.in                 |   13 +++
 ...calibrator-Fix-conflicting-round-function.patch |  108 ++++++++++++++++++++
 package/cache-calibrator/cache-calibrator.mk       |   24 +++++
 4 files changed, 146 insertions(+), 0 deletions(-)
 create mode 100644 package/cache-calibrator/Config.in
 create mode 100644 package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
 create mode 100644 package/cache-calibrator/cache-calibrator.mk

diff --git a/package/Config.in b/package/Config.in
index ebd9817..e6682fc 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -19,6 +19,7 @@ endmenu
 
 menu "Debugging, profiling and benchmark"
 source "package/bonnie/Config.in"
+source "package/cache-calibrator/Config.in"
 source "package/dhrystone/Config.in"
 source "package/dstat/Config.in"
 source "package/dmalloc/Config.in"
diff --git a/package/cache-calibrator/Config.in b/package/cache-calibrator/Config.in
new file mode 100644
index 0000000..6425cd0
--- /dev/null
+++ b/package/cache-calibrator/Config.in
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_CACHE_CALIBRATOR
+	bool "cache-calibrator"
+	help
+	  Cache calibrator is a small C program that is
+	  supposed to analyze a computers (cache-) memory
+	  system and extract useful information
+
+	  http://homepages.cwi.nl/~manegold/Calibrator/
+
+	  It is also recommended as a load generator for
+	  realtime testing in:
+
+	  https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO
diff --git a/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
new file mode 100644
index 0000000..71181a6
--- /dev/null
+++ b/package/cache-calibrator/cache-calibrator-Fix-conflicting-round-function.patch
@@ -0,0 +1,108 @@
+From 39ac7268c4350040976005da98daf10edf676d3e Mon Sep 17 00:00:00 2001
+From: Stephan Hoffmann <sho@relinux.de>
+Date: Mon, 28 Jan 2013 17:32:10 +0100
+Subject: [PATCH] Fix conflicting round() function
+
+calibrator.c defines a local round() function that conflicts
+with the one from the standard library.
+
+This is fixed by renaming the local function.
+
+Signed-off-by: Stephan Hoffmann <sho@relinux.de>
+---
+ calibrator.c |   30 +++++++++++++++---------------
+ 1 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/calibrator.c b/calibrator.c
+index e045dfd..8471c04 100644
+--- a/calibrator.c
++++ b/calibrator.c
+@@ -128,7 +128,7 @@ void ErrXit(char *format, ...) {
+ 	exit(1);
+ }
+ 
+-lng round(dbl x)
++lng lng_round(dbl x)
+ {
+ 	return (lng)(x + 0.5);
+ }
+@@ -890,16 +890,16 @@ void plotCache(cacheInfo *cache, lng **result, lng MHz, char *fn, FILE *fp, lng
+ 	fprintf(fp, ")\n");
+ 	fprintf(fp, "set y2tics");
+ 	for (l = 0, s = " ("; l <= cache->levels; l++, s = ", ") {
+-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
+-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
+ 	}
+ 	for (y = 1; y <= yh; y *= 10) {
+ 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
+ 	}
+ 	fprintf(fp, ")\n");
+ 	for (l = 0; l <= cache->levels; l++) {
+-		if (!delay)	z = (dbl)round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
+-			else	z = (dbl)round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
++		if (!delay)	z = (dbl)lng_round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
++			else	z = (dbl)lng_round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
+ 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
+ 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
+ 	}
+@@ -986,16 +986,16 @@ void plotTLB(TLBinfo *TLB, lng **result, lng MHz, char *fn, FILE *fp, lng delay)
+ 	fprintf(fp, "%s'<L1>' %ld)\n", s, TLB->mincachelines);
+ 	fprintf(fp, "set y2tics");
+ 	for (l = 0, s = " ("; l <= TLB->levels; l++, s = ", ") {
+-		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
+-			else	fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
++		if (!delay)	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
++			else	fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
+ 	}
+ 	for (y = 1; y <= yh; y *= 10) {
+ 		fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
+ 	}
+ 	fprintf(fp, ")\n");
+ 	for (l = 0; l <= TLB->levels; l++) {
+-		if (!delay)	z = (dbl)round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
+-			else	z = (dbl)round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
++		if (!delay)	z = (dbl)lng_round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
++			else	z = (dbl)lng_round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
+ 		fprintf(fp, "set label %ld '(%1.3g)  ' at %f,%f right\n", l + 1, z, xl, z);
+ 		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
+ 	}
+@@ -1023,9 +1023,9 @@ void printCPU(cacheInfo *cache, lng MHz, lng delay)
+ 	FILE	*fp = stdout;
+ 		
+ 	fprintf(fp, "CPU loop + L1 access:    ");
+-	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), round(CYperIt(cache->latency1[0])));
++	fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), lng_round(CYperIt(cache->latency1[0])));
+ 	fprintf(fp, "             ( delay:    ");
+-	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            round(CYperIt(delay)));
++	fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay),            lng_round(CYperIt(delay)));
+ 	fprintf(fp, "\n");
+ 	fflush(fp);
+ }
+@@ -1047,8 +1047,8 @@ void printCache(cacheInfo *cache, lng MHz)
+ 			fprintf(fp, " %3ld KB ", cache->size[l] / 1024);
+ 		}
+ 		fprintf(fp, " %3ld bytes ", cache->linesize[l + 1]);
+-		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
+-		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), lng_round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), lng_round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
+ 	}
+ 	fprintf(fp, "\n");
+ 	fflush(fp);
+@@ -1075,9 +1075,9 @@ void printTLB(TLBinfo *TLB, lng MHz)
+ 		} else {
+ 			fprintf(fp, "  %3ld KB  ", TLB->pagesize[l + 1] / 1024);
+ 		}
+-		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), lng_round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
+ /*
+-		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
++		fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), lng_round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
+ */
+ 		fprintf(fp, "\n");
+ 	}
+-- 
+1.7.0.4
+
diff --git a/package/cache-calibrator/cache-calibrator.mk b/package/cache-calibrator/cache-calibrator.mk
new file mode 100644
index 0000000..a36bb8a
--- /dev/null
+++ b/package/cache-calibrator/cache-calibrator.mk
@@ -0,0 +1,24 @@
+#############################################################
+#
+# cache-calibrator
+#
+#############################################################
+
+CACHE_CALIBRATOR_SOURCE = calibrator.c
+CACHE_CALIBRATOR_SITE = http://homepages.cwi.nl/~manegold/Calibrator/src
+CACHE_CALIBRATOR_LICENSE = Cache calibrator license
+CACHE_CALIBRATOR_LICENSE_FILES = calibrator.c
+
+define CACHE_CALIBRATOR_EXTRACT_CMDS
+	cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(D)
+endef
+
+define CACHE_CALIBRATOR_BUILD_CMDS
+	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/calibrator.c -o $(@D)/cache_calibrator -lm
+endef
+
+define CACHE_CALIBRATOR_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/cache_calibrator $(TARGET_DIR)/usr/bin/cache_calibrator
+endef
+
+$(eval $(generic-package))
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v3] New package: cache-calibrator
  2013-01-29  9:53 ` [Buildroot] [PATCH v3] " Stephan Hoffmann
@ 2013-01-29 17:47   ` Arnout Vandecappelle
  2013-01-29 20:33   ` Peter Korsgaard
  1 sibling, 0 replies; 11+ messages in thread
From: Arnout Vandecappelle @ 2013-01-29 17:47 UTC (permalink / raw)
  To: buildroot

On 29/01/13 10:53, Stephan Hoffmann wrote:
> The Calibrator is a small C program that is supposed to analyze
> a computers (cache-) memory system and extract the following
> parameters:
>
>      number of cache levels
>      for each cache level:
>          its size
>          its linesize
>          its access/miss latency
>      main memory access latency
>      number of TLB levels
>      for each TLB level:
>          its capacity (i.e. number of entries)
>          the pagesize used
>          the TLB miss latency
>
> http://homepages.cwi.nl/~manegold/Calibrator/
>
> It is also recommended as a load generator for realtime testing in:
>
> https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#Benchmarking
>
> Signed-off-by: Stephan Hoffmann<sho@relinux.de>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
  (untested)

> ---
> v2: Review by Arnout Vandecappelle
> 	Fix License

  Now I've looked at the license, it turns out to be _almost_ a BSD-3c. 
But not exactly, so 'Cache calibrator license' is a good approximation.

> 	Use $(TARGET_CFLAGS) and $(TARGET_LDFLAGS)
> 	Fix Typo
> 	Remove $(CACHE_CALIBRATOR_DIR)
> v3: Review by Thomas Petazzoni
> 	Fix CACHE_CALIBRATOR_EXTRACT_CMDS


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v3] New package: cache-calibrator
  2013-01-29  9:53 ` [Buildroot] [PATCH v3] " Stephan Hoffmann
  2013-01-29 17:47   ` Arnout Vandecappelle
@ 2013-01-29 20:33   ` Peter Korsgaard
  2013-01-30  7:51     ` Stephan Hoffmann
  1 sibling, 1 reply; 11+ messages in thread
From: Peter Korsgaard @ 2013-01-29 20:33 UTC (permalink / raw)
  To: buildroot

>>>>> "Stephan" == Stephan Hoffmann <sho@relinux.de> writes:

 Stephan> The Calibrator is a small C program that is supposed to analyze
 Stephan> a computers (cache-) memory system and extract the following
 Stephan> parameters:

 Stephan>     number of cache levels
 Stephan>     for each cache level:
 Stephan>         its size
 Stephan>         its linesize
 Stephan>         its access/miss latency
 Stephan>     main memory access latency
 Stephan>     number of TLB levels
 Stephan>     for each TLB level:
 Stephan>         its capacity (i.e. number of entries)
 Stephan>         the pagesize used
 Stephan>         the TLB miss latency

 Stephan> http://homepages.cwi.nl/~manegold/Calibrator/

 Stephan> It is also recommended as a load generator for realtime testing in:

 Stephan> https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#Benchmarking

 Stephan> Signed-off-by: Stephan Hoffmann <sho@relinux.de>
 Stephan> ---
 Stephan> v2: Review by Arnout Vandecappelle
 Stephan> 	Fix License
 Stephan> 	Use $(TARGET_CFLAGS) and $(TARGET_LDFLAGS)
 Stephan> 	Fix Typo
 Stephan> 	Remove $(CACHE_CALIBRATOR_DIR) 
 Stephan> v3: Review by Thomas Petazzoni
 Stephan> 	Fix CACHE_CALIBRATOR_EXTRACT_CMDS

 Stephan> @@ -0,0 +1,13 @@
 Stephan> +config BR2_PACKAGE_CACHE_CALIBRATOR
 Stephan> +	bool "cache-calibrator"
 Stephan> +	help
 Stephan> +	  Cache calibrator is a small C program that is
 Stephan> +	  supposed to analyze a computers (cache-) memory
 Stephan> +	  system and extract useful information
 Stephan> +
 Stephan> +	  http://homepages.cwi.nl/~manegold/Calibrator/
 Stephan> +
 Stephan> +	  It is also recommended as a load generator for
 Stephan> +	  realtime testing in:

We normally wrap help text around col 70, not 50. I've reformatted this
to better fit menuconfig.


 Stephan> +++ b/package/cache-calibrator/cache-calibrator.mk
 Stephan> @@ -0,0 +1,24 @@
 Stephan> +#############################################################
 Stephan> +#
 Stephan> +# cache-calibrator
 Stephan> +#
 Stephan> +#############################################################
 Stephan> +
 Stephan> +CACHE_CALIBRATOR_SOURCE = calibrator.c
 Stephan> +CACHE_CALIBRATOR_SITE = http://homepages.cwi.nl/~manegold/Calibrator/src
 Stephan> +CACHE_CALIBRATOR_LICENSE = Cache calibrator license
 Stephan> +CACHE_CALIBRATOR_LICENSE_FILES = calibrator.c
 Stephan> +
 Stephan> +define CACHE_CALIBRATOR_EXTRACT_CMDS
 Stephan> +	cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(D)

Did you test this? It is $(@D) not $(D) (which expands to the empty
string)

Committed with these fixes, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v3] New package: cache-calibrator
  2013-01-29 20:33   ` Peter Korsgaard
@ 2013-01-30  7:51     ` Stephan Hoffmann
  0 siblings, 0 replies; 11+ messages in thread
From: Stephan Hoffmann @ 2013-01-30  7:51 UTC (permalink / raw)
  To: buildroot

Am 29.01.2013 21:33, schrieb Peter Korsgaard:
>>>>>> "Stephan" == Stephan Hoffmann <sho@relinux.de> writes:
>  Stephan> The Calibrator is a small C program that is supposed to analyze
>  Stephan> a computers (cache-) memory system and extract the following
>  Stephan> parameters:
>
>  Stephan>     number of cache levels
>  Stephan>     for each cache level:
>  Stephan>         its size
>  Stephan>         its linesize
>  Stephan>         its access/miss latency
>  Stephan>     main memory access latency
>  Stephan>     number of TLB levels
>  Stephan>     for each TLB level:
>  Stephan>         its capacity (i.e. number of entries)
>  Stephan>         the pagesize used
>  Stephan>         the TLB miss latency
>
>  Stephan> http://homepages.cwi.nl/~manegold/Calibrator/
>
>  Stephan> It is also recommended as a load generator for realtime testing in:
>
>  Stephan> https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#Benchmarking
>
>  Stephan> Signed-off-by: Stephan Hoffmann <sho@relinux.de>
>  Stephan> ---
>  Stephan> v2: Review by Arnout Vandecappelle
>  Stephan> 	Fix License
>  Stephan> 	Use $(TARGET_CFLAGS) and $(TARGET_LDFLAGS)
>  Stephan> 	Fix Typo
>  Stephan> 	Remove $(CACHE_CALIBRATOR_DIR) 
>  Stephan> v3: Review by Thomas Petazzoni
>  Stephan> 	Fix CACHE_CALIBRATOR_EXTRACT_CMDS
>
>  Stephan> @@ -0,0 +1,13 @@
>  Stephan> +config BR2_PACKAGE_CACHE_CALIBRATOR
>  Stephan> +	bool "cache-calibrator"
>  Stephan> +	help
>  Stephan> +	  Cache calibrator is a small C program that is
>  Stephan> +	  supposed to analyze a computers (cache-) memory
>  Stephan> +	  system and extract useful information
>  Stephan> +
>  Stephan> +	  http://homepages.cwi.nl/~manegold/Calibrator/
>  Stephan> +
>  Stephan> +	  It is also recommended as a load generator for
>  Stephan> +	  realtime testing in:
>
> We normally wrap help text around col 70, not 50. I've reformatted this
> to better fit menuconfig.
>
>
>  Stephan> +++ b/package/cache-calibrator/cache-calibrator.mk
>  Stephan> @@ -0,0 +1,24 @@
>  Stephan> +#############################################################
>  Stephan> +#
>  Stephan> +# cache-calibrator
>  Stephan> +#
>  Stephan> +#############################################################
>  Stephan> +
>  Stephan> +CACHE_CALIBRATOR_SOURCE = calibrator.c
>  Stephan> +CACHE_CALIBRATOR_SITE = http://homepages.cwi.nl/~manegold/Calibrator/src
>  Stephan> +CACHE_CALIBRATOR_LICENSE = Cache calibrator license
>  Stephan> +CACHE_CALIBRATOR_LICENSE_FILES = calibrator.c
>  Stephan> +
>  Stephan> +define CACHE_CALIBRATOR_EXTRACT_CMDS
>  Stephan> +	cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(D)
>
> Did you test this? It is $(@D) not $(D) (which expands to the empty
> string)
You're right, I did not. Thanx for the fix.

Stephan
>
> Committed with these fixes, thanks.
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-01-30  7:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29  8:31 [Buildroot] [PATCH] New package: cache-calibrator Stephan Hoffmann
2013-01-29  8:52 ` Thomas Petazzoni
2013-01-29  9:07 ` Peter Korsgaard
2013-01-29  9:15 ` Stephan Hoffmann
2013-01-29  9:21   ` Stephan Hoffmann
2013-01-29  9:25     ` Peter Korsgaard
2013-01-29  9:36     ` Thomas Petazzoni
2013-01-29  9:53 ` [Buildroot] [PATCH v3] " Stephan Hoffmann
2013-01-29 17:47   ` Arnout Vandecappelle
2013-01-29 20:33   ` Peter Korsgaard
2013-01-30  7:51     ` Stephan Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox