unity.scopes.testing.InProcessBenchmark

The InProcessBenchmark class provides scope authors with runtime benchmarking capabilities. The actual runs are executed in the same process. More...

#include <unity/scopes/testing/InProcessBenchmark.h>

Inheritance diagram for unity::scopes::testing::InProcessBenchmark: src="https://assets.ubuntu.com/v1/5433392a-classunity_1_1scopes_1_1testing_1_1_in_process_benchmark__inherit__graph.png" border="0" alt="Inheritance graph"/>

Public Member Functions

virtual Result for_query (const std::shared_ptr< unity::scopes::ScopeBase > &scope, QueryConfiguration configuration) override
 for_query executes a benchmark to measure the scope's query performance. More...
 
virtual Result for_preview (const std::shared_ptr< unity::scopes::ScopeBase > &scope, PreviewConfiguration preview_configuration) override
 for_preview executes a benchmark to measure the scope's preview performance. More...
 
virtual Result for_activation (const std::shared_ptr< unity::scopes::ScopeBase > &scope, ActivationConfiguration activation_configuration) override
 for_preview executes a benchmark to measure the scope's activation performance. More...
 
virtual Result for_action (const std::shared_ptr< unity::scopes::ScopeBase > &scope, ActionConfiguration activation_configuration) override
 for_preview executes a benchmark to measure the scope's action activation performance. More...
 

Detailed Description

The InProcessBenchmark class provides scope authors with runtime benchmarking capabilities. The actual runs are executed in the same process.

<a class="code" href="index.html">unity::scopes::testing::InProcessBenchmark</a> benchmark;
unity::scopes::Query query{scope_id};
query.set_query_string(scope_query_string);
<a class="code" href="unity.scopes.SearchMetadata.md">unity::scopes::SearchMetadata</a> meta_data{default_locale, default_form_factor};
<a class="code" href="unity.scopes.testing.Benchmark.QueryConfiguration.md">unity::scopes::testing::Benchmark::QueryConfiguration</a> config;
config.<a class="code" href="unity.scopes.testing.Benchmark.QueryConfiguration.md#a164536c278d29914d24fdbca3a3fa4a8">sampler</a> = [query, meta_data]()
{
<span class="keywordflow">return</span> std::make_pair(query, meta_data);
};
<span class="keyword">auto</span> result = benchmark.<a class="code" href="#a72460e26d0aa98ae7091f634d0089aa9">for_query</a>(scope, config);

Member Function Documentation

virtual Result unity::scopes::testing::InProcessBenchmark::for_action ( const std::shared_ptr< unity::scopes::ScopeBase > &  scope,
ActionConfiguration  configuration 
)
overridevirtual

for_preview executes a benchmark to measure the scope's action activation performance.

Exceptions
std::runtime_errorin case of timeouts.
std::logic_errorin case of misconfiguration.
Parameters
scopeThe scope instance to benchmark.
configurationOptions controlling the experiment.
Returns
An instance of Result.

Implements unity::scopes::testing::Benchmark.

Reimplemented in unity::scopes::testing::OutOfProcessBenchmark.

virtual Result unity::scopes::testing::InProcessBenchmark::for_activation ( const std::shared_ptr< unity::scopes::ScopeBase > &  scope,
ActivationConfiguration  configuration 
)
overridevirtual

for_preview executes a benchmark to measure the scope's activation performance.

Exceptions
std::runtime_errorin case of timeouts.
std::logic_errorin case of misconfiguration.
Parameters
scopeThe scope instance to benchmark.
configurationOptions controlling the experiment.
Returns
An instance of Result.

Implements unity::scopes::testing::Benchmark.

Reimplemented in unity::scopes::testing::OutOfProcessBenchmark.

virtual Result unity::scopes::testing::InProcessBenchmark::for_preview ( const std::shared_ptr< unity::scopes::ScopeBase > &  scope,
PreviewConfiguration  configuration 
)
overridevirtual

for_preview executes a benchmark to measure the scope's preview performance.

Exceptions
std::runtime_errorin case of timeouts.
std::logic_errorin case of misconfiguration.
Parameters
scopeThe scope instance to benchmark.
configurationOptions controlling the experiment.
Returns
An instance of Result.

Implements unity::scopes::testing::Benchmark.

Reimplemented in unity::scopes::testing::OutOfProcessBenchmark.

virtual Result unity::scopes::testing::InProcessBenchmark::for_query ( const std::shared_ptr< unity::scopes::ScopeBase > &  scope,
QueryConfiguration  configuration 
)
overridevirtual

for_query executes a benchmark to measure the scope's query performance.

Exceptions
std::runtime_errorin case of timeouts.
std::logic_errorin case of misconfiguration.
Parameters
scopeThe scope instance to benchmark.
configurationOptions controlling the experiment.
Returns
An instance of Result.

Implements unity::scopes::testing::Benchmark.

Reimplemented in unity::scopes::testing::OutOfProcessBenchmark.