Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

usrbench.c File Reference

#include "precomp.h"
#include "resource.h"
#include "wchar.h"
#include "usrbench.h"
#include "bench.h"

Go to the source code of this file.

Defines

#define MAIN_MODULE
#define SUBITEM(fmt, v)

Functions

LRESULT APIENTRY MDIChildWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL APIENTRY InitializeInstance (HINSTANCE hInst, HINSTANCE hPrev, INT nCmdShow)
int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int cmdShow)
LRESULT FAR PASCAL WndProc (HWND hWnd, unsigned msg, WPARAM wParam, LPARAM lParam)
VOID SaveResults ()
INT_PTR APIENTRY ResultsDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
INT_PTR APIENTRY HelpDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
char * SelectOutFileName (HWND hWnd)
void WriteBatchResults (FILE *fpOut, int TestType, int cycle)
int SyncMenuChecks (HWND hWnd, int Last_Checked, int New_Checked)
int Std_Parse (char *txtbuf, int limit, int *array)

Variables

PSZ pszTest = DEFAULT_A_STRING
PWSTR pwszTest = DEFAULT_W_STRING
BOOL gfPentium = FALSE
BOOL gfUseCycleCount = TRUE
HINSTANCE hInstMain
HANDLE ghaccel
HANDLE ghinst
HWND ghwndFrame = NULL ghwndMDIClient = NULL
MDICREATESTRUCT mcs
CHAR szChild [] = "child"
CHAR szFrame [] = "frame"
CHOOSEFONT cf
LOGFONT lf


Define Documentation

#define MAIN_MODULE
 

Definition at line 57 of file usrbench.c.

#define SUBITEM fmt,
 ) 
 

Value:

sprintf(szT, fmt, v); \ ListView_SetItemText(hwndList, lvl.iItem, ++lvl.iSubItem, szT);

Referenced by ResultsDlgProc().


Function Documentation

INT_PTR APIENTRY HelpDlgProc HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 1500 of file usrbench.c.

References EndDialog(), FALSE, IDC_HELPLIST, msg, SendDlgItemMessage(), and TRUE.

Referenced by WndProc().

01505 { 01506 ULONG ix, last_ix; 01507 static const char* szT[] = { 01508 "Usage:", 01509 "usrbench (interactive mode), or ", 01510 "usrbench /b (batch mode)", 01511 " /d (Print detailed distribution if more than 5 percent of samples filtered out)", 01512 " /m (Message when batch finished)", 01513 " /s (Stay, don't close application when batch finished)", 01514 " /t (Batch and Interactive Modes; Measure test time - not Cycle Counts, on Pentium Machines)", 01515 " /i [INI filename] (optional, def.= USRBATCH.INI )", 01516 "", 01517 "Batch Mode requires preparing an INI file (default: USRBATCH.INI) in the same directory where the application is being run.", 01518 "You may also specify an INI filename using /i [INI filename] in the command line (must reside in the directory mentioned above).", 01519 "", 01520 "INI file Sections and Keys: (Use ' , ' or ' ; ' as separators where necessary)", 01521 "[BATCH]", 01522 "RUN= ALL / QUICK / TEXT / SELECT (Test type, select one, def.= TEXT", 01523 "CYCLE= (No. of batch cycles, def.= 1)", 01524 "TEST= test numbers (Selected tests to run, needed only for test type= SELECT)", 01525 "[TEXT]", 01526 "FONT = name, +optional parameters (Font name + any combination of:", 01527 " BOLD, ITALIC, UNDERLINE, STRIKE, TRANSPARENT, RGB(r,g,b), def.= Arial)", 01528 "STRING_CONTENT= string (Text string to be used, up to 128 characters)", 01529 "[RUN]", 01530 "FONT_SIZE= font sizes (Font sizes to be tested, def. 12)", 01531 "STRING_LENGTH= string lengths (String Length to be tested, taken as sub-strings of the one specified, def. 32)", 01532 "ORDER= test loop order (Order of test loops (first is outer); example: FONT_SIZE STRING_LENGTH )", 01533 "", 01534 "Batch Output:", 01535 "Output files will be generated automatically in the run directory, with the name [USBxxx.log], where xxx is a number.", 01536 "Note that the program will refuse to run if more than 200 output files are accumulated...", 01537 }; 01538 01539 int aiT[2]; 01540 01541 switch (msg) { 01542 case WM_INITDIALOG: 01543 aiT[0] = 100; 01544 aiT[1] = 190; 01545 SendDlgItemMessage(hwnd, IDC_HELPLIST, LB_SETTABSTOPS, 2, 01546 (LPARAM)aiT); 01547 01548 for (ix = 0; ix < sizeof szT / sizeof szT[0]; ix++) { 01549 SendDlgItemMessage(hwnd, IDC_HELPLIST, LB_ADDSTRING, 0, 01550 (LPARAM)szT[ix]); 01551 } 01552 01553 01554 break; 01555 01556 case WM_COMMAND: 01557 switch (LOWORD(wParam)) { 01558 case IDOK: 01559 EndDialog(hwnd, 0); 01560 break; 01561 default: 01562 return FALSE; 01563 } 01564 break; 01565 01566 default: 01567 return FALSE; 01568 } 01569 01570 return TRUE; 01571 }

BOOL APIENTRY InitializeInstance HINSTANCE  hInst,
HINSTANCE  hPrev,
INT  nCmdShow
 

Definition at line 1995 of file usrbench.c.

References APIENTRY, BOOL, FALSE, GetClientRect(), GetDesktopWindow(), GetWindowRect(), ghinst, ghwndFrame, ghwndMDIClient, hInst, IDNOTE, IDR_USRBENCH_MENU, mcs, MDIChildWndProc(), NULL, RegisterClass, SendMessage(), SetFocus, ShowWindow, szChild, szFrame, TRUE, UINT, UpdateWindow(), and WndProc().

Referenced by WinMain().

01999 { 02000 02001 WNDCLASS wc; 02002 HWND hWndDesk; 02003 RECT hwRect; 02004 RECT rc; 02005 02006 CLIENTCREATESTRUCT ccs; 02007 02008 hWndDesk = GetDesktopWindow(); 02009 GetWindowRect(hWndDesk,&hwRect); 02010 02011 if (!hPrev) 02012 { 02013 wc.hInstance = hInst; 02014 wc.hCursor = LoadCursor((HINSTANCE)NULL, IDC_ARROW); 02015 wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDR_USRBENCH_MENU)); 02016 wc.lpszMenuName = MAKEINTRESOURCE(IDR_USRBENCH_MENU); 02017 wc.lpszClassName = szFrame; 02018 wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); 02019 wc.style = (UINT)0; 02020 wc.lpfnWndProc = WndProc; 02021 wc.cbWndExtra = 0; 02022 wc.cbClsExtra = 0; 02023 02024 02025 if (!RegisterClass(&wc)) { 02026 return FALSE; 02027 } 02028 /* 02029 * Register the MDI child class 02030 */ 02031 wc.lpfnWndProc = MDIChildWndProc; 02032 wc.hIcon = LoadIcon(ghinst, IDNOTE); 02033 wc.lpszMenuName = NULL; 02034 wc.cbWndExtra = sizeof(HWND); 02035 wc.lpszClassName = szChild; 02036 02037 if(!RegisterClass(&wc))return FALSE; 02038 02039 02040 } 02041 02042 02043 // 02044 // Create and show the main Frame window 02045 // 02046 02047 ghwndFrame = CreateWindow (szFrame, 02048 "USER Call Performance", 02049 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 02050 0, 02051 0, 02052 hwRect.right, 02053 hwRect.bottom, 02054 (HWND)NULL, 02055 (HMENU)NULL, 02056 (HINSTANCE)hInst, 02057 (LPSTR)NULL 02058 ); 02059 02060 if (ghwndFrame == NULL) { 02061 return(FALSE); 02062 02063 } 02064 02065 // 02066 // Show the window 02067 // 02068 02069 ShowWindow(ghwndFrame,nCmdShow); 02070 UpdateWindow(ghwndFrame); 02071 SetFocus(ghwndFrame); 02072 02073 // Create a Desktop Window inside the Frame Window 02074 02075 ccs.hWindowMenu = NULL; 02076 ccs.idFirstChild = 0; 02077 02078 GetClientRect(ghwndFrame, (LPRECT)&rc); 02079 02080 ghwndMDIClient = CreateWindow("mdiclient", 02081 "Desktop", 02082 WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | WS_BORDER, 02083 rc.left, 02084 rc.top+100, 02085 rc.right-rc.left, 02086 rc.bottom-(rc.top+100), 02087 ghwndFrame, 02088 (HMENU)0xCAC, 02089 ghinst, 02090 (LPSTR)&ccs 02091 ); 02092 02093 if (ghwndMDIClient == NULL) { 02094 return(FALSE); 02095 } 02096 02097 /* 02098 * Create MDI child window for potential use of Userbench tests. 02099 */ 02100 02101 mcs.szClass = "mdiclient"; 02102 mcs.szTitle = "Test Object"; 02103 mcs.hOwner = ghinst; 02104 mcs.x = mcs.cx = CW_USEDEFAULT; 02105 mcs.y = mcs.cy = CW_USEDEFAULT; 02106 mcs.style = WS_OVERLAPPEDWINDOW; 02107 02108 SendMessage(ghwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); 02109 02110 return TRUE; 02111 }

LRESULT APIENTRY MDIChildWndProc HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 1934 of file usrbench.c.

References APIENTRY, FALSE, GetClientRect(), GetWindowLongPtr(), ghinst, ghwndMDIClient, GWLP_HWNDEDIT, ID_EDIT, msg, NULL, SetFocus, SetWindowLongPtr(), and TRUE.

Referenced by InitializeInstance().

