package/aubio: add libsndfile optional dependency
[buildroot-gz.git] / package / cache-calibrator / 0001-Fix-conflicting-round-function.patch
blob71181a638789dc34ba00dd0aa5e272ea0e530bd2
1 From 39ac7268c4350040976005da98daf10edf676d3e Mon Sep 17 00:00:00 2001
2 From: Stephan Hoffmann <sho@relinux.de>
3 Date: Mon, 28 Jan 2013 17:32:10 +0100
4 Subject: [PATCH] Fix conflicting round() function
6 calibrator.c defines a local round() function that conflicts
7 with the one from the standard library.
9 This is fixed by renaming the local function.
11 Signed-off-by: Stephan Hoffmann <sho@relinux.de>
12 ---
13 calibrator.c | 30 +++++++++++++++---------------
14 1 files changed, 15 insertions(+), 15 deletions(-)
16 diff --git a/calibrator.c b/calibrator.c
17 index e045dfd..8471c04 100644
18 --- a/calibrator.c
19 +++ b/calibrator.c
20 @@ -128,7 +128,7 @@ void ErrXit(char *format, ...) {
21 exit(1);
24 -lng round(dbl x)
25 +lng lng_round(dbl x)
27 return (lng)(x + 0.5);
29 @@ -890,16 +890,16 @@ void plotCache(cacheInfo *cache, lng **result, lng MHz, char *fn, FILE *fp, lng
30 fprintf(fp, ")\n");
31 fprintf(fp, "set y2tics");
32 for (l = 0, s = " ("; l <= cache->levels; l++, s = ", ") {
33 - if (!delay) fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
34 - else fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
35 + if (!delay) fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
36 + else fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
38 for (y = 1; y <= yh; y *= 10) {
39 fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
41 fprintf(fp, ")\n");
42 for (l = 0; l <= cache->levels; l++) {
43 - if (!delay) z = (dbl)round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
44 - else z = (dbl)round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
45 + if (!delay) z = (dbl)lng_round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
46 + else z = (dbl)lng_round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
47 fprintf(fp, "set label %ld '(%1.3g) ' at %f,%f right\n", l + 1, z, xl, z);
48 fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
50 @@ -986,16 +986,16 @@ void plotTLB(TLBinfo *TLB, lng **result, lng MHz, char *fn, FILE *fp, lng delay)
51 fprintf(fp, "%s'<L1>' %ld)\n", s, TLB->mincachelines);
52 fprintf(fp, "set y2tics");
53 for (l = 0, s = " ("; l <= TLB->levels; l++, s = ", ") {
54 - if (!delay) fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
55 - else fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
56 + if (!delay) fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
57 + else fprintf(fp, "%s'(%ld)' %f", s, lng_round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
59 for (y = 1; y <= yh; y *= 10) {
60 fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
62 fprintf(fp, ")\n");
63 for (l = 0; l <= TLB->levels; l++) {
64 - if (!delay) z = (dbl)round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
65 - else z = (dbl)round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
66 + if (!delay) z = (dbl)lng_round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
67 + else z = (dbl)lng_round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
68 fprintf(fp, "set label %ld '(%1.3g) ' at %f,%f right\n", l + 1, z, xl, z);
69 fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
71 @@ -1023,9 +1023,9 @@ void printCPU(cacheInfo *cache, lng MHz, lng delay)
72 FILE *fp = stdout;
74 fprintf(fp, "CPU loop + L1 access: ");
75 - fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), round(CYperIt(cache->latency1[0])));
76 + fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), lng_round(CYperIt(cache->latency1[0])));
77 fprintf(fp, " ( delay: ");
78 - fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay), round(CYperIt(delay)));
79 + fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay), lng_round(CYperIt(delay)));
80 fprintf(fp, "\n");
81 fflush(fp);
83 @@ -1047,8 +1047,8 @@ void printCache(cacheInfo *cache, lng MHz)
84 fprintf(fp, " %3ld KB ", cache->size[l] / 1024);
86 fprintf(fp, " %3ld bytes ", cache->linesize[l + 1]);
87 - fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
88 - 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])));
89 + 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])));
90 + 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])));
92 fprintf(fp, "\n");
93 fflush(fp);
94 @@ -1075,9 +1075,9 @@ void printTLB(TLBinfo *TLB, lng MHz)
95 } else {
96 fprintf(fp, " %3ld KB ", TLB->pagesize[l + 1] / 1024);
98 - fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
99 + 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])));
101 - fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
102 + 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])));
104 fprintf(fp, "\n");
107 1.7.0.4