sl@0
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\misc\cpumeter.cia
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32test.h>
|
sl@0
|
19 |
#include <e32hal.h>
|
sl@0
|
20 |
#include <u32std.h>
|
sl@0
|
21 |
|
sl@0
|
22 |
extern TUint32 NopCount;
|
sl@0
|
23 |
extern TUint MaxCycles;
|
sl@0
|
24 |
|
sl@0
|
25 |
#if defined(__CPU_ARM)
|
sl@0
|
26 |
__NAKED__ TInt CountNops(TAny*)
|
sl@0
|
27 |
{
|
sl@0
|
28 |
__SWITCH_TO_ARM;
|
sl@0
|
29 |
asm("ldr r0, __NopCount ");
|
sl@0
|
30 |
asm("mov r1, #0 ");
|
sl@0
|
31 |
|
sl@0
|
32 |
asm("loop: ");
|
sl@0
|
33 |
asm("mov r0, r0 ");
|
sl@0
|
34 |
asm("mov r0, r0 ");
|
sl@0
|
35 |
asm("mov r0, r0 ");
|
sl@0
|
36 |
asm("mov r0, r0 ");
|
sl@0
|
37 |
asm("mov r0, r0 ");
|
sl@0
|
38 |
asm("mov r0, r0 ");
|
sl@0
|
39 |
asm("mov r0, r0 ");
|
sl@0
|
40 |
asm("mov r0, r0 ");
|
sl@0
|
41 |
asm("mov r0, r0 ");
|
sl@0
|
42 |
asm("mov r0, r0 ");
|
sl@0
|
43 |
asm("mov r0, r0 ");
|
sl@0
|
44 |
asm("mov r0, r0 ");
|
sl@0
|
45 |
asm("mov r0, r0 ");
|
sl@0
|
46 |
asm("mov r0, r0 ");
|
sl@0
|
47 |
asm("mov r0, r0 ");
|
sl@0
|
48 |
asm("mov r0, r0 ");
|
sl@0
|
49 |
asm("mov r0, r0 ");
|
sl@0
|
50 |
asm("mov r0, r0 ");
|
sl@0
|
51 |
asm("mov r0, r0 ");
|
sl@0
|
52 |
asm("mov r0, r0 ");
|
sl@0
|
53 |
asm("mov r0, r0 ");
|
sl@0
|
54 |
asm("mov r0, r0 ");
|
sl@0
|
55 |
asm("mov r0, r0 ");
|
sl@0
|
56 |
asm("mov r0, r0 ");
|
sl@0
|
57 |
asm("mov r0, r0 ");
|
sl@0
|
58 |
asm("mov r0, r0 ");
|
sl@0
|
59 |
asm("mov r0, r0 ");
|
sl@0
|
60 |
asm("mov r0, r0 ");
|
sl@0
|
61 |
asm("mov r0, r0 ");
|
sl@0
|
62 |
asm("mov r0, r0 ");
|
sl@0
|
63 |
asm("mov r0, r0 ");
|
sl@0
|
64 |
asm("mov r0, r0 ");
|
sl@0
|
65 |
asm("mov r0, r0 ");
|
sl@0
|
66 |
asm("mov r0, r0 ");
|
sl@0
|
67 |
asm("mov r0, r0 ");
|
sl@0
|
68 |
asm("mov r0, r0 ");
|
sl@0
|
69 |
asm("mov r0, r0 ");
|
sl@0
|
70 |
asm("mov r0, r0 ");
|
sl@0
|
71 |
asm("mov r0, r0 ");
|
sl@0
|
72 |
asm("mov r0, r0 ");
|
sl@0
|
73 |
asm("mov r0, r0 ");
|
sl@0
|
74 |
asm("mov r0, r0 ");
|
sl@0
|
75 |
asm("mov r0, r0 ");
|
sl@0
|
76 |
asm("mov r0, r0 ");
|
sl@0
|
77 |
asm("mov r0, r0 ");
|
sl@0
|
78 |
asm("mov r0, r0 ");
|
sl@0
|
79 |
asm("mov r0, r0 ");
|
sl@0
|
80 |
asm("mov r0, r0 ");
|
sl@0
|
81 |
asm("mov r0, r0 ");
|
sl@0
|
82 |
asm("mov r0, r0 ");
|
sl@0
|
83 |
asm("mov r0, r0 ");
|
sl@0
|
84 |
asm("mov r0, r0 ");
|
sl@0
|
85 |
asm("mov r0, r0 ");
|
sl@0
|
86 |
asm("mov r0, r0 ");
|
sl@0
|
87 |
asm("mov r0, r0 ");
|
sl@0
|
88 |
asm("mov r0, r0 ");
|
sl@0
|
89 |
asm("mov r0, r0 ");
|
sl@0
|
90 |
asm("mov r0, r0 ");
|
sl@0
|
91 |
asm("mov r0, r0 ");
|
sl@0
|
92 |
asm("mov r0, r0 ");
|
sl@0
|
93 |
asm("mov r0, r0 ");
|
sl@0
|
94 |
asm("mov r0, r0 ");
|
sl@0
|
95 |
asm("mov r0, r0 ");
|
sl@0
|
96 |
asm("mov r0, r0 ");
|
sl@0
|
97 |
asm("add r1, r1, #71 ");
|
sl@0
|
98 |
asm("str r1, [r0] ");
|
sl@0
|
99 |
asm("b loop ");
|
sl@0
|
100 |
|
sl@0
|
101 |
asm("mov r0, #0 ");
|
sl@0
|
102 |
__JUMP(,lr);
|
sl@0
|
103 |
|
sl@0
|
104 |
asm("__NopCount: ");
|
sl@0
|
105 |
asm(".word NopCount ");
|
sl@0
|
106 |
__END_ARM;
|
sl@0
|
107 |
}
|
sl@0
|
108 |
#elif defined(__CPU_X86)
|
sl@0
|
109 |
__NAKED__ TInt CountNops(TAny*)
|
sl@0
|
110 |
{
|
sl@0
|
111 |
#ifdef __WINS__
|
sl@0
|
112 |
__asm lea edx, NopCount
|
sl@0
|
113 |
__asm mov eax, 0
|
sl@0
|
114 |
noploop:
|
sl@0
|
115 |
__asm inc eax
|
sl@0
|
116 |
__asm inc eax
|
sl@0
|
117 |
__asm inc eax
|
sl@0
|
118 |
__asm inc eax
|
sl@0
|
119 |
__asm inc eax
|
sl@0
|
120 |
__asm inc eax
|
sl@0
|
121 |
__asm inc eax
|
sl@0
|
122 |
__asm inc eax
|
sl@0
|
123 |
__asm inc eax
|
sl@0
|
124 |
__asm inc eax
|
sl@0
|
125 |
__asm inc eax
|
sl@0
|
126 |
__asm inc eax
|
sl@0
|
127 |
__asm inc eax
|
sl@0
|
128 |
__asm inc eax
|
sl@0
|
129 |
__asm inc eax
|
sl@0
|
130 |
__asm inc eax
|
sl@0
|
131 |
__asm inc eax
|
sl@0
|
132 |
__asm inc eax
|
sl@0
|
133 |
__asm inc eax
|
sl@0
|
134 |
__asm inc eax
|
sl@0
|
135 |
__asm inc eax
|
sl@0
|
136 |
__asm inc eax
|
sl@0
|
137 |
__asm inc eax
|
sl@0
|
138 |
__asm inc eax
|
sl@0
|
139 |
__asm inc eax
|
sl@0
|
140 |
__asm inc eax
|
sl@0
|
141 |
__asm inc eax
|
sl@0
|
142 |
__asm inc eax
|
sl@0
|
143 |
__asm inc eax
|
sl@0
|
144 |
__asm inc eax
|
sl@0
|
145 |
__asm inc eax
|
sl@0
|
146 |
__asm inc eax
|
sl@0
|
147 |
__asm inc eax
|
sl@0
|
148 |
__asm inc eax
|
sl@0
|
149 |
__asm inc eax
|
sl@0
|
150 |
__asm inc eax
|
sl@0
|
151 |
__asm inc eax
|
sl@0
|
152 |
__asm inc eax
|
sl@0
|
153 |
__asm inc eax
|
sl@0
|
154 |
__asm inc eax
|
sl@0
|
155 |
__asm inc eax
|
sl@0
|
156 |
__asm inc eax
|
sl@0
|
157 |
__asm inc eax
|
sl@0
|
158 |
__asm inc eax
|
sl@0
|
159 |
__asm inc eax
|
sl@0
|
160 |
__asm inc eax
|
sl@0
|
161 |
__asm inc eax
|
sl@0
|
162 |
__asm inc eax
|
sl@0
|
163 |
__asm inc eax
|
sl@0
|
164 |
__asm inc eax
|
sl@0
|
165 |
__asm inc eax
|
sl@0
|
166 |
__asm inc eax
|
sl@0
|
167 |
__asm inc eax
|
sl@0
|
168 |
__asm inc eax
|
sl@0
|
169 |
__asm inc eax
|
sl@0
|
170 |
__asm inc eax
|
sl@0
|
171 |
__asm inc eax
|
sl@0
|
172 |
__asm inc eax
|
sl@0
|
173 |
__asm inc eax
|
sl@0
|
174 |
__asm inc eax
|
sl@0
|
175 |
__asm inc eax
|
sl@0
|
176 |
__asm inc eax
|
sl@0
|
177 |
__asm inc eax
|
sl@0
|
178 |
__asm inc eax
|
sl@0
|
179 |
__asm add eax, 3
|
sl@0
|
180 |
__asm mov [edx], eax
|
sl@0
|
181 |
__asm jmp noploop
|
sl@0
|
182 |
#else
|
sl@0
|
183 |
asm("mov edx, %a0": : "i"(&NopCount));
|
sl@0
|
184 |
asm("mov eax, 0");
|
sl@0
|
185 |
asm("noploop:");
|
sl@0
|
186 |
asm("inc eax");
|
sl@0
|
187 |
asm("inc eax");
|
sl@0
|
188 |
asm("inc eax");
|
sl@0
|
189 |
asm("inc eax");
|
sl@0
|
190 |
asm("inc eax");
|
sl@0
|
191 |
asm("inc eax");
|
sl@0
|
192 |
asm("inc eax");
|
sl@0
|
193 |
asm("inc eax");
|
sl@0
|
194 |
asm("inc eax");
|
sl@0
|
195 |
asm("inc eax");
|
sl@0
|
196 |
asm("inc eax");
|
sl@0
|
197 |
asm("inc eax");
|
sl@0
|
198 |
asm("inc eax");
|
sl@0
|
199 |
asm("inc eax");
|
sl@0
|
200 |
asm("inc eax");
|
sl@0
|
201 |
asm("inc eax");
|
sl@0
|
202 |
asm("inc eax");
|
sl@0
|
203 |
asm("inc eax");
|
sl@0
|
204 |
asm("inc eax");
|
sl@0
|
205 |
asm("inc eax");
|
sl@0
|
206 |
asm("inc eax");
|
sl@0
|
207 |
asm("inc eax");
|
sl@0
|
208 |
asm("inc eax");
|
sl@0
|
209 |
asm("inc eax");
|
sl@0
|
210 |
asm("inc eax");
|
sl@0
|
211 |
asm("inc eax");
|
sl@0
|
212 |
asm("inc eax");
|
sl@0
|
213 |
asm("inc eax");
|
sl@0
|
214 |
asm("inc eax");
|
sl@0
|
215 |
asm("inc eax");
|
sl@0
|
216 |
asm("inc eax");
|
sl@0
|
217 |
asm("inc eax");
|
sl@0
|
218 |
asm("inc eax");
|
sl@0
|
219 |
asm("inc eax");
|
sl@0
|
220 |
asm("inc eax");
|
sl@0
|
221 |
asm("inc eax");
|
sl@0
|
222 |
asm("inc eax");
|
sl@0
|
223 |
asm("inc eax");
|
sl@0
|
224 |
asm("inc eax");
|
sl@0
|
225 |
asm("inc eax");
|
sl@0
|
226 |
asm("inc eax");
|
sl@0
|
227 |
asm("inc eax");
|
sl@0
|
228 |
asm("inc eax");
|
sl@0
|
229 |
asm("inc eax");
|
sl@0
|
230 |
asm("inc eax");
|
sl@0
|
231 |
asm("inc eax");
|
sl@0
|
232 |
asm("inc eax");
|
sl@0
|
233 |
asm("inc eax");
|
sl@0
|
234 |
asm("inc eax");
|
sl@0
|
235 |
asm("inc eax");
|
sl@0
|
236 |
asm("inc eax");
|
sl@0
|
237 |
asm("inc eax");
|
sl@0
|
238 |
asm("inc eax");
|
sl@0
|
239 |
asm("inc eax");
|
sl@0
|
240 |
asm("inc eax");
|
sl@0
|
241 |
asm("inc eax");
|
sl@0
|
242 |
asm("inc eax");
|
sl@0
|
243 |
asm("inc eax");
|
sl@0
|
244 |
asm("inc eax");
|
sl@0
|
245 |
asm("inc eax");
|
sl@0
|
246 |
asm("inc eax");
|
sl@0
|
247 |
asm("inc eax");
|
sl@0
|
248 |
asm("inc eax");
|
sl@0
|
249 |
asm("inc eax");
|
sl@0
|
250 |
asm("add eax, 3");
|
sl@0
|
251 |
asm("mov [edx], eax");
|
sl@0
|
252 |
asm("jmp noploop");
|
sl@0
|
253 |
#endif
|
sl@0
|
254 |
}
|
sl@0
|
255 |
#endif
|
sl@0
|
256 |
|