-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReadMe.txt
267 lines (210 loc) · 7.07 KB
/
ReadMe.txt
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
Dhrystone 2 uses dhry_1.c, dhry_2.c and dhry.h
Dhrystone 1 uses dhry1.c
The source code is as used for the first versions of this collection
to compile to run via DOS, Windows and OS/2. The revised versions use
QueryPerformanceCounter and QueryPerformanceFrequency functions for
better timer resolution and faster running time with appropriate
changes to calibration variables.
Folder MSC6 contains the latest versions of the programs which
compile with Microsoft Visual C++ 6.0. The programs check numeric
results for correct values and floating point answers can be
different. Those set as defaults are as found for the MS compiler
but the ones for Watcom are included. These programs also use asm
for assembly instructions instead of #pragma (see below).See listings
in this folder for descriptions.
The only real change to code is for calibration in LLLOOPS.CPP as
follows. This prevents what appears to be non-ending calibration
time when one loop is excessively slow (only seen when compiled
for a DEC Alpha CPU).
if (RunTime[section][i] < 0.07)
{
least = 0.0;
RunTime[section][i] = 0.05;
}
and
extra_loops[section][i] = (long)(5.0 / RunTime[section][i]
* lmult) +1;
are changed to (also note run time changes):
if (RunTime[section][i] < 0.001)
{
least = 0.0;
RunTime[section][i] = 0.0008;
extra_loops[section][i] = extra_loops[section][i] * 2;
}
and
extra_loops[section][i] = (long)(runSecs / RunTime[section][i]
* (double)extra_loops[section][i] * lmult) +1;
Additional code is as follows:
WhatConfig();
fprintf(Ap,"%s\n", configData1);
fprintf(Ap,"%s\n", configData2);
fprintf(Ap,"%s\n\n", configData3);
produces the following (example):
Windows NT Version 5.0, build 2195, Service Pack 2
CPU AuthenticAMD, Features Code 0183F9FF, Model Code 00000630, 950 MHz
Memory 523760 KB, Free 435540 KB
#include <windows.h>
double secs;
LARGE_INTEGER starttime;
char timeday[30];
char configData1[200];
char configData2[200];
char configData3[200];
char configData4[200];
int hasMMX;
double runSecs = 1;
unsigned int megaHz;
DWORD ramsize;
DWORD freesize;
char idString[20];
unsigned int eaxCode;
unsigned int eaxCode1;
unsigned int edxCode;
unsigned int startCount;
unsigned int endCount;
#define MM_EXTENSION 0x00800000
// Following assembly required for Watcom 10.5
// other benchmarks use the same assemby code
// with asm declaration and no .586.
#pragma aux getCPUstring = \
".586" \
"lea edi, idString" \
"mov eax, 0" \
"cpuid" \
"mov[edi], ebx" \
"mov[edi+4], edx" \
"mov[edi+8], ecx" \
"mov[edi+12], 0" \
"mov eaxCode1, eax" \
modify [eax edi];
#pragma aux getCPUDetails = \
".586" \
"mov eax, 1" \
"cpuid" \
"mov eaxCode, eax" \
"mov edxCode, edx" \
modify [eax edx];
#pragma aux getStart = \
".586" \
"rdtsc" \
"mov startCount, eax" \
modify [eax];
#pragma aux getEnd = \
".586" \
"mov edx, 1000" \
"lp: dec edx" \
"jnz lp" \
"rdtsc" \
"mov endCount, eax" \
modify [eax edx];
void start_time()
{
QueryPerformanceCounter(&starttime);
}
void end_time()
{
LARGE_INTEGER liDiff;
LARGE_INTEGER liFreq;
QueryPerformanceCounter(&liDiff);
liDiff.QuadPart -= starttime.QuadPart;
(void)QueryPerformanceFrequency(&liFreq);
secs = (double)liDiff.QuadPart / (double) liFreq.QuadPart;
}
void local_time()
{
time_t time_of_day;
time_of_day = time( NULL );
strcpy (timeday, ctime(&time_of_day)); /* timeday = date and time */
return;
}
void WhatConfig()
{
OSVERSIONINFO vers;
char szosBuild[20] = "";
char os[100];
SYSTEM_INFO info;
BOOL OldSys;
MEMORYSTATUS lpBuffer;
hasMMX = 0;
// **************** OS *********************
vers.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&vers);
if (vers.dwPlatformId == VER_PLATFORM_WIN32s)
{
strcpy(os, " Windows 3.1");
}
else if (vers.dwPlatformId == 1) // VER_PLATFORM_WIN32_WINDOWS)
{
strcpy(os, " Windows 95");
if (vers.dwMinorVersion > 0) strcpy(os, " Windows 98");
sprintf(szosBuild, "build %d,", (DWORD)(LOWORD(vers.dwBuildNumber)));
}
else if (vers.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
strcpy(os, " Windows NT");
sprintf(szosBuild, "build %d,", vers.dwBuildNumber);
}
else
{
strcpy(os, "OS?");
}
sprintf (configData1, "%s Version %d.%d, %s %s",
os, vers.dwMajorVersion,
vers.dwMinorVersion, szosBuild, vers.szCSDVersion);
// **************** CPU *********************
lpBuffer.dwLength = sizeof(MEMORYSTATUS);
GetSystemInfo(&info);
OldSys = FALSE;
if (info.dwProcessorType == PROCESSOR_INTEL_386)
{
strcpy(configData2, " CPU Type 80386");
OldSys = TRUE;
}
if (info.dwProcessorType == PROCESSOR_INTEL_486)
{
strcpy(configData2, " CPU Type 80486");
OldSys = TRUE;
}
if (!OldSys)
{
getCPUstring();
getCPUDetails();
calculateMHz();
if (edxCode & MM_EXTENSION) hasMMX = 1;
sprintf(configData2, " CPU %s, Features Code %8.8X, Model Code %8.8X, %d MHz",
idString, edxCode, eaxCode, megaHz);
}
GlobalMemoryStatus(&lpBuffer);
ramsize = lpBuffer.dwTotalPhys;
freesize = lpBuffer.dwAvailPhys;
sprintf(configData3, " Memory %d KB, Free %d KB", ramsize / 1024, freesize / 1024);
sprintf(configData4, " Memory Load %d. Paging MB %d, Free %d. User Virtual MB %d, Free %d.",
lpBuffer.dwMemoryLoad,
lpBuffer.dwTotalPageFile/1024/1024,
lpBuffer.dwAvailPageFile/1024/1024,
lpBuffer.dwTotalVirtual/1024/1024,
lpBuffer.dwAvailVirtual/1024/1024);
}
void calculateMHz(void)
{
unsigned int i, max;
unsigned int cycleCount = 0;
startCount = 0;
endCount = 0;
max = 0;
for (i=0; i<10; i++)
{
start_time();
getStart();
do
{
getEnd();
end_time();
}
while (secs < 0.01);
cycleCount = endCount - startCount;
megaHz = (unsigned int)((double)cycleCount / 1000000.0 / secs + 0.5);
if (megaHz > max) max = megaHz;
}
megaHz = max;
}