01939 { 01940 HWND hwndEdit; 01941 01942 switch (msg) { 01943 case WM_MDICREATE: 01944 01945 /* 01946 * Create an edit control 01947 */ 01948 hwndEdit = CreateWindow("edit", NULL, 01949 WS_CHILD | WS_HSCROLL | WS_MAXIMIZE | WS_VISIBLE | 01950 WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | WS_OVERLAPPEDWINDOW, 01951 0, 0, 0, 0, ghwndMDIClient, (HMENU)ID_EDIT, ghinst, NULL); 01952 01953 /* 01954 * Remember the window handle and initialize some window attributes 01955 */ 01956 SetWindowLongPtr(hwnd, GWLP_HWNDEDIT, (LONG_PTR)hwndEdit); 01957 SetFocus(hwndEdit); 01958 break; 01959 01960 case WM_CLOSE: 01961 break; 01962 01963 case WM_SIZE: { 01964 RECT rc; 01965 01966 /* 01967 * On creation or resize, size the edit control. 01968 */ 01969 01970 hwndEdit = (HWND)GetWindowLongPtr(hwnd, GWLP_HWNDEDIT); 01971 GetClientRect(hwnd, &rc); 01972 MoveWindow(hwndEdit, rc.left, rc.top, 01973 rc.right - rc.left, rc.bottom - rc.top, TRUE); 01974 return DefMDIChildProc(hwnd, msg, wParam, lParam); 01975 } 01976 01977 case WM_SETFOCUS: 01978 SetFocus((HWND)GetWindowLongPtr(hwnd, GWLP_HWNDEDIT)); 01979 break; 01980 01981 default: 01982 return DefMDIChildProc(hwnd, msg, wParam, lParam); 01983 } 01984 01985 return FALSE; 01986 }

INT_PTR APIENTRY ResultsDlgProc HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 1398 of file usrbench.c.

References _TEST_ENTRY::Api, _TEST_STATS::Average, BOOL, EndDialog(), FALSE, GetClientRect(), GetDlgItem(), gfPentium, gTestEntry, IDC_RESULTSLIST, IDM_SAVERESULTS, msg, NULL, NUM_SAMPLES, NUM_TESTS, SaveResults(), SUBITEM, TestStats, TRUE, and UINT.

Referenced by WndProc().

