TestCase::IterateResult MakeCurrentPerfCase::iterate (void) { if (m_samples.size() == 0) logTestInfo(); { EGLDisplay display = m_eglTestCtx.getDisplay().getEGLDisplay(); deUint64 beginTimeUs = deGetMicroseconds(); for (int iteration = 0; iteration < m_spec.iterationCount; iteration++) { EGLContext context = m_contexts[m_rnd.getUint32() % m_contexts.size()]; EGLSurface surface = m_surfaces[m_rnd.getUint32() % m_surfaces.size()]; TCU_CHECK_EGL_CALL(eglMakeCurrent(display, surface, surface, context)); if (m_spec.release) TCU_CHECK_EGL_CALL(eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)); } m_samples.push_back(deGetMicroseconds() - beginTimeUs); } if ((int)m_samples.size() == m_spec.sampleCount) { logResults(); return STOP; } else return CONTINUE; }
//----------------------------------------------------------------------- Profiler::~Profiler() { if (!mRoot.children.empty()) { // log the results of our profiling before we quit logResults(); } // clear all our lists mDisabledProfiles.clear(); }
//************************************************************************************************* // Run the test //************************************************************************************************* void BitUtilsTest::run() { // Reset the error count reset(); // Log the start of the test logStart(); // Run test cases testScanReverse(); // Log the result logResults(); }
//----------------------------------------------------------------------- Profiler::~Profiler() { if (!mProfileHistory.empty()) { // log the results of our profiling before we quit logResults(); } // clear all our lists mProfiles.clear(); mProfileFrame.clear(); mProfileHistoryMap.clear(); mProfileHistory.clear(); mDisabledProfiles.clear(); mProfileBars.clear(); }
tcu::TestNode::IterateResult TextureUploadAndDrawCase::iterate (void) { if (m_testCtx.getTestResult() == QP_TEST_RESULT_NOT_SUPPORTED) return STOP; if (m_lastIterationRender && (m_calibrator.getState() == gls::TheilSenCalibrator::STATE_MEASURE)) { deUint64 curTime = deGetMicroseconds(); m_calibrator.recordIteration(curTime - m_renderStart); } gls::TheilSenCalibrator::State state = m_calibrator.getState(); if (state == gls::TheilSenCalibrator::STATE_MEASURE) { // Render int numCalls = m_calibrator.getCallCount(); m_renderStart = deGetMicroseconds(); m_lastIterationRender = true; for (int i = 0; i < numCalls; i++) render(); return CONTINUE; } else if (state == gls::TheilSenCalibrator::STATE_RECOMPUTE_PARAMS) { m_calibrator.recomputeParameters(); m_lastIterationRender = false; return CONTINUE; } else { DE_ASSERT(state == gls::TheilSenCalibrator::STATE_FINISHED); GLU_EXPECT_NO_ERROR(m_context.getRenderContext().getFunctions().getError(), "finish"); logResults(); return STOP; } }
int main(int argc, char** argv) { #ifdef PARALLEL_CORES omp_set_num_threads(PARALLEL_CORES); #endif OpenANN::Logger resultLogger(OpenANN::Logger::CONSOLE); const int architectures = 6; const int runs = 100; OpenANN::StoppingCriteria stop; stop.minimalSearchSpaceStep = 1e-16; stop.minimalValueDifferences = 1e-16; stop.maximalIterations = 10000; Stopwatch sw; Eigen::MatrixXd Xtr, Ytr, Xte, Yte; createTwoSpiralsDataSet(2, 1.0, Xtr, Ytr, Xte, Yte); for(int architecture = 0; architecture < architectures; architecture++) { long unsigned time = 0; std::vector<Result> results; OpenANN::Net net; setup(net, architecture); for(int run = 0; run < runs; run++) { EvaluatableDataset ds(Xtr, Ytr); net.trainingSet(ds); sw.start(); OpenANN::train(net, "LMA", OpenANN::SSE, stop, true); time += sw.stop(Stopwatch::MILLISECOND); Result result = evaluate(net, Xte, Yte, ds); results.push_back(result); resultLogger << "."; } resultLogger << "\nFinished " << runs << " runs.\n"; logResults(results, time); } return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { // CREATE UNIQUE IDENTIFIER FOR THE RUN run = time(NULL); char classPathOne[128] = {0}; char classPathTwo[128] = {0}; char classPathThree[128] = {0}; char objectId[11] = {0}; char path[256] = {0}; snprintf(classPathOne, sizeof(classPathOne), "/classes/TestObjectOne%ld", run); // TEST INITIALIZATION ParseClient client = parseInitializeWithServerURL(YOUR_APP_IP, YOUR_CLIENT_KEY, YOUR_SERVER_URL); logResults(client != NULL, 1, "parseInitialize call", "failed to start parse"); // TEST GENERATION OF INSTALLATION ID const char* id = parseGetInstallationId(client); logResults(id == NULL, 0, "parseGetInstallationId call", "remove .parse-embedded from home directory"); parseSendRequest(client, "GET", "/classes/testObjectFake/1111111", NULL, NULL); id = parseGetInstallationId(client); logResults(id != NULL, 1, "parseGetInstallationId call", "did not create the installation id properly"); logResults(verifyInstallationId(id), 0, "installation id generated correctly", "installation id is not correct"); // TEST CREATING AND FETCHING OBJECTS ON/FROM THE SERVER clearCachedResults(); parseSendRequest(client, "POST", classPathOne, "{\"test\":\"object1\", \"value\":1}", callback); logResults(cachedRunResult != NULL, 0, "create test object 1", "creating object failed"); memset(objectId, 0, sizeof(objectId)); logResults(simpleJsonProcessor(cachedRunResult, "objectId", objectId, sizeof(objectId)), 0, "object 1 created", "could not create an object"); clearCachedResults(); memset(path, 0, sizeof(path)); snprintf(path, sizeof(path), "%s/%s", classPathOne, objectId); parseSendRequest(client, "GET", classPathOne, NULL, callback); logResults(cachedRunResult != NULL, 0, "fetch test object 1", "fetching object failed"); clearCachedResults(); parseSendRequest(client, "POST", classPathOne, "{\"test\":\"object1\", \"value\":2}", callback); logResults(cachedRunResult != NULL, 0, "create test object 2", "creating object failed"); memset(objectId, 0, sizeof(objectId)); logResults(simpleJsonProcessor(cachedRunResult, "objectId", objectId, sizeof(objectId)), 0, "object 2 created", "could not create an object"); clearCachedResults(); memset(path, 0, sizeof(path)); snprintf(path, sizeof(path), "%s/%s", classPathOne, objectId); parseSendRequest(client, "GET", classPathOne, NULL, callback); logResults(cachedRunResult != NULL, 0, "fetch test object 2", "fetching object failed"); clearCachedResults(); parseSendRequest(client, "POST", classPathOne, "{\"test\":\"object1\", \"value\":3}", callback); logResults(cachedRunResult != NULL, 0, "create test object 3", "creating object failed"); char objectIdKeepAround[11] = {0}; logResults(simpleJsonProcessor(cachedRunResult, "objectId", objectIdKeepAround, sizeof(objectIdKeepAround)), 0, "object 3 created", "could not create an object"); clearCachedResults(); memset(path, 0, sizeof(path)); snprintf(path, sizeof(path), "%s/%s", classPathOne, objectIdKeepAround); parseSendRequest(client, "GET", classPathOne, NULL, callback); logResults(cachedRunResult != NULL, 0, "fetch test object 3", "fetching object failed"); clearCachedResults(); parseSendRequest(client, "POST", classPathOne, "{\"test\":\"object1\", \"value\":2}", callback); logResults(cachedRunResult != NULL, 0, "create test object 4", "creating object failed"); memset(objectId, 0, sizeof(objectId)); logResults(simpleJsonProcessor(cachedRunResult, "objectId", objectId, sizeof(objectId)), 0, "object 4 created", "could not create an object"); clearCachedResults(); memset(path, 0, sizeof(path)); snprintf(path, sizeof(path), "%s/%s", classPathOne, objectId); parseSendRequest(client, "GET", classPathOne, NULL, callback); logResults(cachedRunResult != NULL, 0, "fetch test object 4", "fetching object failed"); // TEST QUERIES clearCachedResults(); parseSendRequest(client, "GET", classPathOne, "where={\"value\":2}", callback); logResults(cachedRunResult != NULL, 0, "query objects", "querying objects failed"); const char* results = "{\"results\":[{\""; int cmp = !strncmp(cachedRunResult, results, strlen(results)); char* location1 = strstr(cachedRunResult, "objectId"); char* location2 = strstr(location1 + 1, "objectId"); char* location3 = strstr(location2 + 1, "objectId"); logResults(cmp && location1 && location2 && !location3, 0, "query value", "query results not valid"); // TEST OBJECT MODIFICATION clearCachedResults(); memset(path, 0, sizeof(path)); snprintf(path, sizeof(path), "%s/%s", classPathOne, objectIdKeepAround); parseSendRequest(client, "PUT", path, "{\"test\":\"object1\", \"value\":2}", callback); logResults(cachedRunResult != NULL, 0, "modify test object 3", "modifying object failed"); clearCachedResults(); parseSendRequest(client, "GET", classPathOne, "where={\"value\":2}", callback); logResults(cachedRunResult != NULL, 0, "query objects after modification", "querying objects failed"); results = "{\"results\":[{\""; cmp = !strncmp(cachedRunResult, results, strlen(results)); location1 = strstr(cachedRunResult, "objectId"); location2 = strstr(location1 + 1, "objectId"); location3 = strstr(location2 + 1, "objectId"); logResults(cmp && location1 && location2 && location3, 0, "query value after modifying an object", "query results not valid"); // TEST DELETING AN OBJECT clearCachedResults(); memset(path, 0, sizeof(path)); snprintf(path, sizeof(path), "%s/%s", classPathOne, objectIdKeepAround); parseSendRequest(client, "DELETE", path, NULL, callback); logResults(cachedRunResult != NULL, 0, "delete test object 3", "deleting object failed"); clearCachedResults(); parseSendRequest(client, "GET", classPathOne, "where={\"value\":2}", callback); logResults(cachedRunResult != NULL, 0, "query objects after delete", "querying objects failed"); results = "{\"results\":[{\""; cmp = !strncmp(cachedRunResult, results, strlen(results)); location1 = strstr(cachedRunResult, "objectId"); location2 = strstr(location1 + 1, "objectId"); location3 = strstr(location2 + 1, "objectId"); logResults(cmp && location1 && location2 && !location3, 0, "query value after deleting an object", "query results not valid"); // TEST PUSH parseSetPushCallback(client, pushCallback); parseStartPushService(client); int socket = parseGetPushSocket(client); int loopCount = 20; printf("[!!!!!!!] Run ./push.sh %s %ld\n", id, run); while(loopCount--) { struct timeval tv; fd_set receive, send, error; tv.tv_sec = 10; tv.tv_usec= 0; FD_ZERO(&receive); FD_ZERO(&send); FD_ZERO(&error); FD_SET(socket, &error); FD_SET(socket, &receive); select(socket + 1, &receive, &send, &error, &tv); parseProcessNextPushNotification(client); if (pushCounter == 10) loopCount = loopCount > 2 ? 2 : loopCount; } logResults(pushCounter == 10, 0, "receive push notifications", "did not receive the push notifications correctly"); logSummary(); return 0; }