void RunBackend(oid_t thread_id) { auto update_ratio = state.update_ratio; UniformGenerator generator; oid_t &execution_count_ref = abort_counts[thread_id]; oid_t &transaction_count_ref = commit_counts[thread_id]; // Run these many transactions while (true) { if (is_running == false) { break; } auto rng_val = generator.GetSample(); if (rng_val < update_ratio) { while (RunUpdate() == false) { execution_count_ref++; } } else { while (RunRead() == false) { execution_count_ref++; } } transaction_count_ref++; } }
void RunBackend(oid_t thread_id) { auto txn_count = state.transaction_count; auto update_ratio = state.update_ratio; UniformGenerator generator; Timer<> timer; // Start timer timer.Reset(); timer.Start(); // Run these many transactions for (oid_t txn_itr = 0; txn_itr < txn_count; txn_itr++) { auto rng_val = generator.GetSample(); if (rng_val < update_ratio) { RunUpdate(); } else { RunRead(); } } // Stop timer timer.Stop(); // Set duration durations[thread_id] = timer.GetDuration(); }
int main(int argc, char **argv) { int result = 0; Configuration *configuration = NULL; logInit(); log_entry(LogVerbose, "Starting %s", argv[0]); result = parse(argc, argv, &configuration); if (result < 0) { usage(); return 1; } if (ConfigurationVersion(configuration)) { char version[] = CF_UPGRADE_VERSION; printf("cf-upgrade %s\n", version); return 0; } if (ConfigurationHelp(configuration)) { usage(); return 0; } result = RunUpdate(configuration); log_entry(LogVerbose, "Finished %s", argv[0]); logFinish(); return (result == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }
void mw2_Application::StartGame() { mLastFrameTime = (float) al_get_time(); while (true) { mCurrentFrameTime = (float) al_get_time(); float deltaTime = mCurrentFrameTime - mLastFrameTime; mLastFrameTime = mCurrentFrameTime; mw2_Input::CheckDevices(); if (mIsExit) break; RunUpdate(deltaTime); if (mIsExit) break; RunRender(); } }