Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
job-planning.hpp
Go to the documentation of this file.
1/*
2 JOB-PLANNING.hpp - steps to prepare and build render jobs
3
4 Copyright (C)
5 2012, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
58#ifndef STEAM_ENGINE_JOB_PLANNING_H
59#define STEAM_ENGINE_JOB_PLANNING_H
60
61#include "steam/common.hpp"
62#include "vault/gear/job.h"
67#include "lib/itertools.hpp"
68#include "lib/nocopy.hpp"
69
70
71
72namespace steam {
73namespace engine {
74
75 namespace error = lumiera::error;
76
77 using play::DataSink;
78 using play::Timings;
79 using lib::time::Time;
82 using vault::gear::Job;
83
84
85
101 {
104 FrameCnt const& frameNr_;
105
106 public:
107 JobPlanning (JobTicket& ticket, TimeVar const& nominalTime, FrameCnt const& frameNr)
109 , nominalTime_{nominalTime}
110 , frameNr_{frameNr}
111 { }
112
113 // move construction is possible
114
115
117 bool isTopLevel() const { return not dependentPlan_; }
118
119
124 Job
126 {
129 return job;
130 }
131
137 Time
139 {
140 switch (timings.playbackUrgency)
141 {
142 case play::ASAP:
143 case play::NICE:
144 return Time::ANYTIME;
145
146 case play::TIMEBOUND:
147 return doCalcDeadline (timings);
148 }
149 NOTREACHED ("unexpected playbackUrgency");
150 }
151
163 {
164 UNIMPLEMENTED ("Job planning logic to establish Leeway for scheduling");
165 }
166
167
176 auto
178 {
180 ,[this](JobTicket& prereqTicket)
181 {
182 return JobPlanning{*this, prereqTicket};
183 });
184 }
185
186 private:
188 JobPlanning* dependentPlan_{nullptr};
189
199 JobPlanning (JobPlanning& parent, JobTicket& prerequisite)
200 : jobTicket_{prerequisite}
201 , nominalTime_{parent.nominalTime_}
202 , frameNr_{parent.frameNr_}
203 , dependentPlan_{&parent}
204 { }
205
206
207 Time
208 doCalcDeadline(Timings const& timings)
209 {
210 if (isTopLevel())
211 return timings.getTimeDue(frameNr_) // anchor at timing grid
212 - jobTicket_.getExpectedRuntime() // deduce the presumably runtime
213 - timings.engineLatency // and the generic engine overhead
214 - timings.outputLatency; // Note: output latency only on top-level job
215 else
216 return dependentPlan_->determineDeadline (timings)
217 - jobTicket_.getExpectedRuntime()
218 - timings.engineLatency;
219 }
220 };
221
222
223
224}}// namespace steam::engine
225#endif /*STEAM_ENGINE_JOB_PLANNING_H*/
Duration is the internal Lumiera time metric.
a mutable time value, behaving like a plain number, allowing copy and re-accessing
Lumiera's internal time value datatype.
static const Time ANYTIME
border condition marker value. ANYTIME <= any time value
View on the execution planning for a single calculation step.
JobPlanning(JobPlanning &parent, JobTicket &prerequisite)
JobPlanning * dependentPlan_
link to a dependent JobPlanning, for planning of prerequisites
JobPlanning(JobTicket &ticket, TimeVar const &nominalTime, FrameCnt const &frameNr)
Time determineDeadline(Timings const &timings)
Calculate the latest time point when to start the job, so it can still possibly reach the timing goal...
Job buildJob()
Connect and complete the planning information assembled thus far to create a frame job descriptor,...
Time doCalcDeadline(Timings const &timings)
Duration determineLeeway(Timings const &)
Determine a timing buffer for flexibility to allow starting the job already before its deadline; espe...
auto buildDependencyPlanning()
Build a sequence of dependent JobPlanning scopes for all prerequisites of this current JobPlanning,...
execution plan for pulling a specific exit node.
Job createJobFor(Time nominalTime)
Core operation: build a concrete render job based on this blueprint.
auto getPrerequisites()
Core operation: iterate over the prerequisites, required to carry out a render operation based on thi...
Generic frame timing specification.
Definition timings.hpp:87
Duration outputLatency
Definition timings.hpp:94
Time getTimeDue(FrameCnt frameOffset) const
real time deadline for the given frame, without any latency.
Definition timings.cpp:166
PlaybackUrgency playbackUrgency
Definition timings.hpp:91
Duration engineLatency
reasonable guess at the scheduling and dispatch-delay of the render engine
Definition timings.hpp:95
Types marked with this mix-in may be moved but not copied.
Definition nocopy.hpp:50
Individual frame rendering task, forwarding to a closure.
Definition job.h:276
Helpers for working with iterators based on the pipeline model.
Execution plan to generate render jobs within a specific render process.
Definition of a render job.
auto transformIterator(IT const &src, FUN processingFunc)
Build a TransformIter: convenience free function shortcut, picking up the involved types automaticall...
Steam-Layer implementation namespace root.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
An (abstract) capability to send media data to an external output.
Basic set of definitions and includes commonly used together.
a family of time value like entities and their relationships.
How to define a timing specification or constraint.