unity.scopes.testing.OutOfProcessBenchmark

The OutOfProcessBenchmark class provides scope authors with runtime benchmarking capabilities. The actual runs are executed in another process. More...

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

Inheritance diagram for unity::scopes::testing::OutOfProcessBenchmark: src="https://assets.ubuntu.com/v1/921e9177-classunity_1_1scopes_1_1testing_1_1_out_of_process_benchmark__inherit__graph.png" border="0" alt="Inheritance graph"/>

Public Member Functions

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...
 
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...
 
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...
 
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 OutOfProcessBenchmark class provides scope authors with runtime benchmarking capabilities. The actual runs are executed in another process.

Please note that this class provides better test isolation than the class InProcessBenchmark and we promote use of this implementation due to this feature. However, as the internal implementation relies on fork(), the results in case of multi-threaded environments that exist before the execution of the benchmark are undefined.

<a class="code" href="index.html">unity::scopes::testing::OutOfProcessBenchmark</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="#a530a08db775c38ea13478a3d8e1c5bbc">for_query</a>(scope, config);

Member Function Documentation

Result unity::scopes::testing::OutOfProcessBenchmark::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.

Reimplemented from unity::scopes::testing::InProcessBenchmark.

Result unity::scopes::testing::OutOfProcessBenchmark::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.

Reimplemented from unity::scopes::testing::InProcessBenchmark.

Result unity::scopes::testing::OutOfProcessBenchmark::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.

Reimplemented from unity::scopes::testing::InProcessBenchmark.

Result unity::scopes::testing::OutOfProcessBenchmark::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.

Reimplemented from unity::scopes::testing::InProcessBenchmark.