MCPcopy Create free account
hub / github.com/docling-project/docling-parse / run

Method run

app/run_scaling.cpp:570–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568 }
569
570 benchmark_result run(const std::string& mode,
571 bool enable_timing,
572 const std::filesystem::path& timing_csv)
573 {
574 tasks_ = build_tasks(schedule_);
575 next_task_.store(0);
576 tasks_remaining_.store(static_cast<int>(tasks_.size()));
577 active_workers_.store(std::min(num_threads_, static_cast<int>(tasks_.size())));
578
579 timing_csv_writer csv_writer(enable_timing, timing_csv);
580
581 auto start = clock_type::now();
582
583 for(int i = 0; i < active_workers_.load(); ++i)
584 {
585 workers_.emplace_back(&threaded_benchmark::worker_loop, this);
586 }
587
588 int errors = 0;
589 int completed = 0;
590 progress_bar progress(render_config_.has_value() ? " rendering" : " parsing",
591 static_cast<int>(tasks_.size()));
592 while(tasks_remaining_.load() > 0)
593 {
594 page_result result = get_result();
595 ++completed;
596 if(not result.success)
597 {
598 ++errors;
599 }
600
601 csv_writer.write(mode, num_threads_, render_config_.has_value(), result);
602 progress.update(completed);
603 }
604 progress.finish();
605
606 for(auto& worker : workers_)
607 {
608 if(worker.joinable())
609 {
610 worker.join();
611 }
612 }
613
614 const double elapsed = std::chrono::duration<double>(clock_type::now() - start).count();
615 return benchmark_result{num_threads_, elapsed, errors};
616 }
617
618 private:
619 void worker_loop()

Callers 1

mainFunction · 0.45

Calls 7

build_tasksFunction · 0.85
writeMethod · 0.80
updateMethod · 0.80
finishMethod · 0.80
sizeMethod · 0.45
loadMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected