Blame view

buildroot/buildroot-2016.08.1/package/cache-calibrator/0001-Fix-conflicting-round-function.patch 5.7 KB
6b13f685e   김민수   BSP 최초 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
  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, ")
  ");
   	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, ")
  ");
   	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
  ", l + 1, z, xl, z);
   		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0
  ", 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)
  ", 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, ")
  ");
   	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
  ", l + 1, z, xl, z);
   		fprintf(fp, "set arrow %ld from %f,%f to %f,%f nohead lt 0
  ", 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
  ", NSperIt(cache->latency1[0]), round(CYperIt(cache->latency1[0])));
  +	fprintf(fp, " %6.2f ns = %3ld cy
  ", NSperIt(cache->latency1[0]), lng_round(CYperIt(cache->latency1[0])));
   	fprintf(fp, "             ( delay:    ");
  -	fprintf(fp, " %6.2f ns = %3ld cy )
  ", NSperIt(delay),            round(CYperIt(delay)));
  +	fprintf(fp, " %6.2f ns = %3ld cy )
  ", NSperIt(delay),            lng_round(CYperIt(delay)));
   	fprintf(fp, "
  ");
   	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
  ", 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
  ", NSperIt(cache->latency1[l + 1] - cache->latency1[l]), lng_round(CYperIt(cache->latency1[l + 1] - cache->latency1[l])));
   	}
   	fprintf(fp, "
  ");
   	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, "
  ");
   	}
  -- 
  1.7.0.4