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::EnableProfilingSetting Struct Reference

Public Types

using RETURN_TYPE = string

Static Public Member Functions

static void SetLocal (ClientContext &context, const Value &parameter)
static void ResetLocal (ClientContext &context)
static Value GetSetting (const ClientContext &context)

Static Public Attributes

static constexpr const char * Name = "enable_profiling"
static constexpr const char * Description
static constexpr const char * InputType = "VARCHAR"

Member Function Documentation

◆ SetLocal()

void duckdb::EnableProfilingSetting::SetLocal ( ClientContext & context,
const Value & parameter )
static
302323 {
302324 auto parameter = StringUtil::Lower(input.ToString());
302325
302326 auto &config = ClientConfig::GetConfig(context);
302327 config.enable_profiler = true;
302328 config.emit_profiler_output = true;
302329
302330 if (parameter != "no_output" && !config.profiler_save_location.empty()) {
302331 auto &file_system = FileSystem::GetFileSystem(context);
302332 const auto file_type = file_system.ExtractExtension(config.profiler_save_location);
302333 if (file_type != parameter && file_type != "txt") {
302334 throw ParserException(
302335 "Profiler file type (%s) must either have the same file extension as the profiling output type (%s), "
302336 "or be a '.txt' file. Set 'profiling_output' to a '%s' file or run \"RESET profiling_output\" first.",
302337 config.profiler_save_location, parameter, parameter);
302338 }
302339 }
302340
302341 if (parameter == "json") {
302342 config.profiler_print_format = ProfilerPrintFormat::JSON;
302343 } else if (parameter == "query_tree") {
302344 config.profiler_print_format = ProfilerPrintFormat::QUERY_TREE;
302345 } else if (parameter == "query_tree_optimizer") {
302346 config.profiler_print_format = ProfilerPrintFormat::QUERY_TREE_OPTIMIZER;
302347
302348 // add optimizer settings to the profiler settings
302349 auto optimizer_settings = MetricsUtils::GetOptimizerMetrics();
302350 for (auto &setting : optimizer_settings) {
302351 config.profiler_settings.insert(setting);
302352 }
302353
302354 // add the phase timing settings to the profiler settings
302355 auto phase_timing_settings = MetricsUtils::GetPhaseTimingMetrics();
302356 for (auto &setting : phase_timing_settings) {
302357 config.profiler_settings.insert(setting);
302358 }
302359 } else if (parameter == "no_output") {
302360 config.profiler_print_format = ProfilerPrintFormat::NO_OUTPUT;
302361 config.emit_profiler_output = false;
302362 } else if (parameter == "html") {
302363 config.profiler_print_format = ProfilerPrintFormat::HTML;
302364 } else if (parameter == "graphviz") {
302365 config.profiler_print_format = ProfilerPrintFormat::GRAPHVIZ;
302366 } else {
302367 throw ParserException("Unrecognized print format %s, supported formats: [json, query_tree, "
302368 "query_tree_optimizer, no_output, html, graphviz]",
302369 parameter);
302370 }
302371}
static DUCKDB_API string Lower(const string &str)
Convert a string to lowercase.
Definition duckdb.cpp:109630

◆ ResetLocal()

void duckdb::EnableProfilingSetting::ResetLocal ( ClientContext & context)
static
302373 {
302374 auto &config = ClientConfig::GetConfig(context);
302375 config.profiler_print_format = ClientConfig().profiler_print_format;
302376 config.enable_profiler = ClientConfig().enable_profiler;
302377 config.emit_profiler_output = ClientConfig().emit_profiler_output;
302378 config.profiler_settings = ClientConfig().profiler_settings;
302379}

◆ GetSetting()

Value duckdb::EnableProfilingSetting::GetSetting ( const ClientContext & context)
static
302381 {
302382 auto &config = ClientConfig::GetConfig(context);
302383 if (!config.enable_profiler) {
302384 return Value();
302385 }
302386 switch (config.profiler_print_format) {
302387 case ProfilerPrintFormat::JSON:
302388 return Value("json");
302389 case ProfilerPrintFormat::QUERY_TREE:
302390 return Value("query_tree");
302391 case ProfilerPrintFormat::QUERY_TREE_OPTIMIZER:
302392 return Value("query_tree_optimizer");
302393 case ProfilerPrintFormat::NO_OUTPUT:
302394 return Value("no_output");
302395 case ProfilerPrintFormat::HTML:
302396 return Value("html");
302397 case ProfilerPrintFormat::GRAPHVIZ:
302398 return Value("graphviz");
302399 default:
302400 throw InternalException("Unsupported profiler print format");
302401 }
302402}

Member Data Documentation

◆ Description

const char* duckdb::EnableProfilingSetting::Description
staticconstexpr
Initial value:
=
"Enables profiling, and sets the output format (JSON, QUERY_TREE, QUERY_TREE_OPTIMIZER)"

The documentation for this struct was generated from the following file: