void PerformanceTest::stop_test (const string& name, const string& stop_loc) { PTestMap::iterator iter = pmap_.find(name); PerformanceTest* pt = 0; if (iter != pmap_.end()) pt = iter->second; if(pt !=0) { if(pt->started()) { pt->end_ptest(stop_loc); if(debug) ACE_DEBUG((LM_DEBUG,"(%P|%t) %T PerformanceTest::stop_test\n")); } } else { if(debug) ACE_DEBUG((LM_DEBUG,"(%P|%t) %T PerformanceTest::stop_test, cannot find the test object!\n")); } }
void PerformanceTest::start_test (const string& name, const string& start_loc) { if(debug) ACE_DEBUG((LM_DEBUG,"(%P|%t) %T PerformanceTest::start_test\n")); // finding or creating a performance test object PerformanceTest* pt = find_or_create_testobj (name, start_loc); pt->begin_ptest(); }
void PerformanceTest::report_stats (const string& test_name) { PTestMap::iterator iter = pmap_.find(test_name); PerformanceTest* pt = 0; if (iter != pmap_.end()) pt = iter->second; pt->show_stats(); }
int main(int argc, char* argv[]) { int result = -1; PerformanceTest application; if(application.init(argc, argv)) { result = application.run(); application.fini(); } return result; }
int main(int argc, char* argv[]) { std::string rendererModule = "OpenGL"; TestConfig testConfig; testConfig.numTextures = 2; testConfig.textureSize = 512; testConfig.arrayLayers = 32;//512 or 32 testConfig.numMipMaps = 3; PerformanceTest test; test.Load(rendererModule, testConfig); test.Run(); #ifdef _WIN32 system("pause"); #endif return 0; }
int main(int argc, char **argv) { if (argc != 2 && argc != 3) { cout << "Syntax error: ./perftest <methods|io|loops[1-3]> [set to 1 to enable VEX|\"profiling_HPC\" for real time]" << endl; cout << "Wrong arguments: Select performance test among methods, io" << endl; return -1; } long long start = 0, end = 0; if (argc == 3 && strcmp(argv[2], "profiling_HPC") != 0) { char options[] = {"file=options"}; VEX::initializeSimulator(options); eventLogger->registerMethod("main", 100); threadEventsBehaviour->onThreadMainStart(12521); methodEventsBehaviour->afterMethodEntry(100); } PerformanceTest *ptest; if (strcmp(argv[1], "methods") == 0) { ptest = new MethodsPerformanceTest(); } else if (strcmp(argv[1], "io") == 0) { ptest = new IoPerformanceTest(); } else if (strncmp(argv[1], "loops", 5) == 0) { // "loops*" && argc == 2 is real execution of loopstest if (argc == 2 || strcmp(argv[2], "profiling_HPC") == 0) { PapiProfiler *profiler = NULL; if (argc > 2 && strcmp(argv[2], "profiling_HPC") == 0) { profiler = new PapiProfiler(true); profiler->onThreadStart(); } if (strcmp(argv[1], "loops1") == 0) { ptest = new LoopsTest(); } else if (strcmp(argv[1], "loops2") == 0) { ptest = new LoopsTest2(); } else { ptest = new LoopsTest3(); } start = Time::getRealTime(); ptest->run(100000000); end = Time::getRealTime(); cout << (end-start)/1e9 << " sec (real)" << endl; if (profiler != NULL) { profiler->onThreadEnd("main"); string profilerHpcFilename(argv[1]); profilerHpcFilename.append("_profiling_HPC.csv"); profiler->getTotalMeasurements(profilerHpcFilename.c_str()); } // "loops*" && argc == 3 is VEX execution of loopstest } else { if (strcmp(argv[1], "loops1") == 0) { ptest = new InstrLoopsTest(); } else if (strcmp(argv[1], "loops2") == 0) { ptest = new InstrLoopsTest2(); } else { ptest = new InstrLoopsTest3(); } start = threadEventsBehaviour->getTime(); ptest->run(10000000); end = threadEventsBehaviour->getTime(); cout << (end-start)/1e9 << " sec (VEX)" << endl; methodEventsBehaviour->beforeMethodExit(100); } delete ptest; return 2; } else { cout << "Wrong value for test: acceptable values \"methods\" or \"io\"" << endl; return -1; } if (argc == 2) { // argc == 2 is real execution eventLogger->registerMethod("performanceTestMethod", PERFORMANCE_TEST_METHOD_ID); start = Time::getRealTime(); ptest->run(10000000); end = Time::getRealTime(); methodEventsBehaviour->beforeMethodExit(100); cout << (end-start)/10000000 << endl; } else { // argc == 3 is VEX execution int DEFAULT_ITERATIONS = 1000; int iterationsPerBlock = 1000; eventLogger->registerMethod("performanceTestMethod", PERFORMANCE_TEST_METHOD_ID); start = threadEventsBehaviour->getTime(); for (int i = 0; i<DEFAULT_ITERATIONS; i++) { ptest->run(iterationsPerBlock); } end = threadEventsBehaviour->getTime(); cout << (end-start)/(iterationsPerBlock * DEFAULT_ITERATIONS) << endl; methodEventsBehaviour->beforeMethodExit(100); } delete ptest; if (argc == 3 && strcmp(argv[2], "profiling_HPC") != 0) { threadEventsBehaviour->onEnd(); VEX::endSimulator(); } return 0; }
void TestPerformance() { // puzzle board char puzzle_board_data[] = { 't', 'h', 'i', 's', 'w', 'a', 't', 's', 'o', 'a', 'h', 'g', 'f', 'g', 'd', 't' }; PuzzleBoard puzzle_board = { puzzle_board_data, 4, 4 }; // dictionary char* buf; long num; if (!File_Read("res/wordsEn/wordsEn.txt", &buf, &num)) { MASSERT_MSG(0, "File (res/wordsEn/wordsEn.txt) not exist!\n"); MLOG("File (res/wordsEn/wordsEn.txt) not exist!\n"); return; } if (num == 0) { MLOG("dictionary is empty\n"); return; } Array dictionary; ArrayInit(&dictionary, 8, sizeof(char*)); char* p = buf; char* q = p; while (p) { if (*p == '\r' || *p == '\n') { *p = '\0'; if (q != p) { ArrayPush(&dictionary, &q); } ++p; q = p; continue; } if (*p == '\0') { if (q != p) { ArrayPush(&dictionary, &q); } break; } ++p; } // performance test PerformanceTest test; size_t piece_size = dictionary.used / 128; for (int i = 1; i <= 32; ++i) { size_t num = i * piece_size; size_t count; Array ret; Array cur_dictionary; ArrayInit(&cur_dictionary, 8, sizeof(char*)); for (size_t j = 0; j < num; ++j) { ArrayPush(&cur_dictionary, ArrayGet(&dictionary, j)); } // solution 1 PERFORMANCE_TEST_ADD(test, "puzzle - solution 1", (int)num, ret = solution1_Function(&puzzle_board, &cur_dictionary)); count = ArrayUsed(&ret); MLOG("solution 1:\n"); for (size_t index = 0; index < count; ++index) { RetWord* word = (RetWord*)ArrayGet(&ret, index); MLOG("%s (%d, %d) - (%d, %d)\n", word->word, word->start_x, word->start_y, word->end_x, word->end_y); } ArrayDestroy(&ret); // solution 2 PERFORMANCE_TEST_ADD(test, "puzzle - solution 2", (int)num, ret = solution2_Function(&puzzle_board, &cur_dictionary)); count = ArrayUsed(&ret); MLOG("solution 1:\n"); for (size_t index = 0; index < count; ++index) { RetWord* word = (RetWord*)ArrayGet(&ret, index); MLOG("%s (%d, %d) - (%d, %d)\n", word->word, word->start_x, word->start_y, word->end_x, word->end_y); } ArrayDestroy(&ret); ArrayDestroy(&cur_dictionary); } test.WriteCompareToFile("puzzle.txt"); // destroy ArrayDestroy(&dictionary); free(buf); }