home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-20 | 1.3 KB | 51 lines | [TEXT/MPS ] |
- // Copyright © 1992-1993 Emergent Behavior. All rights reserved.
-
- //=================================================================
- #ifndef _TBENCHMARKER_
- #include "TBenchMarker.h"
- #endif
-
- //-----------------------------------------------------------------
- Time
- TBenchMarker::TestAdditionSpeed()
- {
- unsigned long total = 0;
- unsigned long startTicks = TickCount();
- for ( short counter = 1; counter < 200; ++counter ) {
- total = 0;
- for ( short number = 1; number < 20000; ++number )
- total += number;
- }
- unsigned long stopTicks = TickCount();
- unsigned long totalTicks = stopTicks - startTicks;
- return totalTicks;
- }
-
- //-----------------------------------------------------------------
- long
- TBenchMarker::TestDivisionSpeed()
- {
- extended total = 10.0e20;
- unsigned long startTicks = TickCount();
- for ( float number = 15000; number > 1; --number )
- total /= number;
- unsigned long stopTicks = TickCount();
- unsigned long totalTicks = stopTicks - startTicks;
- return totalTicks;
- }
-
- //-----------------------------------------------------------------
- long
- TBenchMarker::TestRandomNumberSpeed()
- {
- short random;
- unsigned long startTicks = TickCount();
- for ( long number = 1; number < 75000; ++number ) {
- random = Random();
- random = Random();
- }
- unsigned long stopTicks = TickCount();
- unsigned long totalTicks = stopTicks - startTicks;
- return totalTicks;
- }
-