Changeset 6495 for trunk/src


Ignore:
Timestamp:
Aug 8, 2001, 11:54:45 PM (24 years ago)
Author:
bird
Message:

Made useable NT version. Result from Citrix Server.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/test/PrfTstProcess.c

    r6405 r6495  
    1 /* $Id: PrfTstProcess.c,v 1.2 2001-07-30 01:56:28 bird Exp $
     1/* $Id: PrfTstProcess.c,v 1.3 2001-08-08 21:54:45 bird Exp $
    22 *
    33 * Test program which checks how long it takes to execute another
     
    4444 *   6496.000000 - 0.005444 sec (pid=0)
    4545 *
     46 *  Citrix Server (NT4) (SMP) Pentium III 800Mhz - Watcom -Otx:
     47 *   4380885.000000 - 0.005493 sec (pid=0) (Hz: 797510000)
     48 *   4411477.000000 - 0.005532 sec (pid=0)
     49 *   4339893.000000 - 0.005442 sec (pid=0)
     50 *   4349910.000000 - 0.005454 sec (pid=0)
     51 *
     52 *  Citrix Server (NT4) (SMP) Pentium III 800Mhz - Watcom (no optimization):
     53 *   4351488.000000 - 0.005456 sec (pid=0) (Hz: 797510000)
     54 *   4411035.000000 - 0.005531 sec (pid=0)
     55 *   4362396.000000 - 0.005470 sec (pid=0)
     56 *   4374720.000000 - 0.005485 sec (pid=0)
     57 *
    4658 *  OS/2 WS4eB 4.5 FP 2 (SMP) Pentium III 600Mhz - VAC365:
    4759 *   6743.000000 - 0.005651 sec (pid=0)
     
    6274 *   33570.000000 - 0.028135 sec (pid=1c88)
    6375 *
     76 * @subsection  Compilation OS/2
     77 * Just as normal odin apps:<br>
     78 * nmake -f prftstprocess.mak
     79 *
     80 * @subsection  Complation NT
     81 * This works from OS/2 and NT:
     82 * wcl386 -d__WINNT__=1 -bt=nt /lnt -I%WATCOM\h\nt PrfTstProcess.c   kernel32.lib
     83 *
     84 * Optimized:
     85 * wcl386 -Otx -d__WINNT__=1 -bt=nt /lnt -I%WATCOM\h\nt PrfTstProcess.c   kernel32.lib
     86 *
    6487 */
    6588
    6689#include <stdio.h>
     90#if !defined(__WINNT__)
    6791#include <sys/time.h>
     92#endif
    6893#ifndef __NOTPC__
    6994#include <process.h>
     
    88113}
    89114
     115void printSystemInfo(void)
     116{
     117}
    90118
    91119#elif defined(__WINNT__)
     120#include <windows.h>
    92121/*
    93122 * Windows
     
    97126long double gettime(void)
    98127{
    99     return (long double)GetTickCount();
     128    //return (long double)GetTickCount();
     129    LARGE_INTEGER ullCounter;
     130    ullCounter.QuadPart = 0;
     131    QueryPerformanceCounter(&ullCounter);
     132    return (long double)ullCounter.QuadPart;
    100133}
    101134
    102135unsigned getHz(void)
    103136{
    104     return 1000;
    105 }
    106 
     137    //return 1000;
     138    LARGE_INTEGER ullFrequency;
     139    ullFrequency.QuadPart = 0;
     140    QueryPerformanceFrequency(&ullFrequency);
     141    return (unsigned)ullFrequency.QuadPart;
     142}
     143
     144void printSystemInfo(void)
     145{
     146    LONG        lrc;
     147    SYSTEM_INFO si;
     148    HKEY        hProcessor0;
     149    char        szMhz[16];
     150    szMhz[0] = '\0';
     151
     152    lrc = RegOpenKey(HKEY_LOCAL_MACHINE,
     153                     "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
     154                     &hProcessor0);
     155    if (!lrc)
     156    {
     157        LONG    cchMhz = sizeof(szMhz);
     158        DWORD   iKey;
     159        CHAR    szValueName[256];
     160        DWORD   cchValueName = sizeof(szValueName);
     161        DWORD   dwType;
     162        BYTE    abData[256];
     163        DWORD   cbData;
     164
     165        iKey = 0;
     166        szMhz[0] = '\0';
     167        while ((lrc = RegEnumValue(hProcessor0,
     168                                   iKey,
     169                                   szValueName,
     170                                   &cchValueName,
     171                                   NULL,
     172                                   &dwType,
     173                                   &abData,
     174                                   &cbData)) == 0
     175               || lrc == ERROR_MORE_DATA)
     176        {
     177            switch (dwType)
     178            {
     179                case REG_SZ:
     180                case REG_EXPAND_SZ:
     181                    /*
     182                    printf("%-24s =  type: %1x  namesize: %2d  data size: %3d bytes\n          %s\n",
     183                           szValueName, dwType, cchValueName, cbData, &abData[0]);
     184                    */
     185                    break;
     186
     187                default:
     188                {
     189                    /*
     190                    int i,j;
     191                    printf("%-24s =  type: %1x  namesize: %2d  data size: %3d bytes\n",
     192                           szValueName, dwType, cchValueName, cbData);
     193                    for (i = 0; i < cbData; i += 16)
     194                    {
     195                        printf("    %04x ", i);
     196                        for (j = 0; j < 16; j++)
     197                        {
     198                            if (j + i < cbData)
     199                                printf(j == 8 ? "-  %02x " : "%02x ",
     200                                       (BYTE)abData[i+j]);
     201                            else
     202                                printf(j == 8 ? "    " : "   ");
     203                        }
     204                        putc(' ', stdout);
     205                        for (j = 0; j < 16; j++)
     206                        {
     207                            if (j+i < cbData)
     208                                putc(isprint(abData[j]) ? abData[j] : '.', stdout);
     209                            else
     210                                putc(' ', stdout);
     211                        }
     212                        putc('\n', stdout);
     213                    }
     214                    */
     215                    if (   !szMhz[0]
     216                        && stricmp(szValueName, "~MHz") == 0
     217                        && dwType == REG_DWORD
     218                        && cbData == sizeof(DWORD))
     219                        sprintf(szMhz, "%d", *(PDWORD)&abData[0]);
     220                }
     221            }
     222
     223            /* next */
     224            iKey++;
     225            dwType = 0;
     226            cchValueName = sizeof(szValueName);
     227            szValueName[0] = '\0';
     228        }
     229        RegCloseKey(hProcessor0);
     230    }
     231
     232    GetSystemInfo(&si);
     233    printf("  %d %d CPUs  %s Mhz\n",
     234           si.dwNumberOfProcessors,
     235           si.dwProcessorType,
     236           szMhz
     237           );
     238}
    107239
    108240#else
     
    121253{
    122254    return 1;//000000;
     255}
     256
     257void printSystemInfo(void)
     258{
    123259}
    124260
     
    161297    printf("%Lf - %Lf sec (pid=%x)\n", rdEnd - rdStart, (rdEnd - rdStart) / getHz(), pid);
    162298    printf("(start: %Lf  end: %Lf  Hz: %d\n", rdStart, rdEnd, getHz());
    163 
     299    printSystemInfo();
    164300    return 0;
    165301}
Note: See TracChangeset for help on using the changeset viewer.