![]() |
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.
|
QueryProfiler collects the profiling metrics of a query. More...
#include <duckdb.hpp>

Public Types | |
| using | TreeMap = reference_map_t<const PhysicalOperator, reference<ProfilingNode>> |
Public Member Functions | |
| DUCKDB_API | QueryProfiler (ClientContext &context) |
| DUCKDB_API bool | IsEnabled () const |
| DUCKDB_API bool | IsDetailedEnabled () const |
| DUCKDB_API ProfilerPrintFormat | GetPrintFormat (ExplainFormat format=ExplainFormat::DEFAULT) const |
| DUCKDB_API bool | PrintOptimizerOutput () const |
| DUCKDB_API string | GetSaveLocation () const |
| DUCKDB_API void | Start (const string &query) |
| DUCKDB_API void | Reset () |
| DUCKDB_API void | StartQuery (const string &query, bool is_explain_analyze=false, bool start_at_optimizer=false) |
| DUCKDB_API void | EndQuery () |
| DUCKDB_API void | FinalizeMetrics () |
| Finalize query metrics for output; safe to call multiple times. | |
| DUCKDB_API void | AddToCounter (MetricType type, const idx_t amount) |
| Adds amount to a specific metric type. | |
| DUCKDB_API ActiveTimer | StartTimer (MetricType type) |
| Start/End a timer for a specific metric type. | |
| DUCKDB_API void | StartExplainAnalyze () |
| DUCKDB_API void | Flush (OperatorProfiler &profiler) |
| Adds the timings gathered by an OperatorProfiler to this query profiler. | |
| DUCKDB_API void | SetBlockedTime (const double &blocked_thread_time) |
| Adds the top level query information to the global profiler. | |
| DUCKDB_API void | StartPhase (MetricType phase_metric) |
| DUCKDB_API void | EndPhase () |
| DUCKDB_API void | Initialize (const PhysicalOperator &root) |
| DUCKDB_API string | QueryTreeToString () const |
| DUCKDB_API void | QueryTreeToStream (std::ostream &str) const |
| DUCKDB_API void | Print () |
| DUCKDB_API string | ToString (ExplainFormat format=ExplainFormat::DEFAULT) const |
| return the printed as a string. Unlike ToString, which is always formatted as a string, the return value is formatted based on the current print format (see GetPrintFormat()). | |
| DUCKDB_API string | ToString (ProfilerPrintFormat format) const |
| DUCKDB_API void | ToLog () const |
| DUCKDB_API string | ToJSON () const |
| DUCKDB_API void | WriteToFile (const char *path, string &info) const |
| DUCKDB_API idx_t | GetBytesRead () const |
| DUCKDB_API idx_t | GetBytesWritten () const |
| idx_t | OperatorSize () |
| void | Finalize (ProfilingNode &node) |
| optional_ptr< ProfilingNode > | GetRoot () |
| Return the root of the query tree. | |
| DUCKDB_API void | GetRootUnderLock (const std::function< void(optional_ptr< ProfilingNode >)> &callback) |
| Provides access to the root of the query tree, but ensures there are no concurrent modifications. This can be useful when implementing continuous profiling or making customizations. | |
| const TreeMap & | GetTreeMap () const |
Static Public Member Functions | |
| static DUCKDB_API QueryProfiler & | Get (ClientContext &context) |
| static Value | JSONSanitize (const Value &input) |
| static string | JSONSanitize (const string &text) |
| static string | DrawPadded (const string &str, idx_t width) |
Private Types | |
| using | PhaseTimingStorage = unordered_map<MetricType, double, MetricTypeHashFunction> |
| A mapping of the phase names to the timings. | |
| using | PhaseTimingItem = PhaseTimingStorage::value_type |
Private Member Functions | |
| unique_ptr< ProfilingNode > | CreateTree (const PhysicalOperator &root, const profiler_settings_t &settings, const idx_t depth=0) |
| void | Render (const ProfilingNode &node, std::ostream &str) const |
| string | RenderDisabledMessage (ProfilerPrintFormat format) const |
| void | MoveOptimizerPhasesToRoot () |
| void | FinalizeMetricsInternal () |
| bool | OperatorRequiresProfiling (const PhysicalOperatorType op_type) |
| Check whether or not an operator type requires query profiling. If none of the ops in a query require profiling no profiling information is output. | |
| ExplainFormat | GetExplainFormat (ProfilerPrintFormat format) const |
Private Attributes | |
| ClientContext & | context |
| bool | running |
| Whether or not the query profiler is running. | |
| std::mutex | lock |
| The lock used for accessing the global query profiler or flushing information to it from a thread. | |
| bool | query_requires_profiling |
| Whether or not the query requires profiling. | |
| unique_ptr< ProfilingNode > | root |
| The root of the query tree. | |
| QueryMetrics | query_metrics |
| Top level query information. | |
| TreeMap | tree_map |
| A map of a Physical Operator pointer to a tree node. | |
| bool | is_explain_analyze |
| Whether or not we are running as part of a explain_analyze query. | |
| bool | metrics_finalized |
| Whether root metrics have been finalized for output. | |
| Profiler | phase_profiler |
| The timer used to time the individual phases of the planning process. | |
| PhaseTimingStorage | phase_timings |
| vector< MetricType > | phase_stack |
| The stack of currently active phases. | |
QueryProfiler collects the profiling metrics of a query.
|
explicit |
| bool duckdb::QueryProfiler::IsEnabled | ( | ) | const |
| bool duckdb::QueryProfiler::IsDetailedEnabled | ( | ) | const |
| ProfilerPrintFormat duckdb::QueryProfiler::GetPrintFormat | ( | ExplainFormat | format = ExplainFormat::DEFAULT | ) | const |
| bool duckdb::QueryProfiler::PrintOptimizerOutput | ( | ) | const |
| string duckdb::QueryProfiler::GetSaveLocation | ( | ) | const |
|
static |
| void duckdb::QueryProfiler::Start | ( | const string & | query | ) |
| void duckdb::QueryProfiler::Reset | ( | ) |
| void duckdb::QueryProfiler::StartQuery | ( | const string & | query, |
| bool | is_explain_analyze = false, | ||
| bool | start_at_optimizer = false ) |
| void duckdb::QueryProfiler::EndQuery | ( | ) |
| void duckdb::QueryProfiler::FinalizeMetrics | ( | ) |
Finalize query metrics for output; safe to call multiple times.
| void duckdb::QueryProfiler::AddToCounter | ( | MetricType | type, |
| const idx_t | amount ) |
Adds amount to a specific metric type.
| ActiveTimer duckdb::QueryProfiler::StartTimer | ( | MetricType | type | ) |
Start/End a timer for a specific metric type.
| void duckdb::QueryProfiler::StartExplainAnalyze | ( | ) |
| void duckdb::QueryProfiler::Flush | ( | OperatorProfiler & | profiler | ) |
Adds the timings gathered by an OperatorProfiler to this query profiler.