01403 { 01404 ULONG ix; 01405 char szT[180]; 01406 BOOL fResults; 01407 int aiT[2]; 01408 01409 switch (msg) { 01410 case WM_INITDIALOG: 01411 aiT[0] = 100; 01412 aiT[1] = 190; 01413 fResults = FALSE; 01414 01415 { 01416 LV_COLUMN lvc; 01417 LV_ITEM lvl; 01418 UINT width; 01419 RECT rc; 01420 HWND hwndList = GetDlgItem(hwnd, IDC_RESULTSLIST); 01421 int i; 01422 static LPCSTR title[] = { 01423 "Function", "Time(100ns)", "StdDev%", "Best", "Worst", 01424 "Valid Samples", "Out of", "Iterations", 01425 }; 01426 #ifdef _X86_ 01427 if (gfPentium) 01428 title[1] = "Cycle Counts"; 01429 #endif 01430 if (hwndList == NULL) 01431 break; 01432 GetClientRect(hwndList, &rc); 01433 // only first column has doubled width 01434 lvc.cx = (width = (rc.right - rc.left) / (sizeof title / sizeof *title + 1)) * 2; 01435 lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; 01436 lvc.fmt = LVCFMT_LEFT; 01437 for (i = 0; i < sizeof title / sizeof *title; ++i) { 01438 lvc.pszText = (LPSTR)title[i]; 01439 ListView_InsertColumn(hwndList, i, &lvc); 01440 lvc.cx = width; // normal width 01441 } 01442 01443 lvl.iItem = 0; 01444 lvl.mask = LVIF_TEXT; 01445 for (ix = 0; ix < NUM_TESTS; ix++) { 01446 if ((long)(0.5 + TestStats[ix].Average) == 0) { 01447 // no measuement, skip 01448 continue; 01449 } 01450 lvl.iSubItem = 0; 01451 lvl.pszText = gTestEntry[ix].Api; 01452 ListView_InsertItem(hwndList, &lvl); 01453 #define SUBITEM(fmt, v) \ 01454 sprintf(szT, fmt, v); \ 01455 ListView_SetItemText(hwndList, lvl.iItem, ++lvl.iSubItem, szT); 01456 01457 SUBITEM("%ld", (long)(0.5 + TestStats[ix].Average)); 01458 SUBITEM("%.2f", (float)TestStats[ix].StdDev); 01459 SUBITEM("%ld", (long)(0.5 + TestStats[ix].Minimum_Result)); 01460 SUBITEM("%ld", (long)(0.5 + TestStats[ix].Maximum_Result)); 01461 SUBITEM("%ld", TestStats[ix].NumSamplesValid); 01462 SUBITEM("%ld", (long)NUM_SAMPLES); 01463 SUBITEM("%ld", gTestEntry[ix].Iter); 01464 #undef SUBITEM 01465 ++lvl.iItem; 01466 fResults = TRUE; 01467 } 01468 01469 if (!fResults) 01470 MessageBox(hwnd, "No results have been generated yet or Test may have failed!", 01471 "UsrBench", MB_OK | MB_ICONEXCLAMATION); 01472 } 01473 break; 01474 01475 case WM_COMMAND: 01476 switch (LOWORD(wParam)) { 01477 case IDOK: 01478 case IDCANCEL: 01479 EndDialog(hwnd, 0); 01480 break; 01481 01482 case IDM_SAVERESULTS: 01483 SaveResults(); 01484 break; 01485 01486 default: 01487 return FALSE; 01488 } 01489 break; 01490 01491 default: 01492 return FALSE; 01493 } 01494 01495 return TRUE; 01496 }

VOID SaveResults  ) 
 

Definition at line 1317 of file usrbench.c.

References BatchFlag, FALSE, ghwndFrame, hInstMain, NULL, and WriteBatchResults().

Referenced by ResultsDlgProc().

01318 { 01319 static OPENFILENAME ofn; 01320 static char szFilename[80]; 01321 char szT[80]; 01322 int i, hfile; 01323 FILE *fpOut; 01324 01325 BatchFlag = FALSE; 01326 01327 for (i = 0; i < sizeof(ofn); i++) 01328 { 01329 // 01330 // clear out the OPENFILENAME struct 01331 // 01332 01333 ((char *)&ofn)[i] = 0; 01334 } 01335 01336 ofn.lStructSize = sizeof(ofn); 01337 ofn.hwndOwner = ghwndFrame; 01338 ofn.hInstance = hInstMain; 01339 01340 ofn.lpstrFilter = "USRBench (*.cs;*.km)\0*.cs;*.km\0All Files\0*.*\0\0"; 01341 ofn.lpstrCustomFilter = NULL; 01342 ofn.nMaxCustFilter = 0; 01343 ofn.nFilterIndex = 0; 01344 ofn.lpstrFileTitle = NULL; 01345 ofn.nMaxFileTitle = 0; 01346 ofn.lpstrInitialDir = "C:\\"; 01347 ofn.Flags = 0; 01348 ofn.lpstrDefExt = NULL; 01349 ofn.lCustData = 0; 01350 ofn.lpfnHook = NULL; 01351 ofn.lpTemplateName = NULL; 01352 01353 lstrcpy(szFilename, "USRB001.km"); 01354 01355 ofn.lpstrFile = szFilename; 01356 ofn.nMaxFile = sizeof(szFilename); 01357 ofn.lpstrTitle = "Save As"; 01358 01359 if (!GetSaveFileName(&ofn)) 01360 { 01361 return; 01362 } 01363 01364 fpOut = fopen(szFilename, "w+"); 01365 if(NULL != fpOut) 01366 { 01367 WriteBatchResults(fpOut,0,0); 01368 fclose(fpOut); 01369 } 01370 else 01371 { 01372 MessageBox(ghwndFrame,"Cannot Open File to Save Results", "Output File Creation Error",MB_ICONSTOP|MB_OK); 01373 } 01374 01375 }

char* SelectOutFileName HWND  hWnd  ) 
 

Definition at line 1590 of file usrbench.c.

References buf2, hWnd, NULL, and sprintf().

Referenced by WndProc().

01592 { 01593 01594 static char buf[11]; 01595 char buf2[4]; 01596 FILE *fpFile; 01597 int i; 01598 01599 lstrcpy(buf,"usb"); 01600 01601 for (i=1; i<201; i++) // Allow for up to 200 output files to exist in current directory 01602 { 01603 sprintf(&buf[3],"%03s.log",_itoa(i,buf2,10)); 01604 01605 fpFile = fopen(&buf[0],"r"); // Try to open for read, if succeeds the file already exists 01606 // if fails, thats the next file selected 01607 if(NULL != fpFile) 01608 { 01609 fclose(fpFile); 01610 continue; 01611 } 01612 return buf; 01613 } 01614 01615 MessageBox(hWnd,"Cannot Continue, Limit of 200 usbxxx.log Output Files Exceeded, Please Clean Up! ", "Output File Creation Error",MB_ICONSTOP|MB_OK); 01616 return NULL; 01617 }

int Std_Parse char *  txtbuf,
int  limit,
int *  array
 

Definition at line 1886 of file usrbench.c.

References n.

Referenced by WndProc().

01887 { 01888 int i = 0; 01889 int n = 0; 01890 char tst[2]; 01891 01892 array[0] = 0; 01893 01894 do 01895 { 01896 sscanf(&txtbuf[n],"%1c",tst); 01897 01898 if((array[i] != 0)&&((tst[0] == ' ')||(tst[0] == ',')||(tst[0] == ';'))) 01899 { 01900 ++i; 01901 array[i] = 0; 01902 } 01903 01904 if(tst[0] == '\n') 01905 { 01906 ++i; 01907 break; 01908 } 01909 while((n<limit)&&((tst[0] == ' ')||(tst[0] == ',')||(tst[0] == ';'))) 01910 { 01911 ++n; 01912 sscanf(&txtbuf[n],"%1c",tst); 01913 } 01914 if(n>=limit) 01915 break; 01916 01917 array[i] = 10*array[i] + atoi(tst); 01918 ++n; 01919 01920 }while(n<limit ); 01921 01922 if(array[i] != 0) ++i; 01923 return i; 01924 }

int SyncMenuChecks HWND  hWnd,
int  Last_Checked,
int  New_Checked
 

Definition at line 1859 of file usrbench.c.

References CheckMenuItem(), GetMenu(), GetSubMenu(), and hWnd.

Referenced by WndProc().

01860 { 01861 HMENU hmenu = GetSubMenu(GetSubMenu(GetSubMenu(GetMenu(hWnd),2),0),0); 01862 CheckMenuItem(hmenu,Last_Checked,MF_BYPOSITION|MF_UNCHECKED); 01863 CheckMenuItem(hmenu,New_Checked,MF_BYPOSITION|MF_CHECKED); 01864 Last_Checked = New_Checked; 01865 return Last_Checked; 01866 }

int PASCAL WinMain HINSTANCE  hInst,
HINSTANCE  hPrev,
LPSTR  szCmdLine,
int  cmdShow
 

Definition at line 103 of file usrbench.c.

References BatchFlag, CMD_IS, DBGPRINT, DEFAULT_STRING_LENGTH, DispatchMessage(), Dont_Close_App, dwConsoleThreadId, FALSE, Finish_Message, GetMessage(), gfUseCycleCount, ghaccel, ghinst, ghwndFrame, ghwndMDIClient, hInst, hInstMain, IDM_HELP, IniFileName, InitConsoleIME(), InitializeInstance(), InputExceptionFilter, L, MAX_PATH, msg, NULL, PeekMessage(), Print_Detailed, RUN_BATCH, SelectedFontTransparent, SendMessage(), SourceString, SourceStringW, String_Length_Warn, StrLen, TextSuiteFlag, TranslateAccelerator, TranslateMDISysAccel(), TranslateMessage(), and TRUE.

00112 : 00113 00114 Process messages. 00115 00116 Arguments: 00117 00118 hWnd - window hande 00119 msg - type of message 00120 wParam - additional information 00121 lParam - additional information 00122 00123 Return Value: 00124 00125 status of operation 00126 00127 00128 Revision History: 00129 00130 02-17-91 Initial code 00131 00132 --*/ 00133 00134 00135 { 00136 MSG msg; 00137 HWND hWndDesk; 00138 HWND hwnd; 00139 HDC hdc2; 00140 00141 char txtbuf[80]; 00142 char *ptr; 00143 00144 hInstMain = hInst; 00145 ghinst = hInst; 00146 00147 // Initialize Instance, Create Frame Window, Desktop Window and an MDI client Window 00148 00149 if(!InitializeInstance(hInst, hPrev, cmdShow)) 00150 return FALSE; 00151 00152 // Initialize Source Strings 00153 00154 strcpy(SourceString, "This is just a silly test string. Would you rather have a different one? Well, you can define one if you run GDI bench in batch!"); 00155 wcscpy(SourceStringW, L"This is just a silly test string. Would you rather have a different one? Well, you can define one if you run GDI bench in batch!"); 00156 StrLen = DEFAULT_STRING_LENGTH; 00157 00158 // Batch Mode Related 00159 00160 TextSuiteFlag = FALSE; 00161 BatchFlag = FALSE; 00162 Finish_Message = FALSE; 00163 Dont_Close_App = FALSE; 00164 SelectedFontTransparent = FALSE; 00165 String_Length_Warn = FALSE; 00166 Print_Detailed = FALSE; 00167 00168 // GdiSetBatchLimit(1); // Kills all GDI Batching 00169 00170 00171 // Check for help or batch-mode command-line parameters 00172 00173 00174 if(CMD_IS("-?") || CMD_IS("/?") || CMD_IS("-h") || CMD_IS("-H") ||CMD_IS("/h") || CMD_IS("/H")) 00175 { 00176 SendMessage(ghwndFrame,WM_COMMAND,IDM_HELP,0L); // Show Help Dialog 00177 } 00178 00179 if (CMD_IS("-b") || CMD_IS("-B") || CMD_IS("/b") || CMD_IS("/B")) 00180 { 00181 BatchFlag = TRUE; 00182 GetCurrentDirectory(sizeof(IniFileName),IniFileName); // Prepare INI file path, append name later 00183 strcat(IniFileName,"\\"); 00184 } 00185 00186 if (CMD_IS("-m") || CMD_IS("-M") || CMD_IS("/m") || CMD_IS("/M")) 00187 Finish_Message = TRUE; 00188 00189 if ( CMD_IS("-s") || CMD_IS("-S") || CMD_IS("/s") || CMD_IS("/S")) 00190 Dont_Close_App = TRUE; 00191 00192 if ( CMD_IS("-t") || CMD_IS("-T") || CMD_IS("/t") || CMD_IS("/T")) 00193 gfUseCycleCount = FALSE; 00194 00195 if ( CMD_IS("-d") || CMD_IS("-D") || CMD_IS("/d") || CMD_IS("/D")) 00196 Print_Detailed = TRUE; 00197 00198 00199 if ( CMD_IS("-i")) 00200 { 00201 ptr = strstr(szCmdLine, "-i"); 00202 sscanf(ptr+2,"%s",txtbuf); 00203 strcat(IniFileName,txtbuf); 00204 } 00205 else if (CMD_IS("-I")) 00206 { 00207 ptr = strstr(szCmdLine, "-I"); 00208 sscanf(ptr+2,"%s",txtbuf); 00209 strcat(IniFileName,txtbuf); 00210 } 00211 else if (CMD_IS("/i")) 00212 { 00213 ptr = strstr(szCmdLine, "/i"); 00214 sscanf(ptr+2,"%s",txtbuf); 00215 strcat(IniFileName,txtbuf); 00216 } 00217 else if (CMD_IS("/I")) 00218 { 00219 ptr = strstr(szCmdLine, "/I"); 00220 sscanf(ptr+2,"%s",txtbuf); 00221 strcat(IniFileName,txtbuf); 00222 } 00223 else 00224 { 00225 strcat(IniFileName,"USRBATCH.INI"); 00226 } 00227 00228 if(BatchFlag == TRUE) { 00229 /* 00230 * Suck any messages out of the queue before starting to avoid 00231 * contaminating our results. 00232 */ 00233 while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) 00234 { 00235 TranslateMessage(&msg); 00236 DispatchMessage(&msg); 00237 } 00238 00239 SendMessage(ghwndFrame,WM_COMMAND,RUN_BATCH,0L); // Start Batch 00240 } 00241 00242 // 00243 // Main message loop 00244 // 00245 00246 while (GetMessage(&msg,(HWND)NULL,0,0)) 00247 { 00248 /* 00249 * If a keyboard message is for the MDI, let the MDI client 00250 * take care of it. Otherwise, check to see if it's a normal 00251 * accelerator key (like F3 = find next). Otherwise, just handle 00252 * the message as usual. 00253 */ 00254 if (!TranslateMDISysAccel(ghwndMDIClient, &msg) && 00255 !TranslateAccelerator(ghwndFrame, ghaccel, &msg)) { 00256 TranslateMessage(&msg); 00257 DispatchMessage(&msg); 00258 } 00259 00260 } 00261 00262 return (int)msg.wParam; 00263 }

LRESULT FAR PASCAL WndProc HWND  hWnd,
unsigned  msg,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 268 of file usrbench.c.

References ALL, AppendMenu(), BatchCycle, BatchFlag, BeginPaint, BOOL, BYTE, cf, CheckMenuItem(), DEFAULT_A_STRING, DestString, DestStringW, Detailed_Data, Dont_Close_App, FALSE, FillRect(), Finish_Message, FIRST_TEXT_FUNCTION, fpIniFile, fpOutFile, Get_Stats(), GetDC, GetMenu(), GetSubMenu(), GetWindow(), ghwndMDIClient, gTestEntry, HelpDlgProc(), HI_FILTER, hInstMain, hWnd, ID_TEST_START, IDD_HELP, IDD_RESULTS, IDM_EXIT, IDM_FONT, IDM_HELP, IDM_QRUN1, IDM_QRUN2, IDM_RUN, IDM_S001, IDM_S002, IDM_S004, IDM_S008, IDM_S016, IDM_S032, IDM_S064, IDM_S128, IDM_SHOW, IDM_TRANSPARENT, Index, IniFileName, _TEST_ENTRY::Iter, L, LAST_TEXT_FUNCTION, lf, mcs, msg, n, NULL, NUM_QTESTS, NUM_SAMPLES, NUM_TESTS, OutFileName, PerformanceFreq, _TEST_ENTRY::pfn, PFN_MS, POINTS_PER_INCH, PostQuitMessage(), pszTest, pwszTest, QUICK, ReleaseDC(), _TEST_ENTRY::Result, ResultsDlgProc(), RUN_BATCH, SELECT, SelectedFontTransparent, SelectOutFileName(), SendMessage(), ShowCursor(), SourceString, SourceStringW, Status, Std_Parse(), String_Length_Warn, StringLength(), StrLen, strlen(), Sum, SyncMenuChecks(), Test(), TestStats, TEXT_SUITE, TextSuiteFlag, TRUE, VAR_LIMIT, and WriteBatchResults().

00276 : 00277 00278 Process messages. 00279 00280 Arguments: 00281 00282 hWnd - window hande 00283 msg - type of message 00284 wParam - additional information 00285 lParam - additional information 00286 00287 Return Value: 00288 00289 status of operation 00290 00291 00292 Revision History: 00293 00294 02-17-91 Initial code 00295 00296 --*/ 00297 00298 { 00299 00300 BOOL Status; 00301 UCHAR tmsg[256]; 00302 int MBresult; 00303 char txtbuf[80]; 00304 char strbuf[256]; 00305 char tmpbuf[5][20]; 00306 int i,j,k,n; 00307 char *kptr; 00308 char TestTypeEntry[16]; 00309 int TestType; 00310 int Num_Selected_Tests; 00311 int Test_Item[25]; 00312 char SelectedFont[32]; 00313 int SelectedFontSize = 12; 00314 BYTE SelectedFontBold = FALSE; 00315 BYTE SelectedFontItalic = FALSE; 00316 BYTE SelectedFontUnderline = FALSE; 00317 BYTE SelectedFontStrike = FALSE; 00318 COLORREF SelectedFontColor = RGB(0,0,0); 00319 char tst[2]; 00320 BYTE FontRed, FontGreen, FontBlue; 00321 char TextString[256]; 00322 int No_String_Lengths, No_Font_Sizes; 00323 int StringLength[16], FontSize[16]; 00324 int Source_String_Length; 00325 int Text_Test_Order[16]; 00326 int VPixelsPerLogInch; 00327 static int Last_Checked = 5; 00328 00329 double Sum; 00330 double Sample[NUM_SAMPLES]; 00331 00332 static HDC hdc2; /* display DC handle */ 00333 static HFONT hfont; /* new logical font handle */ 00334 static HFONT hfontOld; /* original logical font handle */ 00335 static COLORREF crOld; /* original text color */ 00336 00337 00338 switch (msg) { 00339 00340 case WM_CREATE: 00341 { 00342 ULONG ix; 00343 HWND hwnd; 00344 HMENU hAdd = GetSubMenu(GetMenu(hWnd),1); 00345 HMENU hmenu = GetSubMenu(GetSubMenu(GetSubMenu(GetMenu(hWnd),2),0),0); 00346 00347 for (ix=0;ix<NUM_TESTS;ix++) 00348 { 00349 00350 if ((ix > 0) && ((ix % 20) == 0)) 00351 { 00352 AppendMenu(hAdd, MF_MENUBARBREAK | MF_SEPARATOR,0,0); 00353 } 00354 00355 wsprintf(tmsg,"T%i: %s",ix,gTestEntry[ix].Api); 00356 AppendMenu(hAdd, MF_STRING | MF_ENABLED, ID_TEST_START + ix, tmsg); 00357 } 00358 00359 CheckMenuItem(hmenu,5,MF_BYPOSITION|MF_CHECKED); 00360 00361 } 00362 break; 00363 case WM_COMMAND: 00364 { 00365 00366 switch (LOWORD(wParam)){ 00367 case IDM_EXIT: 00368 { 00369 SendMessage(hWnd,WM_CLOSE,0,0L); 00370 } 00371 break; 00372 00373 case IDM_SHOW: 00374 DialogBox(hInstMain, (LPSTR)IDD_RESULTS, hWnd, ResultsDlgProc); 00375 break; 00376 00377 case IDM_HELP: 00378 DialogBox(hInstMain, (LPSTR)IDD_HELP, hWnd, HelpDlgProc); 00379 break; 00380 00381 // 00382 // Choose and Set Text String Length 00383 // 00384 00385 case IDM_S001: 00386 { 00387 StrLen = 1; 00388 Last_Checked = SyncMenuChecks(hWnd, Last_Checked, 0); 00389 } 00390 break; 00391 00392 case IDM_S002: 00393 { 00394 StrLen = 2; 00395 Last_Checked = SyncMenuChecks(hWnd, Last_Checked, 1); 00396 00397 } 00398 break; 00399 00400 case IDM_S004: 00401 { 00402 StrLen = 4; 00403 Last_Checked = SyncMenuChecks(hWnd, Last_Checked, 2); 00404 00405 } 00406 break; 00407 00408 case IDM_S008: 00409 { 00410 StrLen = 8; 00411 Last_Checked = SyncMenuChecks(hWnd, Last_Checked, 3); 00412 00413 } 00414 break; 00415 00416 case IDM_S016: 00417 { 00418 StrLen = 16; 00419 Last_Checked = SyncMenuChecks(hWnd, Last_Checked, 4); 00420 00421 } 00422 break; 00423 00424 case IDM_S032: 00425 { 00426 StrLen = 32; 00427 Last_Checked = SyncMenuChecks(hWnd, Last_Checked, 5); 00428 00429 } 00430 break; 00431 00432 case IDM_S064: 00433 { 00434 StrLen = 64; 00435 Last_Checked = SyncMenuChecks(hWnd, Last_Checked, 6); 00436 00437 } 00438 break; 00439 00440 case IDM_S128: 00441 { 00442 StrLen = 128; 00443 Last_Checked = SyncMenuChecks(hWnd, Last_Checked, 7); 00444 00445 } 00446 break; 00447 00448 // case IDM_SXXX: 00449 // 00450 // break; 00451 00452 case IDM_TRANSPARENT: 00453 { 00454 HMENU hmenu = GetSubMenu(GetSubMenu(GetMenu(hWnd),2),0); 00455 if(SelectedFontTransparent == TRUE) 00456 { 00457 SelectedFontTransparent = FALSE; 00458 CheckMenuItem(hmenu,2,MF_BYPOSITION|MF_UNCHECKED); 00459 } 00460 else if(SelectedFontTransparent == FALSE) 00461 { 00462 SelectedFontTransparent = TRUE; 00463 CheckMenuItem(hmenu,2,MF_BYPOSITION|MF_CHECKED); 00464 } 00465 } 00466 break; 00467 00468 00469 case IDM_FONT: // Invoke the ChooseFont Dialog (interactive mode) 00470 { 00471 /* Initialize the necessary members */ 00472 00473 cf.lStructSize = sizeof (CHOOSEFONT); 00474 cf.hwndOwner = hWnd; 00475 cf.lpLogFont = &lf; 00476 cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT; 00477 cf.nFontType = SCREEN_FONTTYPE; 00478 /* 00479 * Display the dialog box, allow the user to 00480 * choose a font, and render the text in the 00481 * window with that selection. 00482 */ 00483 if (ChooseFont(&cf)){ 00484 hdc2 = GetDC(hWnd); 00485 hfont = CreateFontIndirect(cf.lpLogFont); 00486 hfontOld = SelectObject(hdc2, hfont); 00487 crOld = SetTextColor(hdc2, cf.rgbColors); 00488 00489 } 00490 00491 } 00492 break; 00493 00494 // 00495 // Run all tests 00496 // 00497 00498 case IDM_RUN: // Run all tests 00499 { 00500 ULONG Index; 00501 PFN_MS pfn; 00502 HDC hdc = GetDC(hWnd); 00503 RECT CliRect = {20,20,500,40}; 00504 00505 if(NULL==GetWindow(ghwndMDIClient,GW_CHILD)) //If Test Object doesn't exist 00506 SendMessage(ghwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); //Create Test Object 00507 00508 for (Index=0;Index<NUM_TESTS;Index++) 00509 { 00510 HDC hdc2 = GetDC(hWnd); 00511 00512 FillRect(hdc,&CliRect,GetStockObject(GRAY_BRUSH)); 00513 wsprintf(tmsg,"Testing %s",gTestEntry[Index].Api); 00514 TextOut(hdc2,20,20,tmsg,strlen(tmsg)); 00515 pfn = gTestEntry[Index].pfn; 00516 ShowCursor(FALSE); 00517 00518 hfont = CreateFontIndirect(cf.lpLogFont); 00519 hfontOld = SelectObject(hdc2, hfont); 00520 crOld = SetTextColor(hdc2, cf.rgbColors); 00521 if(SelectedFontTransparent)SetBkMode(hdc2,TRANSPARENT); 00522 00524 00525 for(j=0; j<NUM_SAMPLES; j++) 00526 { 00527 00528 GdiFlush(); 00529 00530 Sample[j] = (double)(*pfn)(hdc2,gTestEntry[Index].Iter); 00531 Detailed_Data[Index][j] = (long)(0.5 + Sample[j]); 00532 } 00533 00534 Get_Stats(Sample,NUM_SAMPLES,HI_FILTER,VAR_LIMIT,&TestStats[Index]); 00536 00537 ShowCursor(TRUE); 00538 00539 SetTextColor(hdc, crOld); 00540 SelectObject(hdc, hfontOld); 00541 DeleteObject(hfont); 00542 SetBkMode(hdc2,OPAQUE); 00543 00544 ReleaseDC(hWnd,hdc2); 00545 } 00546 00547 ReleaseDC(hWnd,hdc); 00548 if(BatchFlag != TRUE) 00549 DialogBox(hInstMain, (LPSTR)IDD_RESULTS, hWnd, ResultsDlgProc); 00550 } 00551 break; 00552 00553 case IDM_QRUN1: // Run the quick test suite 1 00554 { 00555 ULONG Index; 00556 PFN_MS pfn; 00557 HDC hdc = GetDC(hWnd); 00558 RECT CliRect = {20,20,500,40}; 00559 00560 00561 if(NULL==GetWindow(ghwndMDIClient,GW_CHILD)) //If Test Object doesn't exist 00562 SendMessage(ghwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); //Create Test Object 00563 00564 for (Index=0;Index<NUM_QTESTS;Index++) 00565 { 00566 HDC hdc2 = GetDC(hWnd); 00567 00568 FillRect(hdc,&CliRect,GetStockObject(GRAY_BRUSH)); 00569 wsprintf(tmsg,"Testing %s",gTestEntry[Index].Api); 00570 TextOut(hdc2,20,20,tmsg,strlen(tmsg)); 00571 pfn = gTestEntry[Index].pfn; 00572 ShowCursor(FALSE); 00573 00574 hfont = CreateFontIndirect(cf.lpLogFont); 00575 hfontOld = SelectObject(hdc2, hfont); 00576 crOld = SetTextColor(hdc2, cf.rgbColors); 00577 if(SelectedFontTransparent)SetBkMode(hdc2,TRANSPARENT); 00578 00580 00581 for(j=0; j<NUM_SAMPLES; j++) 00582 { 00583 00584 GdiFlush(); 00585 00586 Sample[j] = (double)(*pfn)(hdc2,gTestEntry[Index].Iter); 00587 Detailed_Data[Index][j] = (long)(0.5 + Sample[j]); 00588 } 00589 00590 Get_Stats(Sample,NUM_SAMPLES,HI_FILTER,VAR_LIMIT,&TestStats[Index]); 00592 00593 00594 ShowCursor(TRUE); 00595 00596 SetTextColor(hdc, crOld); 00597 SelectObject(hdc, hfontOld); 00598 DeleteObject(hfont); 00599 SetBkMode(hdc2,OPAQUE); 00600 ReleaseDC(hWnd,hdc2); 00601 } 00602 00603 ReleaseDC(hWnd,hdc); 00604 00605 if(BatchFlag != TRUE) 00606 DialogBox(hInstMain, (LPSTR)IDD_RESULTS, hWnd, ResultsDlgProc); 00607 } 00608 break; 00609 00610 case IDM_QRUN2: // Run Quick Test Suite 2 00611 { 00612 ULONG Index; 00613 PFN_MS pfn; 00614 HDC hdc = GetDC(hWnd); 00615 RECT CliRect = {20,20,500,40}; 00616 00617 TextSuiteFlag = TRUE; 00618 00619 if(NULL==GetWindow(ghwndMDIClient,GW_CHILD)) //If Test Object doesn't exist 00620 SendMessage(ghwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); //Create Test Object 00621 00622 for (Index = FIRST_TEXT_FUNCTION; Index <= LAST_TEXT_FUNCTION; Index++) 00623 { 00624 HDC hdc2 = GetDC(hWnd); 00625 00626 FillRect(hdc,&CliRect,GetStockObject(GRAY_BRUSH)); 00627 wsprintf(tmsg,"Testing %s",gTestEntry[Index].Api); 00628 TextOut(hdc2,20,20,tmsg,strlen(tmsg)); 00629 pfn = gTestEntry[Index].pfn; 00630 ShowCursor(FALSE); 00631 00632 hfont = CreateFontIndirect(cf.lpLogFont); 00633 hfontOld = SelectObject(hdc2, hfont); 00634 crOld = SetTextColor(hdc2, cf.rgbColors); 00635 if(SelectedFontTransparent)SetBkMode(hdc2,TRANSPARENT); 00637 00638 for(j=0; j<NUM_SAMPLES; j++) 00639 { 00640 00641 GdiFlush(); 00642 00643 Sample[j] = (double)(*pfn)(hdc2,gTestEntry[Index].Iter); 00644 Detailed_Data[Index][j] = (long)(0.5 + Sample[j]); 00645 00646 } 00647 00648 Get_Stats(Sample,NUM_SAMPLES,HI_FILTER,VAR_LIMIT,&TestStats[Index]); 00650 00651 ShowCursor(TRUE); 00652 SetTextColor(hdc, crOld); 00653 SelectObject(hdc, hfontOld); 00654 DeleteObject(hfont); 00655 SetBkMode(hdc2,OPAQUE); 00656 00657 ReleaseDC(hWnd,hdc2); 00658 00659 } 00660 00661 ReleaseDC(hWnd,hdc); 00662 00663 if(BatchFlag != TRUE) 00664 DialogBox(hInstMain, (LPSTR)IDD_RESULTS, hWnd, ResultsDlgProc); 00665 00666 } 00667 break; 00668 00669 // 00670 // Run in Batch Mode 00671 // 00672 case RUN_BATCH: 00673 { 00674 fpIniFile = fopen(IniFileName,"r"); 00675 if(NULL == fpIniFile) 00676 { 00677 MessageBox(hWnd,"USRBATCH.INI File Not Found, Cannot Continue in Batch Mode","INI File Not Found",MB_ICONSTOP|MB_OK); 00678 BatchFlag = FALSE; 00679 break; 00680 } 00681 else //Start reading INI file Keys 00682 00683 { 00684 if(!GetPrivateProfileString("BATCH","RUN","TEXT",TestTypeEntry,sizeof(TestTypeEntry),IniFileName)) 00685 { 00686 MessageBox(hWnd,"Invalid Caption 1 in USRBATCH.INI File ", "INI File Error",MB_ICONSTOP|MB_OK); 00687 BatchFlag = FALSE; 00688 break; 00689 } 00690 00691 BatchCycle = GetPrivateProfileInt("BATCH","CYCLE",1,IniFileName); 00692 00693 if(NULL != strstr(TestTypeEntry, "ALL")) 00694 { 00695 TestType = ALL; 00696 } 00697 else if(NULL != strstr(TestTypeEntry, "QUICK")) 00698 { 00699 TestType = QUICK; 00700 } 00701 else if(NULL != strstr(TestTypeEntry, "TEXT")) 00702 { 00703 TestType = TEXT_SUITE; 00704 } 00705 else if(NULL != strstr(TestTypeEntry, "SELECT")) 00706 { 00707 TestType = SELECT; 00708 } 00709 else 00710 { 00711 MessageBox(hWnd,"Invalid or No Test-Type Entry in USRBATCH.INI File", "INI File Error",MB_ICONSTOP|MB_OK); 00712 BatchFlag = FALSE; 00713 break; 00714 } 00715 00716 switch (TestType) 00717 { 00718 case ALL: // Run all tests 00719 { 00720 fclose(fpIniFile); 00721 OutFileName = SelectOutFileName(hWnd); 00722 if(NULL == OutFileName) 00723 { 00724 BatchFlag = FALSE; 00725 break; 00726 } 00727 fpOutFile = fopen(OutFileName, "w+"); 00728 00729 for(i=0; i < BatchCycle; i++) 00730 { 00731 SendMessage(hWnd,WM_COMMAND,IDM_RUN,0L); 00732 WriteBatchResults(fpOutFile, TestType, i+1); 00733 } 00734 00735 fclose(fpOutFile); 00736 00737 if(Finish_Message == TRUE) 00738 { 00739 strcpy(txtbuf,"Batch Job Finished Successfully, Results Written to "); 00740 strcat(txtbuf,OutFileName); 00741 MessageBox(hWnd,txtbuf, "Batch Job Finished",MB_ICONINFORMATION|MB_OK); 00742 } 00743 00744 if(Dont_Close_App == TRUE) 00745 { 00746 BatchFlag = FALSE; 00747 for(i=0; i<(int)NUM_TESTS; i++) 00748 { 00749 gTestEntry[i].Result = 0; 00750 } 00751 } 00752 else 00753 { 00754 SendMessage(hWnd,WM_COMMAND,IDM_EXIT,0L); 00755 } 00756 00757 } 00758 00759 break; 00760 00761 case QUICK: // Run the quick suite 00762 { 00763 fclose(fpIniFile); 00764 00765 OutFileName = SelectOutFileName(hWnd); 00766 00767 fpOutFile = fopen(OutFileName, "w+"); 00768 if(NULL == fpOutFile) 00769 { 00770 BatchFlag = FALSE; 00771 break; 00772 } 00773 00774 for(i=0; i < BatchCycle; i++) 00775 { 00776 SendMessage(hWnd,WM_COMMAND,IDM_QRUN1,0L); 00777 WriteBatchResults(fpOutFile, TestType, i+1); 00778 } 00779 00780 fclose(fpOutFile); 00781 00782 if(Finish_Message == TRUE) 00783 { 00784 strcpy(txtbuf,"Batch Job Finished Successfully, Results Written to "); 00785 strcat(txtbuf,OutFileName); 00786 MessageBox(hWnd,txtbuf, "Batch Job Finished",MB_ICONINFORMATION|MB_OK); 00787 } 00788 00789 if(Dont_Close_App == TRUE) 00790 { 00791 BatchFlag = FALSE; 00792 for(i=0; i<(int)NUM_TESTS; i++) 00793 { 00794 gTestEntry[i].Result = 0; 00795 } 00796 } 00797 else 00798 { 00799 SendMessage(hWnd,WM_COMMAND,IDM_EXIT,0L); 00800 } 00801 00802 } 00803 break; 00804 00805 case TEXT_SUITE: // Get some more keys then run the text suite 00806 { 00807 00808 n = GetPrivateProfileString("TEXT","FONT","Arial",txtbuf,sizeof(txtbuf),IniFileName); 00809 00810 i = 0; 00811 00812 do 00813 { 00814 sscanf(&txtbuf[i],"%1c",tst); 00815 ++i; 00816 } 00817 while((i <= n ) && (tst[0] != ',') && (tst[0] != ';')); 00818 00819 strncpy(&SelectedFont[0],&txtbuf[0],i-1); 00820 strcpy(&SelectedFont[i-1],"\0"); 00821 00822 if(NULL != strstr(&txtbuf[i], "BOLD")) 00823 { 00824 SelectedFontBold = TRUE; 00825 } 00826 00827 if(NULL != strstr(&txtbuf[i], "ITALIC")) 00828 { 00829 SelectedFontItalic = TRUE; 00830 } 00831 00832 if(NULL != strstr(&txtbuf[i], "UNDERLINE")) 00833 { 00834 SelectedFontUnderline = TRUE; 00835 } 00836 00837 if(NULL != strstr(&txtbuf[i], "STRIKE")) 00838 { 00839 SelectedFontStrike = TRUE; 00840 } 00841 00842 if(NULL != strstr(&txtbuf[i], "TRANSPARENT")) 00843 { 00844 SelectedFontTransparent = TRUE; 00845 } 00846 00847 kptr = strstr(&txtbuf[0], "RGB("); // Parse and interpret the RGB values if exist 00848 if(NULL != kptr) 00849 { 00850 sscanf(kptr+4,"%s",tmpbuf[0]); 00851 00852 FontRed = 0; 00853 FontGreen = 0; 00854 FontBlue = 0; 00855 00856 j = 0; 00857 00858 sscanf(&tmpbuf[0][j],"%1c",tst); 00859 00860 while(tst[0] == ' ') 00861 { 00862 ++j; 00863 sscanf(&tmpbuf[0][j],"%1c",tst); 00864 } 00865 while(tst[0] != ',') 00866 { 00867 FontRed = 10*FontRed + atoi(tst); 00868 ++j; 00869 sscanf(&tmpbuf[0][j],"%1c",tst); 00870 } 00871 00872 ++j; 00873 sscanf(&tmpbuf[0][j],"%1c",tst); 00874 while(tst[0] == ' ') 00875 { 00876 ++j; 00877 sscanf(&tmpbuf[0][j],"%1c",tst); 00878 } 00879 while(tst[0] != ',') 00880 { 00881 FontGreen = 10*FontGreen + atoi(tst); 00882 ++j; 00883 sscanf(&tmpbuf[0][j],"%1c",tst); 00884 } 00885 00886 ++j; 00887 sscanf(&tmpbuf[0][j],"%1c",tst); 00888 while(tst[0] == ' ') 00889 { 00890 ++j; 00891 sscanf(&tmpbuf[0][j],"%1c",tst); 00892 } 00893 while(tst[0] != ')') 00894 { 00895 FontBlue = 10*FontBlue + atoi(tst); 00896 ++j; 00897 sscanf(&tmpbuf[0][j],"%1c",tst); 00898 if(tst[0] == ' ')break; 00899 } 00900 00901 SelectedFontColor = RGB(FontRed, FontGreen, FontBlue); 00902 } 00903 00904 k = GetPrivateProfileString("TEXT","STRING_CONTENT",DEFAULT_A_STRING,strbuf,sizeof(strbuf),IniFileName); 00905 00906 strncpy(SourceString,strbuf,(size_t)k); 00907 Source_String_Length = k; 00908 00909 MultiByteToWideChar(CP_ACP|CP_OEMCP,0,SourceString,-1,SourceStringW,sizeof(SourceStringW)); 00910 00911 for(j=0; j<2; j++) 00912 Text_Test_Order[j] = 0; 00913 00914 GetPrivateProfileString("RUN","ORDER","FONT_SIZE, STRING_LENGTH",txtbuf,sizeof(txtbuf),IniFileName); 00915 if(strstr(txtbuf,"STRING_LENGTH") > strstr(txtbuf,"FONT_SIZE")) 00916 { 00917 Text_Test_Order[0] = 1; 00918 Text_Test_Order[1] = 2; 00919 } 00920 else 00921 { 00922 Text_Test_Order[0] = 2; 00923 Text_Test_Order[1] = 1; 00924 } 00925 00926 k = GetPrivateProfileString("RUN","STRING_LENGTH","32",txtbuf,sizeof(txtbuf),IniFileName); 00927 No_String_Lengths = Std_Parse(txtbuf, k, StringLength); 00928 00929 if(No_String_Lengths==0) 00930 { 00931 MessageBox(hWnd,"Invalid or No String Length Entry in GDIBATCH.INI File", "INI File Error",MB_ICONSTOP|MB_OK); 00932 BatchFlag = FALSE; 00933 break; 00934 } 00935 00936 k = GetPrivateProfileString("RUN","FONT_SIZE","10",txtbuf,sizeof(txtbuf),IniFileName); 00937 No_Font_Sizes = Std_Parse(txtbuf, k, FontSize); 00938 00939 if(No_Font_Sizes==0) 00940 { 00941 MessageBox(hWnd,"Invalid or No Font Size Entry in GDIBATCH.INI File", "INI File Error",MB_ICONSTOP|MB_OK); 00942 BatchFlag = FALSE; 00943 break; 00944 } 00945 00946 fclose(fpIniFile); 00947 00948 // Initialize the LOGFONT struct 00949 00950 lf.lfWidth = 0; 00951 lf.lfEscapement = 0; 00952 lf.lfOrientation = 0; 00953 lf.lfWeight = (SelectedFontBold == FALSE)? 400 : 700; 00954 lf.lfItalic = SelectedFontItalic; 00955 lf.lfUnderline = SelectedFontUnderline; 00956 lf.lfStrikeOut = SelectedFontStrike; 00957 lf.lfCharSet = ANSI_CHARSET; 00958 lf.lfOutPrecision = OUT_DEFAULT_PRECIS; 00959 lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; 00960 lf.lfQuality = DEFAULT_QUALITY; 00961 lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; 00962 lstrcpy(&lf.lfFaceName[0],&SelectedFont[0]); 00963 00964 // Get some necessary font information for the present screen to be able to determine its height 00965 00966 hdc2 = GetDC(hWnd); 00967 GetTextFace(hdc2, sizeof(SelectedFont), &SelectedFont[0]); 00968 VPixelsPerLogInch = GetDeviceCaps(hdc2, LOGPIXELSY); 00969 ReleaseDC(hWnd,hdc2); 00970 00971 // Some more font initialization 00972 00973 cf.lStructSize = sizeof (CHOOSEFONT); 00974 cf.hwndOwner = hWnd; 00975 cf.lpLogFont = &lf; 00976 cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT; 00977 cf.nFontType = SCREEN_FONTTYPE; 00978 cf.rgbColors = SelectedFontColor; 00979 00980 // Auto Select an output file name 00981 00982 OutFileName = SelectOutFileName(hWnd); 00983 fpOutFile = fopen(OutFileName, "w+"); 00984 if(NULL == OutFileName) 00985 { 00986 MessageBox(hWnd,"Could not Open an Output File, Batch Mode Halted", "Output Open File Error",MB_ICONSTOP|MB_OK); 00987 BatchFlag = FALSE; 00988 break; 00989 } 00990 00991 // Execute Text Suite, Depending on the Predefined Order of Loops 00992 00993 if(Text_Test_Order[1] == 1) 00994 { 00995 00996 for(i = 0; i < No_String_Lengths; i++) 00997 { 00998 StrLen = StringLength[i]; 00999 String_Length_Warn = (StrLen <= (size_t)Source_String_Length)? FALSE : TRUE; 01000 strcpy(&DestString[StrLen],"\0"); 01001 pszTest =(PSZ) strncpy(&DestString[0], SourceString, StrLen); 01002 pwszTest = (PWSTR) wcsncpy(&DestStringW[0], SourceStringW, StrLen); 01003 01004 for(j = 0; j < No_Font_Sizes; j++) 01005 { 01006 lf.lfHeight = -MulDiv(FontSize[j], VPixelsPerLogInch, POINTS_PER_INCH); 01007 cf.iPointSize = 10*FontSize[j]; // Point Size is in 1/10 of a point 01008 01009 for(k=0; k < BatchCycle; k++) 01010 { 01011 SendMessage(hWnd,WM_COMMAND,IDM_QRUN2,0L); 01012 WriteBatchResults(fpOutFile, TestType, k+1); 01013 } 01014 01015 } 01016 01017 } 01018 01019 } //endif 01020 01021 else 01022 { 01023 01024 for(i = 0; i < No_Font_Sizes; i++) 01025 { 01026 01027 lf.lfHeight = -MulDiv(FontSize[i], VPixelsPerLogInch, POINTS_PER_INCH); 01028 cf.iPointSize = 10*FontSize[i]; // Point Size is in 1/10 of a point 01029 01030 for(j = 0; j < No_String_Lengths; j++) 01031 { 01032 StrLen = StringLength[j]; 01033 String_Length_Warn = (StrLen <= (size_t)Source_String_Length)? FALSE : TRUE; 01034 strcpy(&DestString[StrLen],"\0"); 01035 pszTest =(PSZ) strncpy(&DestString[0], SourceString, StrLen); 01036 pwszTest = (PWSTR) wcsncpy(&DestStringW[0], SourceStringW, StrLen); 01037 01038 for(k=0; k < BatchCycle; k++) 01039 { 01040 SendMessage(hWnd,WM_COMMAND,IDM_QRUN2,0L); 01041 WriteBatchResults(fpOutFile, TestType, k+1); 01042 } 01043 01044 } 01045 01046 } 01047 01048 } //else 01049 01050 // Cleanup 01051 fclose(fpOutFile); 01052 01053 if(Finish_Message == TRUE) 01054 { 01055 strcpy(txtbuf,"Batch Job Finished Successfully, Results Written to "); 01056 strcat(txtbuf,OutFileName); 01057 MessageBox(hWnd,txtbuf, "Batch Job Finished",MB_ICONINFORMATION|MB_OK); 01058 } 01059 01060 if(Dont_Close_App == TRUE)// App Stays Open, Check Appropriate Menu Items for Last Selection 01061 { 01062 HMENU hmenu = GetSubMenu(GetSubMenu(GetMenu(hWnd),2),0); 01063 if(SelectedFontTransparent == TRUE) 01064 { 01065 CheckMenuItem(hmenu,2,MF_BYPOSITION|MF_CHECKED); 01066 } 01067 01068 if(StrLen == 1)i=0; 01069 else if(StrLen == 2)i=1; 01070 else if(StrLen == 4)i=2; 01071 else if(StrLen == 8)i=3; 01072 else if(StrLen == 16)i=4; 01073 else if(StrLen == 32)i=5; 01074 else if(StrLen == 64)i=6; 01075 else if(StrLen == 128)i=7; 01076 else 01077 { 01078 i = 8; // "Other" non-standard menu selection 01079 } 01080 Last_Checked = SyncMenuChecks(hWnd, Last_Checked, i); 01081 01082 BatchFlag = FALSE; 01083 for(i=0; i<(int)NUM_TESTS; i++) 01084 { 01085 gTestEntry[i].Result = 0; 01086 } 01087 01088 } 01089 else 01090 { 01091 SendMessage(hWnd,WM_COMMAND,IDM_EXIT,0L); 01092 } 01093 01094 } //case TEXT_SUITE 01095 01096 break; 01097 01098 case SELECT: // Read some more keys then run the selected test suite 01099 { 01100 01101 k = GetPrivateProfileString("BATCH","TEST","0",txtbuf,sizeof(txtbuf),IniFileName); 01102 fclose(fpIniFile); 01103 01104 Num_Selected_Tests = Std_Parse(txtbuf, k, Test_Item); 01105 01106 if(Num_Selected_Tests == 0) 01107 { 01108 MessageBox(hWnd,"Invalid Test-Number Entry in USRBATCH.INI File ", "INI File Error",MB_ICONSTOP|MB_OK); 01109 BatchFlag = FALSE; 01110 break; 01111 } 01112 01113 for(i=0; i<Num_Selected_Tests; i++) 01114 { 01115 if(Test_Item[i] > (int)NUM_TESTS) 01116 { 01117 MessageBox(hWnd,"Invalid Test-Number Entry in USRBATCH.INI File ", "INI File Error",MB_ICONSTOP|MB_OK); 01118 BatchFlag = FALSE; 01119 break; 01120 } 01121 } 01122 01123 OutFileName = SelectOutFileName(hWnd); 01124 if(NULL == OutFileName) 01125 { 01126 BatchFlag = FALSE; 01127 break; 01128 } 01129 fpOutFile = fopen(OutFileName, "w+"); 01130 01131 for(j=0; j < BatchCycle; j++) 01132 { 01133 for(i=0; i < Num_Selected_Tests; i++) 01134 { 01135 SendMessage(hWnd,WM_COMMAND,ID_TEST_START+Test_Item[i],0L); 01136 } 01137 01138 WriteBatchResults(fpOutFile, TestType, i+1); 01139 } 01140 01141 fclose(fpOutFile); 01142 01143 if(Finish_Message == TRUE) 01144 { 01145 strcpy(txtbuf,"Batch Job Finished Successfully, Results Written to "); 01146 strcat(txtbuf,OutFileName); 01147 MessageBox(hWnd,txtbuf, "Batch Job Finished",MB_ICONINFORMATION|MB_OK); 01148 } 01149 01150 if(Dont_Close_App == TRUE) 01151 { 01152 BatchFlag = FALSE; 01153 for(i=0; i<(int)NUM_TESTS; i++) 01154 { 01155 gTestEntry[i].Result = 0; 01156 } 01157 } 01158 else 01159 { 01160 SendMessage(hWnd,WM_COMMAND,IDM_EXIT,0L); 01161 } 01162 01163 } 01164 break; 01165 01166 } // switch TestType 01167 01168 } //else (RUN_BATCH - OK to Proceed) 01169 01170 } // case RUN_BATCH 01171 break; 01172 01173 // 01174 // run a single selected test (interactive mode) 01175 // 01176 01177 default: 01178 01179 { 01180 ULONG Test = LOWORD(wParam) - ID_TEST_START; 01181 ULONG Index; 01182 PFN_MS pfn; 01183 RECT CliRect = {0,0,10000,10000}; 01184 HDC hdc = GetDC(hWnd); 01185 FillRect(hdc,&CliRect,GetStockObject(GRAY_BRUSH)); 01186 01187 if(NULL==GetWindow(ghwndMDIClient,GW_CHILD)) //If Test Object doesn't exist 01188 SendMessage(ghwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); //Create Test Object 01189 01190 if (Test < NUM_TESTS) 01191 { 01192 HDC hdc2 = GetDC(hWnd); 01193 01194 wsprintf(tmsg,"Testing %s",gTestEntry[Test].Api); 01195 TextOut(hdc,20,20,tmsg,strlen(tmsg)); 01196 01197 pfn = gTestEntry[Test].pfn; 01198 ShowCursor(FALSE); 01199 01200 hfont = CreateFontIndirect(cf.lpLogFont); 01201 hfontOld = SelectObject(hdc2, hfont); 01202 crOld = SetTextColor(hdc2, cf.rgbColors); 01203 if(SelectedFontTransparent)SetBkMode(hdc2,TRANSPARENT); 01204 01206 Index = Test; 01207 for(j = 0; j < NUM_SAMPLES; j++) 01208 { 01209 01210 GdiFlush(); 01211 01212 Sample[j] = (double)(*pfn)(hdc2,gTestEntry[Index].Iter); 01213 Detailed_Data[Index][j] = (long)(0.5 + Sample[j]); 01214 if (Sample[j] == 0) { 01215 // error occurred 01216 break; 01217 } 01218 01219 } 01220 01221 Get_Stats(Sample,NUM_SAMPLES,HI_FILTER,VAR_LIMIT,&TestStats[Index]); 01223 01224 ShowCursor(TRUE); 01225 01226 SetTextColor(hdc2, crOld); 01227 SelectObject(hdc2, hfontOld); 01228 DeleteObject(hfont); 01229 SetBkMode(hdc2, OPAQUE); 01230 01231 ReleaseDC(hWnd,hdc2); 01232 // HIRO 01233 wsprintf(tmsg,"Finished %s",gTestEntry[Test].Api); 01234 TextOut(hdc,20,20,tmsg,strlen(tmsg)); 01235 } 01236 01237 ReleaseDC(hWnd,hdc); 01238 } 01239 01240 } // SWITCH CASE 01241 01242 01243 if(BatchFlag == FALSE) // Initialize Test Strings (interactive mode) 01244 { 01245 pszTest =(PSZ) strncpy(DestString, SourceString, StrLen); 01246 DestString[StrLen] = '\0'; 01247 pwszTest = (PWSTR) wcsncpy(DestStringW, SourceStringW, StrLen); 01248 DestStringW[StrLen] = L'\0'; 01249 } 01250 01251 } // WM_COMMAND 01252 break; 01253 01254 case WM_PAINT: 01255 { 01256 PAINTSTRUCT ps; 01257 HDC hDC = BeginPaint(hWnd,&ps); 01258 EndPaint(hWnd,&ps); 01259 } 01260 break; 01261 01262 case WM_DESTROY: 01263 PostQuitMessage(0); 01264 break; 01265 01266 default: 01267 01268 // 01269 // Passes message on if unproccessed 01270 // 01271 /* 01272 * Use DefFrameProc() instead of DefWindowProc() since there are 01273 * things that have to be handled differently because of MDI. 01274 */ 01275 return DefFrameProc(hWnd, ghwndMDIClient, msg, wParam, lParam); 01276 01277 } 01278 01279 /* Calculate Timer Frequency For Current Machine and Convert to MicroSeconds (Actual time will be presented in units of 100ns) */ 01280 01281 Status = QueryPerformanceFrequency((LARGE_INTEGER *)&PerformanceFreq); 01282 if(Status){ 01283 PerformanceFreq /= 10000;//PerformanceFreq is in Counts/Sec. 01284 //Dividing it by 1,000,000 gives Counts/nanosecond 01285 } //Dividing it by 10,000 gives Counts/(100 nanosecond unit) 01286 else 01287 { 01288 MessageBox(NULL, 01289 "High Resolution Performance Counter Doesn't Seem to be Supported on This Machine", 01290 "Warning", MB_OK | MB_ICONEXCLAMATION); 01291 01292 PerformanceFreq = 1; /* To Prevent Possible Div by zero later */ 01293 } 01294 01295 01296 return ((LRESULT)NULL); 01297 }

void WriteBatchResults FILE *  fpOut,
int  TestType,
int  cycle
 

Definition at line 1638 of file usrbench.c.

References _X86_, _TEST_STATS::Average, BatchCycle, BatchFlag, cf, DestString, Detailed_Data, FALSE, FIRST_TEXT_FUNCTION, gfPentium, gTestEntry, LAST_TEXT_FUNCTION, lf, NUM_SAMPLES, NUM_TESTS, _TEST_STATS::NumSamplesValid, Physical, Print_Detailed, SelectedFontTransparent, sprintf(), String_Length_Warn, StrLen, TestStats, TEXT_SUITE, TextSuiteFlag, TRUE, VAR_LIMIT, and Version.

Referenced by SaveResults(), and WndProc().

01639 { 01640 char szT[180]; 01641 OSVERSIONINFO Win32VersionInformation; 01642 MEMORYSTATUS MemoryStatus; 01643 char ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; 01644 int SizBuf = MAX_COMPUTERNAME_LENGTH + 1; 01645 int i,j; 01646 ULONG ix; 01647 char *pszOSName; 01648 ULONG ixStart = 0; 01649 ULONG ixEnd = NUM_TESTS; 01650 01651 if(TEXT_SUITE == TestType){ 01652 ixStart = FIRST_TEXT_FUNCTION; 01653 ixEnd = LAST_TEXT_FUNCTION + 1; 01654 } 01655 01656 01657 /* 01658 * Write out the build information and current date. 01659 */ 01660 Win32VersionInformation.dwOSVersionInfoSize = sizeof(Win32VersionInformation); 01661 if (GetVersionEx(&Win32VersionInformation)) 01662 { 01663 switch (Win32VersionInformation.dwPlatformId) 01664 { 01665 case VER_PLATFORM_WIN32s: 01666 pszOSName = "WIN32S"; 01667 break; 01668 case VER_PLATFORM_WIN32_WINDOWS: 01669 pszOSName = "Windows 95"; 01670 break; 01671 case VER_PLATFORM_WIN32_NT: 01672 pszOSName = "Windows NT"; 01673 break; 01674 default: 01675 pszOSName = "Windows ???"; 01676 break; 01677 } 01678 01679 GetComputerName(ComputerName, &SizBuf); 01680 wsprintf(szT, "\n\n 01681 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01682 01683 wsprintf(szT, "%s Version %d.%d Build %d ", pszOSName, 01684 Win32VersionInformation.dwMajorVersion, 01685 Win32VersionInformation.dwMinorVersion, 01686 Win32VersionInformation.dwBuildNumber); 01687 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01688 01689 MemoryStatus.dwLength = sizeof(MEMORYSTATUS); 01690 GlobalMemoryStatus(&MemoryStatus); 01691 01692 wsprintf(szT, "Physical Memory = %dKB 01693 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01694 01695 wsprintf(szT,"\nComputer Name = %s", ComputerName); 01696 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01697 01698 } 01699 01700 wsprintf(szT, "\n\nMaximum Variation Coefficient (Standard Deviation/Average) Imposed on Test Data = %d %%", VAR_LIMIT); 01701 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01702 wsprintf(szT, "\n\nBest and Worst Cycle or Time Counts per Call are Unprocessed Values", VAR_LIMIT); 01703 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01704 01705 01706 if(BatchFlag == TRUE) 01707 { 01708 wsprintf(szT, "\n\nBatch Cycle No. %d Out of %d Cycles", cycle, BatchCycle ); 01709 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01710 } 01711 else 01712 { 01713 wsprintf(szT, "\n\nResults of interactive mode session;"); 01714 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01715 } 01716 01717 if(TEXT_SUITE == TestType || TRUE == TextSuiteFlag){ 01718 wsprintf(szT, "\n\nFor Text Function Suit:\n\nTest String Length = %d Characters", StrLen); 01719 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01720 01721 wsprintf(szT, "\nString Used= %s", DestString); 01722 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01723 01724 if(String_Length_Warn == TRUE) 01725 { 01726 wsprintf(szT, "\n!!!WARNING: One or More String Lengths Specified in INI File \n is Longer than Supplied or Default Source String"); 01727 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01728 } 01729 01730 wsprintf(szT, "\nFont name = %s, Font Size = %d", &lf.lfFaceName[0], cf.iPointSize/10); 01731 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01732 01733 wsprintf(szT, "\nFont Weight = %ld (400 = Normal, 700 = Bold)",lf.lfWeight); 01734 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01735 01736 (lf.lfItalic != FALSE)?wsprintf(szT,"\nItalic = TRUE"):wsprintf(szT,"\nItalic = FALSE"); 01737 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01738 01739 (lf.lfUnderline==TRUE)?wsprintf(szT,"\nUnderline = TRUE"):wsprintf(szT,"\nUnderline = FALSE"); 01740 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01741 01742 (lf.lfStrikeOut==TRUE)?wsprintf(szT,"\nStrikeOut = TRUE"):wsprintf(szT,"\nStrikeOut = FALSE"); 01743 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01744 01745 (SelectedFontTransparent==TRUE)?wsprintf(szT,"\nTransparent Background = TRUE"):wsprintf(szT,"\nOpaque Background = TRUE"); 01746 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01747 01748 wsprintf(szT, "\nColor Used: RED = %d, GREEN = %d, BLUE = %d", (unsigned char)cf.rgbColors, (unsigned char)(cf.rgbColors>>8), (unsigned char)(cf.rgbColors>>16) ); 01749 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01750 } 01751 01752 if(TEXT_SUITE == TestType || TRUE == TextSuiteFlag) 01753 { 01754 #ifdef _X86_ 01755 if(gfPentium) 01756 lstrcpy(szT, "\n\n Function\t\t Cycle Counts \tStdDev%\tBest \t Worst \t Valid Samples \t Out of\tIterations StrLen \t Font Size Font Name\n\n"); 01757 else 01758 #endif 01759 lstrcpy(szT, "\n\n Function\t\tTime (100 ns) \tStdDev%\tBest \t Worst \t Valid Samples \t Out of\tIterations StrLen \t Font Size Font Name\n\n"); 01760 } 01761 else 01762 { 01763 #ifdef _X86_ 01764 if(gfPentium) 01765 lstrcpy(szT, "\n\n Function\t\t Cycle Counts \tStdDev% \t Best \t Worst \t Valid Samples \t Out of \t Iterations\n\n"); 01766 else 01767 #endif 01768 lstrcpy(szT, "\n\n Function\t\tTime (100 ns) \tStdDev% \t Best \t Worst \t Valid Samples \t Out of \t Iterations\n\n"); 01769 01770 } 01771 01772 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01773 01774 for (ix = ixStart; ix < ixEnd; ix++) { 01775 01776 if(TEXT_SUITE == TestType || TRUE == TextSuiteFlag) 01777 { 01778 sprintf(szT, 01779 "%-30s\t,%6ld\t,%6.2f\t,%6ld\t,%6ld\t,%6ld\t\t,%6ld\t,%6ld\t,%6ld\t,%6ld\t,%s\n", 01780 (LPSTR)gTestEntry[ix].Api, 01781 (long)(0.5 + TestStats[ix].Average), 01782 (float)TestStats[ix].StdDev, 01783 (long)(0.5 + TestStats[ix].Minimum_Result), 01784 (long)(0.5 + TestStats[ix].Maximum_Result), 01785 TestStats[ix].NumSamplesValid, 01786 (long)NUM_SAMPLES, 01787 gTestEntry[ix].Iter, 01788 StrLen, 01789 cf.iPointSize / 10, 01790 &lf.lfFaceName[0]); 01791 01792 01793 } 01794 else 01795 { 01796 sprintf(szT, 01797 "%-50s\t,%10ld\t,%6.2f\t,%10ld\t,%10ld\t,%6ld\t\t,%6ld\t,%6ld\n", 01798 (LPSTR)gTestEntry[ix].Api, 01799 (long)(0.5 + TestStats[ix].Average), 01800 (float)TestStats[ix].StdDev, 01801 (long)(0.5 + TestStats[ix].Minimum_Result), 01802 (long)(0.5 + TestStats[ix].Maximum_Result), 01803 TestStats[ix].NumSamplesValid, 01804 (long)NUM_SAMPLES, 01805 gTestEntry[ix].Iter); 01806 } 01807 01808 if((long)(0.5 + TestStats[ix].Average) != 0) 01809 { 01810 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01811 if((Print_Detailed == TRUE) && ((float)(NUM_SAMPLES - TestStats[ix].NumSamplesValid)/(float)NUM_SAMPLES > 0.05F)) 01812 { 01813 sprintf(szT,"\nThe Last Test Had More Than 5 Percent of Its Samples Filtered Out;\n\n"); 01814 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01815 01816 sprintf(szT,"Here Is a Detailed Distribution of the Samples:\n\n"); 01817 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01818 01819 for(j = 0; j < NUM_SAMPLES; j++) 01820 { 01821 if((j+1)%10) 01822 sprintf(szT,"%d\t",Detailed_Data[ix][j]); 01823 else 01824 sprintf(szT,"%d\n",Detailed_Data[ix][j]); 01825 01826 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01827 } 01828 sprintf(szT,"\n"); 01829 fwrite(szT, sizeof(char), lstrlen(szT), fpOut); 01830 01831 } 01832 } 01833 else { 01834 fputs("\n", fpOut); 01835 } 01836 } 01837 01838 if(TRUE == TextSuiteFlag)TextSuiteFlag = FALSE; 01839 }


Variable Documentation

CHOOSEFONT cf [static]
 

Definition at line 87 of file usrbench.c.

Referenced by WndProc(), and WriteBatchResults().

BOOL gfPentium = FALSE
 

Definition at line 69 of file usrbench.c.

Referenced by BeginTimeMeasurement(), EndTimeMeasurement(), ResultsDlgProc(), and WriteBatchResults().

BOOL gfUseCycleCount = TRUE
 

Definition at line 70 of file usrbench.c.

Referenced by BeginTimeMeasurement(), and WinMain().

HANDLE ghaccel
 

Definition at line 75 of file usrbench.c.

Referenced by WinMain().

HANDLE ghinst
 

Definition at line 76 of file usrbench.c.

Referenced by InitializeInstance(), MDIChildWndProc(), msProfAvgDlgCreate(), msProfAvgDlgCreateDestroy(), msProfAvgDlgCreateDestroyEmpty(), msProfAvgDlgCreateDestroyNoFont(), msProfAvgDlgCreateDestroyNoMenu(), msProfAvgDlgDraw(), msProfCallback(), msProfClassGroup(), msProfCreateDestroyButton(), msProfCreateDestroyChildWindow(), msProfCreateDestroyCombobox(), msProfCreateDestroyEdit(), msProfCreateDestroyListbox(), msProfCreateDestroyScrollbar(), msProfCreateDestroyStatic(), msProfCreateDestroyWindow(), msProfDispatchMessage(), msProfGetWindowLong(), msProfListboxInsert1(), msProfListboxInsert2(), msProfListboxInsert3(), msProfRegisterClass(), msProfSendMessage(), msProfSetWindowLong(), msProfTranslateMessage(), msProfUpdateWindow(), SendMessageDiffThreadFunc(), and WinMain().

HWND ghwndFrame = NULL ghwndMDIClient = NULL
 

Definition at line 77 of file usrbench.c.

Referenced by InitializeInstance(), msProfAvgDlgCreate(), msProfAvgDlgCreateDestroy(), msProfAvgDlgCreateDestroyEmpty(), msProfAvgDlgCreateDestroyNoFont(), msProfAvgDlgCreateDestroyNoMenu(), msProfAvgDlgDraw(), msProfClassGroup(), msProfClipboardGroup(), SaveResults(), and WinMain().

HINSTANCE hInstMain
 

Definition at line 72 of file usrbench.c.

Referenced by SaveResults(), WinMain(), and WndProc().

LOGFONT lf [static]
 

Definition at line 88 of file usrbench.c.

MDICREATESTRUCT mcs
 

Definition at line 81 of file usrbench.c.

Referenced by InitializeInstance(), and WndProc().

PSZ pszTest = DEFAULT_A_STRING
 

Definition at line 66 of file usrbench.c.

Referenced by WndProc().

PWSTR pwszTest = DEFAULT_W_STRING
 

Definition at line 67 of file usrbench.c.

Referenced by WndProc().

CHAR szChild[] = "child"
 

Definition at line 84 of file usrbench.c.

Referenced by InitializeInstance().

CHAR szFrame[] = "frame"
 

Definition at line 85 of file usrbench.c.

Referenced by InitializeInstance().


Generated on Sat May 15 19:46:06 2004 for test by doxygen 1.3.7