41 #ifndef _frameschedulerworkunits_cpp
42 #define _frameschedulerworkunits_cpp
64 { ForcedLog = Force; }
69 if(!AggregationTarget)
73 std::ostream& Log = AggregationTarget->
GetLog();
74 Log <<
"<Frame Count=\"" << AggregationTarget->
GetFrameCount() <<
"\">" << std::endl;
75 for(std::vector<DefaultThreadSpecificStorage::Type*>::const_iterator Iter=AggregationTarget->
Resources.begin();
83 Forced = (
" Forced=\"True\"");
87 Log <<
"<Thread Main=\"" << (AggregationTarget->
Resources.begin()==Iter?1:0) <<
"\"" << Forced <<
" >" << std::endl
89 <<
"</Thread>" << std::endl;
93 Log <<
"</Frame>" << std::endl;
98 {
return AggregationTarget; }
101 { AggregationTarget = NewTarget; }
105 FramesSinceLastSort(0)
ThreadId MEZZ_LIB get_id()
Return the thread ID of the calling thread.
bool Boole
Generally acts a single bit, true or false.
std::vector< WorkUnitKey > WorkUnitsAffinity
A collection of iWorkUnits that must be run on the main thread.
std::vector< Resource * > Resources
This maintains ownership of all the thread specific resources.
FrameScheduler * GetFrameScheduler()
Get a pointer to the FrameScheduler that owns this resource.
Whole FramesSinceLastSort
How long since the last sort?
virtual ~LogAggregator()
Virtual Deconstructor.
std::ostream & GetLog()
Get the endpoint for the logs.
Declares a Mutex, Mutex tools, and at least one MutexLike object.
std::vector< WorkUnitKey > WorkUnitsAffinity
A freshly sorted WorkUnitsAffinity or an empty vector.
This file defines the template double buffered resources that can be attached to a thread...
Whole SortingFrequency
1 in every this many frames Sorting happens.
LogAggregator()
Create a default log agregator with no target.
static const Whole DBRLogger
Double buffered resources are identified by a Whole which is their type ID, This number identifies lo...
A thread specific collection of double-buffered and algorithm specific resources. ...
T & GetCommittable()
Get a reference to the resource that can be committed.
std::vector< WorkUnitKey > WorkUnitsMain
A collection of all the work units that are not Monopolies and do not have affinity for a given threa...
Declares a tool for automatically unlocking a mutex in an exception safe way.
SpinLock LogResources
Protects DoubleBufferedResources during creation and error handling from being accessed by the LogAgg...
virtual Whole GetFrameCount() const
Get the current number of frames that have elapsed.
std::vector< WorkUnitKey > WorkUnitsMain
A freshly sorted WorkUnitsMain or an empty vector.
WorkSorter()
Default constructor.
This is central object in this algorithm, it is responsible for spawning threads and managing the ord...
virtual Whole GetSortingFrequency()
Check how often this sorts.
void NextFlushForced(Boole Force=true)
Used to indicate the next log flush is abnormally forced.
A thread specific resource that uses double buffering to avoid multithreaded synchronization mechanis...
This defines a number of workunits that are required for doing some tasks that the Framescheduler req...
virtual void SetSortingFrequency(Whole FramesBetweenSorts)
Set how often this actually does work.
void UpdateWorkUnitKeys(std::vector< WorkUnitKey > &Units)
Iterate over the passed container of WorkUnitKeys and refresh them with the correct data from their r...
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.
FrameScheduler * GetAggregationTarget() const
Get the current Aggregation Target.
virtual void DoWork(DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
This usually does nothing, but sometimes it will do a whole bunch of work sorting.
void SetAggregationTarget(FrameScheduler *NewTarget)
Set which framescheduler will be aggregated.
WorkSorter * Sorter
If this pointer is non-zero then the WorkSorter it points at will be used to sort WorkUnits...
void Unlock()
Unlock the spinlock.
virtual void DoWork(DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
This does the actual work of log aggregation.
DBR & GetResource(const Whole &ResourceID)
Get a Specific kind of double buffered resource.
std::string String
A datatype used to a series of characters.