| void duckdb::QueryProfiler::SetBlockedTime | ( | const double & | blocked_thread_time | ) |
Adds the top level query information to the global profiler.
| void duckdb::QueryProfiler::StartPhase | ( | MetricType | phase_metric | ) |
| void duckdb::QueryProfiler::EndPhase | ( | ) |
| void duckdb::QueryProfiler::Initialize | ( | const PhysicalOperator & | root | ) |
| string duckdb::QueryProfiler::QueryTreeToString | ( | ) | const |
| void duckdb::QueryProfiler::QueryTreeToStream | ( | std::ostream & | str | ) | const |
| void duckdb::QueryProfiler::Print | ( | ) |
| string duckdb::QueryProfiler::ToString | ( | ExplainFormat | format = ExplainFormat::DEFAULT | ) | const |
return the printed as a string. Unlike ToString, which is always formatted as a string, the return value is formatted based on the current print format (see GetPrintFormat()).


| string duckdb::QueryProfiler::ToString | ( | ProfilerPrintFormat | format | ) | const |
|
static |
| void duckdb::QueryProfiler::ToLog | ( | ) | const |
| string duckdb::QueryProfiler::ToJSON | ( | ) | const |
| void duckdb::QueryProfiler::WriteToFile | ( | const char * | path, |
| string & | info ) const |
| idx_t duckdb::QueryProfiler::GetBytesRead | ( | ) | const |
| idx_t duckdb::QueryProfiler::GetBytesWritten | ( | ) | const |
| void duckdb::QueryProfiler::Finalize | ( | ProfilingNode & | node | ) |
|
inline |
Return the root of the query tree.

|
inline |
Provides access to the root of the query tree, but ensures there are no concurrent modifications. This can be useful when implementing continuous profiling or making customizations.

|
private |
|
private |
|
private |
|
inline |
|
private |
|
private |
|
private |
Check whether or not an operator type requires query profiling. If none of the ops in a query require profiling no profiling information is output.
|
private |