diff --git a/src/backend/engine/job.cpp b/src/backend/engine/job.cpp index 2ddd6d173..d109f039d 100644 --- a/src/backend/engine/job.cpp +++ b/src/backend/engine/job.cpp @@ -35,6 +35,9 @@ #include "backend/engine/job.h" +#include +#include + namespace backend { namespace engine { @@ -68,8 +71,6 @@ namespace engine { - /** @todo WIP-WIP 2/12 - */ void Job::triggerJob() const { @@ -109,6 +110,23 @@ namespace engine { } + /** hash value based on all relevant job data. + * Job records hashing to the same value shall be considered equivalent. + * Since the interpretation of the #InvocationInstanceID is a private detail + * of the JobClosure, calculating this hash requires a virtual call into the + * concrete JobClosure. This is not considered problematic, as the normal + * job operation and scheduling doesn't rely on the job's hash. Only some + * diagnostic facilities do. */ + size_t + hash_value (Job const& job) + { + size_t hash = myClosure(&job).hashOfInstance (job.parameter.invoKey); + boost::hash_combine(hash, typeid(job.jobClosure).name()); + boost::hash_combine(hash, job.parameter.nominalTime); + return hash; + } + + }} // namespace backend::engine namespace { diff --git a/src/backend/engine/job.h b/src/backend/engine/job.h index 2c1025569..38529a31c 100644 --- a/src/backend/engine/job.h +++ b/src/backend/engine/job.h @@ -208,6 +208,7 @@ namespace engine { virtual JobKind getJobKind() const =0; virtual bool verify (Time nominalJobTime) const =0; + virtual size_t hashOfInstance(InvocationInstanceID) const =0; }; @@ -265,6 +266,10 @@ namespace engine { }; + size_t hash_value (Job const&); + + + }} // namespace backend::engine diff --git a/src/lib/frameid.hpp b/src/lib/frameid.hpp index d8833ddb4..48a5ffe6b 100644 --- a/src/lib/frameid.hpp +++ b/src/lib/frameid.hpp @@ -76,6 +76,6 @@ namespace lumiera { - + } // namespace lumiera #endif diff --git a/src/proc/engine/engine-service.hpp b/src/proc/engine/engine-service.hpp index 6cd290687..edad93c03 100644 --- a/src/proc/engine/engine-service.hpp +++ b/src/proc/engine/engine-service.hpp @@ -29,9 +29,9 @@ ** ** The central concept provided through this facade interface is the calculation stream. ** This represents a series of calculations, expected to happen in a timely fashion and in order - ** to deliver a frame data stream onto an opened output connection. On the implementation side, - ** a calculation stream will be translated into a series of jobs invoking render nodes, - ** to be executed through the scheduler in the backend layer. + ** to deliver a frame data stream into an opened output connection. On the implementation side, + ** a calculation stream will be translated into a series of jobs to invoke render nodes; + ** these jobs are to be executed through the scheduler in the backend layer. ** ** While the individual CalcStram is simple, linear and unmodifiable, any CalcStream may be ** \em superseded by a new definition. In this case, the engine will care for a seamless diff --git a/src/proc/engine/job-ticket.cpp b/src/proc/engine/job-ticket.cpp index a5a809b09..1f0a4b365 100644 --- a/src/proc/engine/job-ticket.cpp +++ b/src/proc/engine/job-ticket.cpp @@ -69,6 +69,12 @@ using backend::engine::JobClosure; return false; } + size_t + hashOfInstance (InvocationInstanceID invoKey) const + { + UNIMPLEMENTED ("interpret the invoKey and create a suitable hash"); + } + void invokeJobOperation (JobParameter parameter) { diff --git a/tests/core/backend/engine/scheduler-interface-test.cpp b/tests/core/backend/engine/scheduler-interface-test.cpp index b2213eb51..cd27aefdc 100644 --- a/tests/core/backend/engine/scheduler-interface-test.cpp +++ b/tests/core/backend/engine/scheduler-interface-test.cpp @@ -69,6 +69,12 @@ namespace test { { UNIMPLEMENTED ("what the hell do we need to mock for this operation????"); } + + size_t + hashOfInstance(InvocationInstanceID invoKey) const + { + UNIMPLEMENTED ("how to interpret the invoKey to create a hash value"); + } }; /** actual instance of the test dummy job operation */ @@ -166,7 +172,7 @@ namespace test { InvocationInstanceID invoKey; invoKey.frameNumber = 111; - Job job(dummyClosure,invoKey, Time::ZERO); + Job job(dummyClosure, invoKey, Time::ZERO); JobTransaction definitionContext; ///////////////TODO: get this "somehow" from the SchedulerFrontend @@ -181,6 +187,10 @@ namespace test { /** @test demonstrate how a tree of dependent render jobs * can be handed over to the scheduler within a single "transaction" * + * @remarks in the real usage situation, the definition of jobs will be + * driven by the exploration of a tree-like structure (the JobTicket). + * For the purpose of this interface demonstration test this recursive + * invocation structure is just emulated by a simple tail recursion. * @see HierarchyOrientationIndicator_test#demonstrate_tree_rebuilding */ void @@ -202,7 +212,7 @@ namespace test { static void specifyJobs (JobTransaction& currentTx, uint dummyLevel) { - InvocationInstanceID invoKey; ///////////////TODO: get this "somehow" from the SchedulerFrontend + InvocationInstanceID invoKey; invoKey.frameNumber = dummyLevel; Time nominalTime(dummyLevel*TEST_FRAME_DURATION);