Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Diagnostic setup to instrument and observe Activity activations.
The Scheduler powering the Lumiera render engine is implemented in terms of Activities, which can be time-bound and depend on each other. For performance reasons, these operational atoms must be implemented as a tightly knit network of lightweight POD records without much indirection. This setup poses a challenge for unit tests and similar white box testing, due to the lack of a managed platform and any further means of indirection and extension. As a remedy, a set of preconfigured detector Activity records is provided, which drop off event log messages by side effect. These detector probes can be wired in as decorators into an otherwise valid Activity-Term, allowing to watch and verify patterns of invocation.
An ActivityDetector instance can be created in local storage to get an arsenal of probing tools and detectors, which are internally wired to record activation into an lib::test::EventLog embedded into the ActivityDetector instance. A verification DSL is provided, internally relying on the building blocks and the chained-search mechanism known from the EventLog. To distinguish similar invocations and activations, a common sequence number is maintained within the ActivityDetector instance, which can be incremented explicitly. All relevant events also capture the current sequence number as an attribute of the generated log record.
GATE
activity by prepending and appending an Activation-Probe, so that both incoming and outgoing activations can be tracedDefinition in file activity-detector.hpp.
#include "vault/common.hpp"
#include "lib/test/test-helper.hpp"
#include "lib/test/event-log.hpp"
#include "vault/gear/job.h"
#include "vault/gear/activity.hpp"
#include "vault/gear/nop-job-functor.hpp"
#include "lib/time/timevalue.hpp"
#include "lib/meta/variadic-helper.hpp"
#include "lib/meta/function.hpp"
#include "lib/wrapper.hpp"
#include "lib/format-util.hpp"
#include "lib/random.hpp"
#include "lib/util.hpp"
#include <functional>
#include <utility>
#include <string>
#include <deque>
Classes | |
struct | ActivityDetector::_DiagnosticFun< SIG > |
class | ActivityDetector |
Diagnostic context to record and evaluate activations within the Scheduler. More... | |
class | ActivityMatch |
class | ActivityDetector::ActivityProbe |
A rigged CALLBACK-Activity to watch passing of activations. More... | |
class | ActivityDetector::DiagnosticFun< RET, ARGS > |
A Mock functor, logging all invocations into the EventLog. More... | |
struct | ActivityDetector::FakeExecutionCtx |
Mock setup of the execution context for Activity activation. More... | |
class | ActivityDetector::MockJobFunctor |
A Mocked job operation to detect any actual invocation. More... | |
Typedefs | |
using | SIG_JobDiagnostic = void(Time, int32_t) |
Variables | |
const string | CTX_DONE {"CTX-done"} |
const string | CTX_POST {"CTX-post"} |
const string | CTX_TICK {"CTX-tick"} |
const string | CTX_WORK {"CTX-work"} |
const size_t | JOB_ARG_POS_TIME = 0 |
const string | MARK_INC {"IncSeq"} |
const string | MARK_SEQ {"Seq"} |
Time | SCHED_TIME_MARKER {555,5} |
marker value for "current scheduler time" used in tests | |
Namespaces | |
vault | |
Vault-Layer implementation namespace root. | |
vault::gear | |
Active working gear and plumbing. | |
struct vault::gear::test::ActivityDetector::_DiagnosticFun |
Class Members | ||
---|---|---|
typedef typename _Fun< SIG >::Ret | Ret | |
typedef typename _Fun< SIG >::Args | Args | |
typedef typename StripNullType < Args >::Seq |
ArgsX | |
typedef typename Prepend< Ret, ArgsX >::Seq |
SigTypes | |
typedef typename RebindVariadic< DiagnosticFun, SigTypes >::Type |
Type |