standard hash value for jobs (prerequisite for #786)
this is mostly a diagnostic facility; the actual scheduling of jobs doesn't rely on hash values.
This commit is contained in:
parent
bb0b4578ec
commit
febce1282c
6 changed files with 47 additions and 8 deletions
|
|
@ -35,6 +35,9 @@
|
|||
|
||||
#include "backend/engine/job.h"
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,6 @@ namespace lumiera {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace lumiera
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@
|
|||
**
|
||||
** The central concept provided through this facade interface is the <i>calculation stream</i>.
|
||||
** 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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue