66 DefaultWorkUnit& DefaultWorkUnit::operator=(DefaultWorkUnit& Unused)
94 { Results += (*Iter)->GetDependencyCount(); }
117 if(
Complete != (*Iter)->GetRunningState() )
159 Out <<
"<WorkUnit id=\"" << std::hex <<
this << std::dec <<
"\">" << std::endl;
164 this->
DoWork(CurrentThreadStorage);
170 Out <<
"<WorkUnitEnd EndTimeStamp=\"" << End <<
"\" Duration=\"" << (End-Begin) <<
"\" DurationStored=\"" <<
Whole(End-Begin) <<
"\" />" << std::endl;
172 Out <<
"</WorkUnit>" << std::endl;
virtual void AddDependency(iWorkUnit *NewDependency)
Force this WorkUnit to Start after another has completed.
virtual RunningState TakeOwnerShip()
Attempts to atomically start the work unit in the current thread.
virtual Whole GetDependentCountOf(iWorkUnit *Work, bool UsedCachedDepedentGraph=false)
How many other WorkUnit instances must wait on this one.
ThreadId MEZZ_LIB get_id()
Return the thread ID of the calling thread.
Stores data about a single work unit so that it can easily be sorted.
Int32 CurrentRunningState
This controls do work with this after it has.
RunningState
Used to track whether a thread has started, completed, etc...
std::vector< iWorkUnit * > Dependencies
A collection of of workunits that must be complete before this one can start.
MaxInt GetTimeStamp()
Get a timestamp, in microseconds. This will generally be some multiple of the GetTimeStampResolution ...
virtual Whole GetImmediateDependencyCount() const
Get the amount of dependencies that directly count on this for access purposes.
virtual bool IsEveryDependencyComplete()
Check if this WorkUnit could concievably run right now.
Interface of a WorkUnit. This represents on piece of work through time.
This file defines the template double buffered resources that can be attached to a thread...
virtual void operator()(DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
This does everything required to track metadata and log work.
virtual void PrepareForNextFrame()
This resets the running state and takes any further action required to use the WorkUnit again...
virtual Whole GetDependencyCount() const
How many other WorkUnits does this one depend on?
Only used when a thread successfully attempts to gain ownership of a task, or some other tasks succes...
A thread specific collection of double-buffered and algorithm specific resources. ...
Int32 AtomicCompareAndSwap32(Int32 *VariableToChange, const Int32 &OldValue, const Int32 &NewValue)
Atomically Compares And Swaps a 32 bit value.
virtual Whole GetDependentCount(FrameScheduler &SchedulerToCount)
This returns the count workunits that depend on this work unit.
Task is running when the value was check, it could become Complete or Failed with no notice...
virtual iWorkUnit * GetDependency(Whole Index) const
This is used to iterate of all the dependencies.
This is central object in this algorithm, it is responsible for spawning threads and managing the ord...
virtual ~DefaultWorkUnit()
Virtual destructor, doesn't actually do much.
virtual RollingAverage< Whole > & GetPerformanceLog()
Get the internal rolling average for querying.
Logger & GetUsableLogger()
Get the usable logger for this thread specific resource.
The interface for rolling averages used in the Mezzanine, and threading library.
virtual void ClearDependencies()
Drop any information about what work units this one depends on.
virtual void DoWork(DefaultThreadSpecificStorage::Type &CurrentThreadStorage)=0
WorkUnits Must implement these to do the work.
Task is not yet started this frame, this can change without notice.
This file defines a minimalistic cross-platform thread that the scheduler uses to schedule tasks...
Simple thread safe ways to check and change a specified variable atomically.
long long MaxInt
A large integer type suitable for compile time math and long term microsecond time keeping...
Thread has completed all work this from frame, will not change until this frame ends.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
virtual WorkUnitKey GetSortingKey(FrameScheduler &SchedulerToCount)
Get the sorting metadata.
virtual void RemoveDependency(iWorkUnit *RemoveDependency)
Remove a dependency.
virtual Whole GetPerformance() const
Get the internal rolling average for querying.
DefaultRollingAverage< Whole >::Type PerformanceLog
A rolling average of execution times.
DefaultWorkUnit()
Simple constructor.
virtual RunningState GetRunningState() const
Retrieves the current RunningState of the thread.
This file has the definition of the workunit.