void Visualize() { printf("\nGenerating visualization for %s...", kDBName); Stopwatch(); //printf("\nPreparing tree"); PrepareTree(&GameTree); //printf("\nPreparing file"); PrepareDOTFile(); //printf("\nFilling tree"); PopulateEdgelist(&GameTree); //printf("\nWriting file"); Write(DOTFile, &GameTree); //printf("\nClosing file"); CloseDOTFile(DOTFile); //printf("\nCleaning up tree"); CleanupTree(&GameTree); printf("done in %u seconds!", Stopwatch()); printf("\nVisualization saved to directory \"visualization\\m%s\"", kDBName); printf("\nPlease use Graphviz's 'dot' tool to render the DOT files as images.\n"); return; }
BOOLEAN LoadOpenPositionsData() { char openDataFileName[256]; char version; POSITION arraypos; if(!gUseOpen) { return TRUE; } if(gZeroMemPlayer) //we don't load the db if playing on zero memory, but we will say that the db is loaded return TRUE; Stopwatch(); mkdir("data", 0755); sprintf(openDataFileName, "./data/m%s_%d_opendb.dat", kDBName, getOption()); printf("\nLoading Open Positions DB for %s...", kGameName); /* Open file for reading */ if((openData=fopen(openDataFileName, "rb")) == NULL) { printf("Failed!"); Stopwatch(); return FALSE; } /* Read file version */ if(fread(&version, sizeof(char), 1, openData) != 1 || version != OPEN_FILE_VER) { printf("Failed!"); Stopwatch(); return FALSE; } /* Write array */ for(arraypos = 0; arraypos < openPosArrLen; arraypos++) { if(fread(&openPosData[arraypos], sizeof(OPEN_POS_DATA), 1, openData) != 1) { printf("Failed!"); Stopwatch(); return FALSE; } openPosData[arraypos] = ntohl(openPosData[arraypos]); } fclose(openData); gOpenDataLoaded = TRUE; printf("done in %u seconds!", Stopwatch()); return TRUE; }
void Benchmark::Seeker::execute() { std::cout << "################" << std::endl << "#### SEEKER ####" << std::endl << "################" << std::endl; std::cout << "iterations: " << iterations << std::endl; // initialize stopwatch Stopwatch stopwatch = Stopwatch(iterations); // Seeker itself for(unsigned long long int i = 0; i < iterations; i++) { printf("\rSeeker Test Status: %2.2f %% \r", i*1.0/(iterations/100)); printf("\rSeeker Test Status: %2.2f %% \r", i*1.0/(iterations/100)); // jump back switch(returnMode) { case MIDDLE: lseek64(fd, diskSize/2, SEEK_SET); break; default: // BEGINNING lseek64(fd, 0, SEEK_SET); break; } write(fd, &buffer, sectorSize); // time from HERE! stopwatch.start(); lseek64(fd, i * stepSize, SEEK_SET); write(fd, &buffer, sectorSize); stopwatch.lap(); // to HERE! } stopwatch.stop(); //TODO ENTFERNEN //HDDTest::ResultSaver resultSaver(this->device, "seeker"); HDDTest::ResultSaver resultSaver(this); resultSaver.save(stopwatch); }
void reset() { *this = Stopwatch(); }
Stopwatch::Stopwatch() { Stopwatch("out.log"); }