/// <summary> /// EasingControllerを停止し、経過時間を0にリセットします。 /// </summary> /// <returns> /// なし /// </returns> void reset() { if (m_swapped) { std::swap(m_start, m_end); m_swapped = false; } m_stopwatch.reset(); }
void error(const string& message) { if (aborted) { VLOG(1) << "Ignoring error message because the driver is aborted!"; return; } VLOG(1) << "Got error '" << message << "'"; driver->abort(); Stopwatch stopwatch; if (FLAGS_v >= 1) { stopwatch.start(); } scheduler->error(driver, message); VLOG(1) << "Scheduler::error took " << stopwatch.elapsed(); }
//-------------------------------------------------------------------------- // test the reading of zdl configuration parameters //-------------------------------------------------------------------------- void configure() { config::Config *config = config::Config::makeConfig(); std::string strVal; strVal = config->getConfig("ZDL", "MaxMemConsumption"); uint64_t maxMemConsumption; timer.start("configure"); for (int i = 0; i < 20; i++){ if (strVal.size() > 0){ maxMemConsumption = config::Config::uFromText(strVal); if ((maxMemConsumption - 1) & maxMemConsumption) throw std::runtime_error("ZDL: maxMemConsumption " "should be a power of 2."); } else maxMemConsumption = 1000000; } timer.stop("configure"); timer.finish(); }
void statusUpdate(const StatusUpdate& update, const UPID& pid) { const TaskStatus& status = update.status(); if (aborted) { VLOG(1) << "Ignoring task status update message because " << "the driver is aborted!"; return; } VLOG(2) << "Received status update " << update << " from " << pid; CHECK(framework.id() == update.framework_id()); // TODO(benh): Note that this maybe a duplicate status update! // Once we get support to try and have a more consistent view // of what's running in the cluster, we'll just let this one // slide. The alternative is possibly dealing with a scheduler // failover and not correctly giving the scheduler it's status // update, which seems worse than giving a status update // multiple times (of course, if a scheduler re-uses a TaskID, // that could be bad. Stopwatch stopwatch; if (FLAGS_v >= 1) { stopwatch.start(); } scheduler->statusUpdate(driver, status); VLOG(1) << "Scheduler::statusUpdate took " << stopwatch.elapsed(); // Acknowledge the status update. // NOTE: We do a dispatch here instead of directly sending the ACK because, // we want to avoid sending the ACK if the driver was aborted when we // made the statusUpdate call. This works because, the 'abort' message will // be enqueued before the ACK message is processed. if (pid > 0) { dispatch(self(), &Self::statusUpdateAcknowledgement, update, pid); } }
string OriCommand::cmd_status(strstream &str) { #if defined(DEBUG) || defined(ORI_PERF) Stopwatch sw = Stopwatch(); sw.start(); #endif /* DEBUG */ FUSE_PLOG("Command: status"); map<string, OriFileState::StateType> diff; map<string, OriFileState::StateType>::iterator it; strwstream resp; RWKey::sp lock = priv->nsLock.writeLock(); diff = priv->getDiff(); lock.reset(); resp.writeUInt32(diff.size()); for (it = diff.begin(); it != diff.end(); it++) { char type = '!'; if (it->second == OriFileState::Created) type = 'A'; else if (it->second == OriFileState::Modified) type = 'M'; else if (it->second == OriFileState::Deleted) type = 'D'; else ASSERT(false); resp.writeUInt8(type); resp.writeLPStr(it->first); } #if defined(DEBUG) || defined(ORI_PERF) sw.stop(); FUSE_PLOG("status elapsed %lluus", sw.getElapsedTime()); #endif /* DEBUG */ return resp.str(); }
bool MeshObjectWriter::write( const MeshObject& object, const char* object_name, const char* filename) { assert(filename); Stopwatch<DefaultWallclockTimer> stopwatch; stopwatch.start(); try { OBJMeshFileWriter writer(filename); MeshObjectWalker walker(object, object_name); writer.write(walker); } catch (const ExceptionIOError&) { RENDERER_LOG_ERROR( "failed to write mesh file %s: i/o error.", filename); return false; } catch (const Exception& e) { RENDERER_LOG_ERROR( "failed to write mesh file %s: %s.", filename, e.what()); return false; } stopwatch.measure(); RENDERER_LOG_INFO( "wrote mesh file %s in %s.", filename, pretty_time(stopwatch.get_seconds()).c_str()); return true; }
void rescindOffer(const OfferID& offerId) { if (aborted) { VLOG(1) << "Ignoring rescind offer message because " << "the driver is aborted!"; return; } VLOG(1) << "Rescinded offer " << offerId; savedOffers.erase(offerId); Stopwatch stopwatch; if (FLAGS_v >= 1) { stopwatch.start(); } scheduler->offerRescinded(driver, offerId); VLOG(1) << "Scheduler::offerRescinded took " << stopwatch.elapsed(); }
void Encode::run() { Stopwatch stopwatch; while (next_block()) process_block(); stopwatch.stop("[runtime]"); printf("\n"); vmpeak(stdout); printf("\n"); printf("output.nomatch : %zu (%.2f%%)\n", output.nomatch, (output.nomatch/(double)input.nreads)*100.0); printf("output.fullmatch : %zu (%.2f%%)\n", output.nfullmatch, (output.nfullmatch/(double)input.nreads)*100.0); printf("output.nrcomplement : %zu (%.2f%%)\n", output.nrcomplement, (output.nrcomplement/(double)input.nreads)*100.0); printf("output.nbits : %zu\n", output.nbits); printf("output.nbytes : %zu (%.2f MB)\n", output.nbits / 8, output.nbits / 8.0 / 1e6); printf("output.compression : %.2f%%\n", ((output.nbits/8.0)/input.nbytes)*100.0); printf("\n"); }
void execute(ConnectionPool::Entry & connection, Query & query) { Stopwatch watch; RemoteBlockInputStream stream(*connection, query, &settings, nullptr, Tables(), query_processing_stage); Progress progress; stream.setProgressCallback([&progress](const Progress & value) { progress.incrementPiecewiseAtomically(value); }); stream.readPrefix(); while (Block block = stream.read()) ; stream.readSuffix(); const BlockStreamProfileInfo & info = stream.getProfileInfo(); double seconds = watch.elapsedSeconds(); std::lock_guard<std::mutex> lock(mutex); info_per_interval.add(seconds, progress.rows, progress.bytes, info.rows, info.bytes); info_total.add(seconds, progress.rows, progress.bytes, info.rows, info.bytes); }
void frameworkMessage(const SlaveID& slaveId, const FrameworkID& frameworkId, const ExecutorID& executorId, const string& data) { if (aborted) { VLOG(1) << "Ignoring framework message because the driver is aborted!"; return; } VLOG(2) << "Received framework message"; Stopwatch stopwatch; if (FLAGS_v >= 1) { stopwatch.start(); } scheduler->frameworkMessage(driver, executorId, slaveId, data); VLOG(1) << "Scheduler::frameworkMessage took " << stopwatch.elapsed(); }
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; }
std::int64_t OneToOneTranslatorThroughputTest::run(Stopwatch& stopwatch) { m_taskScheduler = std::make_shared< RoundRobinThreadAffinedTaskScheduler >(); m_taskScheduler->start(requiredProcessorCount()); TestTools::ScopeExitFunctor stopTaskSchedulerAtScopeExit([this] { m_taskScheduler->stop(); }); m_disruptor = std::make_shared< ::Disruptor::disruptor< ValueEvent > >(ValueEvent::eventFactory(), m_bufferSize, m_taskScheduler, ProducerType::Single, std::make_shared< YieldingWaitStrategy >()); TestTools::ScopeExitFunctor stopDisruptorAtScopeExit([this] { m_disruptor->shutdown(std::chrono::seconds(10)); }); m_disruptor->handleEventsWith(m_handler); m_ringBuffer = m_disruptor->start(); auto& value = m_value; auto latch = std::make_shared< Tests::ManualResetEvent >(false); auto expectedCount = m_ringBuffer->getMinimumGatingSequence() + m_iterations; m_handler->reset(latch, expectedCount); stopwatch.start(); auto& rb = *m_ringBuffer; for (std::int64_t l = 0; l < m_iterations; ++l) { value.value = l; rb.publishEvent(Translator::instance(), value); } latch->waitOne(); stopwatch.stop(); waitForEventProcessorSequence(expectedCount); PerfTestUtil::failIfNot(m_expectedResult, m_handler->value()); return m_iterations; }
void doVariant(const std::vector<std::string>& strvec) { MyObj o; std::cout << sizeof(o) << std::endl; boost::variant<std::string, double> u(1.1); /* std::cout << "boost::variant" << std::endl; std::cout << "==============" << std::endl; printSize<char>(); printSize<int>(); printSize<float>(); printSize<double>(); printSize<std::string>(); */ std::vector<std::string>::const_iterator it = strvec.begin(); std::vector<std::string>::const_iterator end = strvec.end(); Stopwatch sw; sw.start(); for (; it != end; ++it) { boost::variant<int, double, std::string> u(*it); int i = boost::apply_visitor(string_int_converter(), u); double d = boost::apply_visitor(string_dbl_converter(), u); u = i; std::string s = boost::apply_visitor(num_string_converter(), u); u = d; s = boost::apply_visitor(num_string_converter(), u); } sw.stop(); std::cout << "variant: " << sw.elapsed()/1000.0 << " [ms]" << std::endl; std::cout << "==============" << std::endl; }
void playback_local_PD_R3() { std::ofstream timing_file("timing_local_PD_R3.txt"); std::ofstream PD_file("PD_local_R3.txt"); std::vector<C2A_Model*> P; std::vector<C2A_Model*> Q; readObjFiles(P, "../data/models/CupSpoon/cup_convex.obj"); readObjFiles(Q, "../data/models/CupSpoon/spoon_convex.obj"); std::vector<ContactSpaceSampleData> contactspace_samples; std::ifstream in("space_test_3d.txt"); asciiReader(in, contactspace_samples); for(std::size_t i = 0; i < contactspace_samples.size(); ++i) { std::cout << i << std::endl; DataVector q_col(6); DataVector q(3); for(std::size_t j = 0; j < 3; ++j) q[j] = contactspace_samples[i].v[j]; for(std::size_t j = 0; j < 6; ++j) q_col[j] = contactspace_samples[i].v[j]; boost::timer t; aTimer.Reset(); aTimer.Start(); double pd = Collider3D::PDt(P, Q, q_col); PD_file << pd << " "; // timing_file << t.elapsed() << " "; timing_file << aTimer.GetTime() * 1000 << " "; timing_file.flush(); PD_file.flush(); } }
//------------------------------------------------------------------------------ void updateGeom() { int nverts = (int)g_orgPositions.size() / 3; std::vector<float> vertex; vertex.reserve(nverts*6); const float *p = &g_orgPositions[0]; const float *n = &g_normals[0]; float r = sin(g_frame*0.001f) * g_moveScale; for (int i = 0; i < nverts; ++i) { float move = 0.05f*cosf(p[0]*20+g_frame*0.01f); float ct = cos(p[2] * r); float st = sin(p[2] * r); g_positions[i*3+0] = p[0]*ct + p[1]*st; g_positions[i*3+1] = -p[0]*st + p[1]*ct; g_positions[i*3+2] = p[2]; p += 3; } p = &g_positions[0]; for (int i = 0; i < nverts; ++i) { vertex.push_back(p[0]); vertex.push_back(p[1]); vertex.push_back(p[2]); vertex.push_back(n[0]); vertex.push_back(n[1]); vertex.push_back(n[2]); p += 3; n += 3; } if (!g_vertexBuffer) g_vertexBuffer = g_osdmesh->InitializeVertexBuffer(6); g_vertexBuffer->UpdateData(&vertex[0], nverts); Stopwatch s; s.Start(); g_osdmesh->Subdivide(g_vertexBuffer, NULL); s.Stop(); g_cpuTime = float(s.GetElapsed() * 1000.0f); s.Start(); g_osdmesh->Synchronize(); s.Stop(); g_gpuTime = float(s.GetElapsed() * 1000.0f); glBindBuffer(GL_ARRAY_BUFFER, g_vertexBuffer->GetGpuBuffer()); glBindBuffer(GL_ARRAY_BUFFER, 0); }
void DouglasPeuckerApproximation::approximate(const std::vector <FrameWithId>& in, std::vector <FrameWithId>& out, double epsilon) { #ifdef DEBUG Stopwatch stopwatch; stopwatch.start(); #endif std::vector <FrameWithId> inputCopy; inputCopy = in; out.clear(); int counter = 0; douglasPeucker(inputCopy, out, counter, epsilon); #ifdef DEBUG_0 stopwatch.stop(); LOG("Douglas-Peucker approximation algorithm:"); LOG(" - input size: %u", inputCopy.size()); LOG(" - epsilon: %f", epsilon); LOG(" - output size: %u", out.size()); LOG(" - iterations : %d", counter); LOG(" - duration : %f ms", stopwatch.getElapsedTime()); #endif }
void BackgroundSchedulePool::TaskInfo::execute() { Stopwatch watch; CurrentMetrics::Increment metric_increment{CurrentMetrics::BackgroundSchedulePoolTask}; std::lock_guard lock_exec(exec_mutex); { std::lock_guard lock_schedule(schedule_mutex); if (deactivated) return; scheduled = false; executing = true; } function(); UInt64 milliseconds = watch.elapsedMilliseconds(); /// If the task is executed longer than specified time, it will be logged. static const int32_t slow_execution_threshold_ms = 200; if (milliseconds >= slow_execution_threshold_ms) LOG_TRACE(&Logger::get(log_name), "Execution took " << milliseconds << " ms."); { std::lock_guard lock_schedule(schedule_mutex); executing = false; /// In case was scheduled while executing (including a scheduleAfter which expired) we schedule the task /// on the queue. We don't call the function again here because this way all tasks /// will have their chance to execute if (scheduled) pool.queue.enqueueNotification(new TaskNotification(shared_from_this())); } }
TestCase * Grader07::testStringSort(std::string input_filename) { std::vector<std::string> input; std::vector<std::string> output; Commands07 cmds07; cmds07.readReads(input_filename, input); cmds07.readReads(input_filename, output); if(input.size() == 0){ return failed("cannot read input file #1"); } if(output.size() == 0){ return failed("cannot read input file #2"); } Stopwatch watch; watch.start(); IStringSort * sorter = (IStringSort *) createObject("IStringSort"); if(sorter == NULL){ return nullObject("IStringSort"); } sorter->sort(input); watch.stop(); std::sort(output.begin(), output.end()); if(input.size() != output.size()){ return failed("incorrect size"); } if(input != output){ return failed("at least one incorrect string"); } return passed(watch.getTime()); }
void noMasterDetected() { VLOG(1) << "No master detected, waiting for another master"; // Inform the scheduler about the disconnection if the driver // was previously registered with the master. if (connected) { Stopwatch stopwatch; if (FLAGS_v >= 1) { stopwatch.start(); } scheduler->disconnected(driver); VLOG(1) << "Scheduler::disconnected took " << stopwatch.elapsed(); } // In this case, we don't actually invoke Scheduler::error // since we might get reconnected to a master imminently. connected = false; master = UPID(); }
int main() { char buf[ 512 * 64 + 4 * 64 + 8 ]; auto& smp = *( SMPool<512, 64>* )buf; smp.init(); Cout( "size = ", smp.size() ); Stopwatch sw; for( int i = 0; i < 9999999; ++i ) { auto p1 = smp.alloc(); auto p2 = smp.alloc(); auto p3 = smp.alloc(); //Cout( (size_t)p1, (size_t)p2, (size_t)p3, " size = ", smp.size() ); smp.free( p1 ); smp.free( p2 ); smp.free( p3 ); //Cout( "size = ", smp.size() ); } Cout( sw.ElapsedMillseconds() ); system( "pause" ); return 0; }
// executes functions based on choice void doChoice(string choice, Stopwatch &stopwatch) { if (choice == "toggle") { if (stopwatch.isRunning()) { stopwatch.toggle(); cout << "Stopwatch stopped at " << stopwatch.split() << " seconds." << endl; } else { cout << "Stopwatch started." << endl; stopwatch.toggle(); } } else if (choice == "split") { cout << "Elapsed time is " << stopwatch.split() << " seconds." << endl; } else if (choice == "reset") { stopwatch.reset(); cout << "Stopwatch reset." << endl; } else if (choice == "status") { if (stopwatch.isRunning()) { cout << "Stopwatch is running." << endl; cout << "Elapsed time is " << stopwatch.split() << " seconds." << endl; } else { cout << "Stopwatch is not running." << endl; cout << "Elapsed time is " << stopwatch.split() << " seconds." << endl; } } // catch invalid input else { throw 1; } }
ThreadReturnType PEGASUS_THREAD_CDECL _executeTests(void *parm) { Thread *my_thread = (Thread *)parm; AutoPtr<T_Parms> parms((T_Parms *)my_thread->get_parm()); CIMClient* client = parms->client; Uint32 indicationSendCount = parms->indicationSendCount; Uint32 id = parms->uniqueID; char id_[4]; memset(id_,0x00,sizeof(id_)); sprintf(id_,"%u",id); String uniqueID = "_"; uniqueID.append(id_); try { Stopwatch elapsedTime; elapsedTime.start(); try { _sendTestIndication (client, CIMName ("SendTestIndicationTrap"), indicationSendCount); } catch (Exception & e) { cerr << "----- sendTestIndication failed: " << e.getMessage () << endl; exit (-1); } elapsedTime.stop(); _testEnd(uniqueID, elapsedTime.getElapsed()); } catch(Exception & e) { cout << e.getMessage() << endl; } return ThreadReturnType(0); }
void testTimer() { LOGT("<testTimer>"); Timer t1(timeout1); t1.setInterval(50); sw1.start(); t1.start(); Thread::sleep(1000); t1.stop(); }
void WriteBufferFromPocoSocket::nextImpl() { if (!offset()) return; Stopwatch watch; size_t bytes_written = 0; while (bytes_written < offset()) { ssize_t res = 0; /// Add more details to exceptions. try { res = socket.impl()->sendBytes(working_buffer.begin() + bytes_written, offset() - bytes_written); } catch (const Poco::Net::NetException & e) { throw NetException(e.displayText() + ", while writing to socket (" + peer_address.toString() + ")", ErrorCodes::NETWORK_ERROR); } catch (const Poco::TimeoutException &) { throw NetException("Timeout exceeded while writing to socket (" + peer_address.toString() + ")", ErrorCodes::SOCKET_TIMEOUT); } catch (const Poco::IOException & e) { throw NetException(e.displayText() + ", while writing to socket (" + peer_address.toString() + ")", ErrorCodes::NETWORK_ERROR); } if (res < 0) throw NetException("Cannot write to socket (" + peer_address.toString() + ")", ErrorCodes::CANNOT_WRITE_TO_SOCKET); bytes_written += res; } ProfileEvents::increment(ProfileEvents::NetworkSendElapsedMicroseconds, watch.elapsedMicroseconds()); }
void LocalSocketTest::testTimeout() { SocketAddress sas("/tmp/poco.server.tcp.sock"); EchoServer echoServer(sas); SocketAddress sac("/tmp/poco.client.tcp.sock"); StreamSocket ss(sas, &sac); Timespan timeout0 = ss.getReceiveTimeout(); Timespan timeout(250000); ss.setReceiveTimeout(timeout); Timespan timeout1 = ss.getReceiveTimeout(); std::cout << "original receive timeout: " << timeout0.totalMicroseconds() << std::endl; std::cout << "requested receive timeout: " << timeout.totalMicroseconds() << std::endl; std::cout << "actual receive timeout: " << timeout1.totalMicroseconds() << std::endl; // some socket implementations adjust the timeout value // assert (ss.getReceiveTimeout() == timeout); Stopwatch sw; try { char buffer[256]; sw.start(); ss.receiveBytes(buffer, sizeof(buffer)); fail("nothing to receive - must timeout"); } catch (TimeoutException&) { } assert (sw.elapsed() < 1000000); timeout0 = ss.getSendTimeout(); ss.setSendTimeout(timeout); timeout1 = ss.getSendTimeout(); std::cout << "original send timeout: " << timeout0.totalMicroseconds() << std::endl; std::cout << "requested send timeout: " << timeout.totalMicroseconds() << std::endl; std::cout << "actual send timeout: " << timeout1.totalMicroseconds() << std::endl; // assert (ss.getSendTimeout() == timeout); }
void doPerfTest(int n_runs) { printf("Running perf test (%d runs)...\n", n_runs); if(n_runs == 0) return; buildProjectionMatrix(); resetDepthBuffer(); piko_pipe.prepare(); piko_pipe.run_single(); Stopwatch mywatch; mywatch.Reset(); for(int run = 0; run < n_runs; run++) { buildProjectionMatrix(); resetDepthBuffer(); piko_pipe.prepare(); } float prepTime = mywatch.GetTime(); mywatch.Reset(); for(int run = 0; run < n_runs; run++) { buildProjectionMatrix(); resetDepthBuffer(); piko_pipe.prepare(); piko_pipe.run_single(); } float fullrunTime = mywatch.GetTime(); float total_time_to_ms = 1000.0f / (float) n_runs; printf("Prep time = %0.2f ms\n", total_time_to_ms * (prepTime)); printf("Full run time = %0.2f ms\n", total_time_to_ms * (fullrunTime)); printf("Raster time = %0.2f ms\n", total_time_to_ms * (fullrunTime - prepTime)); }
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 generateRand_1(int array[], int arraySize) { Stopwatch stopWatch; bool bad = false; //a flag for checking to see if a certain number was already in another element. stopWatch.start(); for (int i=0; i<arraySize; i++) { do { array[i] = (int)(rand()*rand() % arraySize); //Assign a random value to array[i] bad = false; //set bad flag to false for (int j=0; j<i; j++) //check each element up to current one { if ((int)array[i] == (int)array[j]) //if there is already one similar { bad = true; //make bad flag true. } } } while ( bad ); //keep assigning new numbers until it's not bad. } stopWatch.stop(); displayStats(arraySize, stopWatch.user(), stopWatch.user()/(arraySize * arraySize * log10(arraySize))); }
void generateRand_2(int array[], int arraySize) { Stopwatch stopWatch; int i; //for the loops bool used[arraySize]; //array to hold whether a number has been used for (i=0; i<arraySize; i++) { used[i] = false; } //initialize array for (i=0; i<arraySize; i++) { array[i] = (int)(rand()*rand() % arraySize); //Assign random value if ( i > 0 ) { //Check to see if that number was already used while ( used[ array[i] ] == true ) { array[i] = (int)(rand()*rand() % arraySize); } } used[ array[i] ] = true; } stopWatch.stop(); displayStats(arraySize, stopWatch.user(), stopWatch.user()/(arraySize * log10(arraySize))); }
void ChaikinCurveApproximation::approximate(const std::vector <FrameWithId>& in, std::vector <FrameWithId>& out, unsigned int lod) { #ifdef DEBUG Stopwatch stopwatch; stopwatch.start(); #endif std::vector <FrameWithId> inputCopy; inputCopy = in; unsigned int counter = 0; for (unsigned int i = 0; i < lod; ++i) { out.clear(); counter += chaikinCurve(inputCopy, out); inputCopy = out; } #ifdef DEBUG stopwatch.stop(); LOG("Chaikin curve approximation algorithm:"); LOG(" - input size: %lu", in.size()); LOG(" - level of detail: %d", lod); LOG(" - output size: %lu", out.size()); LOG(" - iterations : %d", counter); LOG(" - duration : %f ms", stopwatch.getElapsedTime()); #endif }