summaryrefslogtreecommitdiffstats
path: root/meta-linaro/recipes-extra/calibrator/files/fix_conflicting_types_for_round.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-linaro/recipes-extra/calibrator/files/fix_conflicting_types_for_round.patch')
-rw-r--r--meta-linaro/recipes-extra/calibrator/files/fix_conflicting_types_for_round.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/meta-linaro/recipes-extra/calibrator/files/fix_conflicting_types_for_round.patch b/meta-linaro/recipes-extra/calibrator/files/fix_conflicting_types_for_round.patch
new file mode 100644
index 0000000..b7e7a64
--- /dev/null
+++ b/meta-linaro/recipes-extra/calibrator/files/fix_conflicting_types_for_round.patch
@@ -0,0 +1,95 @@
1Description: rename round() to rnd() to fix conflicting types for 'round' error
2Author: Fathi Boudra <fathi.boudra@linaro.org>
3
4---
5 calibrator.c | 30 +++++++++++++++---------------
6 1 file changed, 15 insertions(+), 15 deletions(-)
7
8--- a/calibrator.c
9+++ b/calibrator.c
10@@ -128,7 +128,7 @@ void ErrXit(char *format, ...) {
11 exit(1);
12 }
13
14-lng round(dbl x)
15+lng rnd(dbl x)
16 {
17 return (lng)(x + 0.5);
18 }
19@@ -890,16 +890,16 @@ void plotCache(cacheInfo *cache, lng **r
20 fprintf(fp, ")\n");
21 fprintf(fp, "set y2tics");
22 for (l = 0, s = " ("; l <= cache->levels; l++, s = ", ") {
23- if (!delay) fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
24- else fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
25+ if (!delay) fprintf(fp, "%s'(%ld)' %f", s, rnd(CYperIt(cache->latency1[l] - delay)), NSperIt(cache->latency1[l] - delay));
26+ else fprintf(fp, "%s'(%ld)' %f", s, rnd(CYperIt(cache->latency2[l] - delay)), NSperIt(cache->latency2[l] - delay));
27 }
28 for (y = 1; y <= yh; y *= 10) {
29 fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
30 }
31 fprintf(fp, ")\n");
32 for (l = 0; l <= cache->levels; l++) {
33- if (!delay) z = (dbl)round(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
34- else z = (dbl)round(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
35+ if (!delay) z = (dbl)rnd(CYperIt(cache->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
36+ else z = (dbl)rnd(CYperIt(cache->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
37 fprintf(fp, "set label %ld '(%1.3g) ' at %f,%f right\n", l + 1, z, xl, z);
38 fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
39 }
40@@ -986,16 +986,16 @@ void plotTLB(TLBinfo *TLB, lng **result,
41 fprintf(fp, "%s'<L1>' %ld)\n", s, TLB->mincachelines);
42 fprintf(fp, "set y2tics");
43 for (l = 0, s = " ("; l <= TLB->levels; l++, s = ", ") {
44- if (!delay) fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
45- else fprintf(fp, "%s'(%ld)' %f", s, round(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
46+ if (!delay) fprintf(fp, "%s'(%ld)' %f", s, rnd(CYperIt(TLB->latency1[l] - delay)), NSperIt(TLB->latency1[l] - delay));
47+ else fprintf(fp, "%s'(%ld)' %f", s, rnd(CYperIt(TLB->latency2[l] - delay)), NSperIt(TLB->latency2[l] - delay));
48 }
49 for (y = 1; y <= yh; y *= 10) {
50 fprintf(fp, "%s'%1.3g' %ld", s, (dbl)(y * MHz) / 1000.0, y);
51 }
52 fprintf(fp, ")\n");
53 for (l = 0; l <= TLB->levels; l++) {
54- if (!delay) z = (dbl)round(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
55- else z = (dbl)round(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
56+ if (!delay) z = (dbl)rnd(CYperIt(TLB->latency1[l] - delay)) * 1000.0 / (dbl)MHz;
57+ else z = (dbl)rnd(CYperIt(TLB->latency2[l] - delay)) * 1000.0 / (dbl)MHz;
58 fprintf(fp, "set label %ld '(%1.3g) ' at %f,%f right\n", l + 1, z, xl, z);
59 fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0\n", l + 1, xl, z, xh, z);
60 }
61@@ -1023,9 +1023,9 @@ void printCPU(cacheInfo *cache, lng MHz,
62 FILE *fp = stdout;
63
64 fprintf(fp, "CPU loop + L1 access: ");
65- fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), round(CYperIt(cache->latency1[0])));
66+ fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[0]), rnd(CYperIt(cache->latency1[0])));
67 fprintf(fp, " ( delay: ");
68- fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay), round(CYperIt(delay)));
69+ fprintf(fp, " %6.2f ns = %3ld cy )\n", NSperIt(delay), rnd(CYperIt(delay)));
70 fprintf(fp, "\n");
71 fflush(fp);
72 }
73@@ -1047,8 +1047,8 @@ void printCache(cacheInfo *cache, lng MH
74 fprintf(fp, " %3ld KB ", cache->size[l] / 1024);
75 }
76 fprintf(fp, " %3ld bytes ", cache->linesize[l + 1]);
77- fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), round(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
78- 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])));
79+ fprintf(fp, " %6.2f ns = %3ld cy " , NSperIt(cache->latency2[l + 1] - cache->latency2[l]), rnd(CYperIt(cache->latency2[l + 1] - cache->latency2[l])));
80+ fprintf(fp, " %6.2f ns = %3ld cy\n", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), rnd(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
81 }
82 fprintf(fp, "\n");
83 fflush(fp);
84@@ -1075,9 +1075,9 @@ void printTLB(TLBinfo *TLB, lng MHz)
85 } else {
86 fprintf(fp, " %3ld KB ", TLB->pagesize[l + 1] / 1024);
87 }
88- fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), round(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
89+ fprintf(fp, " %6.2f ns = %3ld cy ", NSperIt(TLB->latency2[l + 1] - TLB->latency2[l]), rnd(CYperIt(TLB->latency2[l + 1] - TLB->latency2[l])));
90 /*
91- fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), round(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
92+ fprintf(fp, " %6.2f ns = %3ld cy" , NSperIt(TLB->latency1[l + 1] - TLB->latency1[l]), rnd(CYperIt(TLB->latency1[l + 1] - TLB->latency1[l])));
93 */
94 fprintf(fp, "\n");
95 }