Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::ProgressBar Class Reference
Collaboration diagram for duckdb::ProgressBar:

Public Member Functions

 ProgressBar (Executor &executor, idx_t show_progress_after, progress_bar_display_create_func_t create_display_func=ProgressBar::DefaultProgressBarDisplay)
void Start ()
 Starts the thread.
void Update (bool final)
 Updates the progress bar and prints it to the screen.
QueryProgress GetDetailedQueryProgress ()
void PrintProgress (double percentage)
void FinishProgressBarPrint ()
bool ShouldPrint (bool final) const
bool PrintEnabled () const

Static Public Member Functions

static unique_ptr< ProgressBarDisplay > DefaultProgressBarDisplay ()
static void SystemOverrideCheck (ClientConfig &config)

Private Attributes

Executor & executor
 The executor.
Profiler profiler
 The profiler used to measure the time since the progress bar was started.
idx_t show_progress_after
 The time in ms after which to start displaying the progress bar.
QueryProgress query_progress
 Keeps track of the total progress of a query.
unique_ptr< ProgressBarDisplay > display
 The display used to print the progress.
bool supported = true
 Whether or not profiling is supported for the current query.
bool finished = false
 Whether the bar has already finished.

Constructor & Destructor Documentation

◆ ProgressBar()

duckdb::ProgressBar::ProgressBar ( Executor & executor,
idx_t show_progress_after,
progress_bar_display_create_func_t create_display_func = ProgressBar::DefaultProgressBarDisplay )
explicit
92857 if (create_display_func) {
92858 display = create_display_func();
92859 }
92860}
Executor & executor
The executor.
Definition duckdb.hpp:36034
unique_ptr< ProgressBarDisplay > display
The display used to print the progress.
Definition duckdb.hpp:36042
idx_t show_progress_after
The time in ms after which to start displaying the progress bar.
Definition duckdb.hpp:36038

Member Function Documentation

◆ DefaultProgressBarDisplay()

unique_ptr< ProgressBarDisplay > duckdb::ProgressBar::DefaultProgressBarDisplay ( )
static
92850 {
92851 return make_uniq<TerminalProgressBarDisplay>();
92852}

◆ SystemOverrideCheck()

void duckdb::ProgressBar::SystemOverrideCheck ( ClientConfig & config)
static
92843 {
92844 if (config.system_progress_bar_disable_reason != nullptr) {
92845 throw InvalidInputException("Could not change the progress bar setting because: '%s'",
92846 config.system_progress_bar_disable_reason);
92847 }
92848}

◆ Start()

void duckdb::ProgressBar::Start ( )

Starts the thread.

92866 {
92867 profiler.Start();
92868 query_progress.Initialize();
92869 supported = true;
92870}
bool supported
Whether or not profiling is supported for the current query.
Definition duckdb.hpp:36044
Profiler profiler
The profiler used to measure the time since the progress bar was started.
Definition duckdb.hpp:36036
QueryProgress query_progress
Keeps track of the total progress of a query.
Definition duckdb.hpp:36040

◆ Update()

void duckdb::ProgressBar::Update ( bool final)

Updates the progress bar and prints it to the screen.

92902 {
92903 if (!final && !supported) {
92904 return;
92905 }
92906
92907 ProgressData progress;
92908 idx_t invalid_pipelines = executor.GetPipelinesProgress(progress);
92909
92910 double new_percentage = 0.0;
92911 if (invalid_pipelines == 0 && progress.IsValid()) {
92912 if (progress.total > 1e15) {
92913 progress.Normalize(1e15);
92914 }
92915 query_progress.rows_processed = idx_t(progress.done);
92916 query_progress.total_rows_to_process = idx_t(progress.total);
92917 new_percentage = progress.ProgressDone() * 100;
92918 }
92919
92920 if (!final && invalid_pipelines > 0) {
92921 return;
92922 }
92923
92924 if (new_percentage > query_progress.percentage) {
92925 query_progress.percentage = new_percentage;
92926 }
92927 if (ShouldPrint(final)) {
92928 if (final) {
92929 FinishProgressBarPrint();
92930 } else {
92931 PrintProgress(query_progress.percentage.load());
92932 }
92933 }
92934}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ GetDetailedQueryProgress()

QueryProgress duckdb::ProgressBar::GetDetailedQueryProgress ( )
92862 {
92863 return query_progress;
92864}

◆ PrintProgress()

void duckdb::ProgressBar::PrintProgress ( double percentage)
92936 {
92937 D_ASSERT(display);
92938 display->Update(current_percentage_p);
92939}

◆ FinishProgressBarPrint()

void duckdb::ProgressBar::FinishProgressBarPrint ( )
92941 {
92942 if (finished) {
92943 return;
92944 }
92945 D_ASSERT(display);
92946 display->Finish();
92947 finished = true;
92948 if (query_progress.percentage == 0) {
92949 query_progress.Initialize();
92950 }
92951}
bool finished
Whether the bar has already finished.
Definition duckdb.hpp:36046

◆ ShouldPrint()

bool duckdb::ProgressBar::ShouldPrint ( bool final) const
92876 {
92877 if (!PrintEnabled()) {
92878 // Don't print progress at all
92879 return false;
92880 }
92881 if (!supported) {
92882 return false;
92883 }
92884
92885 double elapsed_time = -1.0;
92886 if (elapsed_time < 0.0) {
92887 elapsed_time = profiler.Elapsed();
92888 }
92889
92890 auto sufficient_time_elapsed = elapsed_time > static_cast<double>(show_progress_after) / 1000.0;
92891 if (!sufficient_time_elapsed) {
92892 // Don't print yet
92893 return false;
92894 }
92895 if (final) {
92896 // Print the last completed bar
92897 return true;
92898 }
92899 return query_progress.percentage > -1;
92900}

◆ PrintEnabled()

bool duckdb::ProgressBar::PrintEnabled ( ) const
92872 {
92873 return display != nullptr;
92874}

The documentation for this class was generated from the following files: