AmendHub

Download:

nulleric

/

SpeedTestr

/

amendments

/

2

1.0 - Docs and a bit of cleanup.


eric made amendment 2 over 2 years ago
--- main.c Wed Aug 10 15:31:13 2022 +++ main.c Wed Aug 10 21:14:48 2022 @@ -2,6 +2,24 @@ #include <stdlib.h> #include <ShutDown.h> +/* SpeedTestr + A very simple ANSI C app to run a device + through it's paces and ensure data integrety, + then shutdown the machine if it passes. + + Originally idea came from Tom to help test his BlueSCSI's because + he couldnt reach the keyboard to doubleclick on SCSI Director... + + This should not be used (in it's current form) as a speed testing tool. + It provides a rough idea but the calls could be optomized more. This also does + not test through direct SCSI calls, just via stdlib file API. + + Copyright Eric Helgeson + + 1.0 - It works! Basics done. +*/ + + #define SIZE 1024 // Prototypes @@ -26,7 +44,7 @@ void main() gBuff[i] = gPattern; } - for(i = 1; i < 12; i++) + for(i = 1; i < 15; i++) { p = IntPow(2, i); @@ -52,9 +70,11 @@ void main() printf("Error reading file: %d", err); return; } + remove("testfile.bin"); } printf("\nSuccess, Shutting down..."); + // Uncomment if you want the machine to shutdown right after test. //ShutDwnPower(); } @@ -67,7 +87,6 @@ short readFile(unsigned int times) long endTick = 0; int result; - fp = fopen("testfile.bin", "r"); if(fp == NULL) return -2; @@ -85,7 +104,7 @@ short readFile(unsigned int times) } endTick = TickCount(); fclose(fp); - printf(" took - %lu.%lu seconds\n", (endTick - beginTick) / 60, (endTick - beginTick) % 60); + printf(" took - %lu.%lus\n", (endTick - beginTick) / 60, (endTick - beginTick) % 60); return 0; } @@ -106,7 +125,7 @@ short verifyFile() if(c == EOF) break; if(c != gPattern) { - printf("VERIFY PATTERN ERR - %c", c); + printf("VERIFY PATTERN ERR - expected %c, got %c", gPattern, c); fclose(fp); return -1; } @@ -129,7 +148,6 @@ short writeFile(unsigned int times) if(fp == NULL) return -2; beginTick = TickCount(); - for(i = 0; i != times; i++) { result = fwrite(gBuff, SIZE, 1, fp); @@ -141,7 +159,8 @@ short writeFile(unsigned int times) } endTick = TickCount(); fclose(fp); - printf(" took - %lu.%lu seconds\n", (endTick - beginTick) / 60, (endTick - beginTick) % 60); + // TickCount's are 1/60th of a second. + printf(" took - %lu.%lus\n", (endTick - beginTick) / 60, (endTick - beginTick) % 60); return 0; }