21 class VisualDebugServer;
32 : m_msSpentInProcessStat(
"Spent in Process (ms)")
33 , m_nbQueriesPopped(0)
64 enum Type { Push = 0, Cancel };
73 class QueryQueue :
public RefCountBase<QueryQueue, MemStat_QuerySystem>
106 void SetWorkingMemoryMaxSizeInBytes(
KyUInt32 sizeInBytes);
107 KyUInt32 GetWorkingMemoryMaxSizeInBytes()
const;
108 KyUInt32 GetWorkingMemoryCurrentSize()
const;
123 const String& GetName()
const {
return m_name; }
127 void CancelAllQueriesAndClearCommands();
133 void ClearCommandForThisQuery(
IQuery* query);
134 void CancelQuery(
IQuery* query);
136 IQuery* FindFirstNonNullQuery();
137 IQuery* FindNextNonNullQuery();
140 CircularArray<QueryQueueCommand, MemStat_QuerySystem>
m_commands;
141 CircularArray<Ptr<IQuery>, MemStat_QuerySystem >
m_queries;
151 KY_INLINE QueryQueue::QueryQueue()
152 : m_firstQueryToProcessIndex(0)
153 , m_msProcessBudget(1.0f)
154 , m_msSpentInProcess(0.0f)
157 KY_INLINE QueryQueue::~QueryQueue() { Clear(); }
163 KY_INLINE
KyUInt32 QueryQueue::GetCommandCount()
const {
return m_commands.GetCount(); }
164 KY_INLINE QueryQueueCommand& QueryQueue::GetCommand(
KyUInt32 index) {
return m_commands[index]; }
165 KY_INLINE
const QueryQueueCommand& QueryQueue::GetCommand(
KyUInt32 index)
const {
return m_commands[index]; }
166 KY_INLINE
KyUInt32 QueryQueue::GetQueryCount()
const {
return m_queries.GetCount(); }
167 KY_INLINE IQuery* QueryQueue::GetQuery(
KyUInt32 index)
const {
return m_queries[index]; }
String m_name
The name of the QueryQueue.
Definition: queryqueue.h:147
KyUInt32 m_firstQueryToProcessIndex
Current index of query to Process. Usefull for successive call to Process. For Internal Use...
Definition: queryqueue.h:142
void Process()
Process the Queries in the QueryQueue until the budget is spent.
Definition: queryqueue.cpp:57
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
void FlushCommands()
When QueryQueue is part of A QueryQueueArray and this QueryQueue runs within the World::Update(), QueryQueue::FlushCommands() is called at the beginning of World::Update().
Definition: queryqueue.cpp:172
CircularArray< QueryQueueCommand, MemStat_QuerySystem > m_commands
Postpone PushBack() and Cancel() until next ConsumeCommands().
Definition: queryqueue.h:140
String m_name
The name of the QueryQueue.
Definition: queryqueue.h:53
KyUInt32 GetPendingOperationCount() const
GetCommandCount() + GetQueryCount()
Definition: queryqueue.h:168
void PushBack(IQuery *query)
Must be called from the main thread.
Definition: queryqueue.cpp:31
const QueryQueueStats & GetStats() const
Previous value of GetMsSpentInProcess(). Call this for statitics on the time spent in Process()...
Definition: queryqueue.h:162
QueryQueue processes queries in an asynchronous, time-sliced way, within a QueryQueueArray.
Definition: queryqueue.h:73
Class used to provide QueryQueue initialization parameters.
Definition: queryqueue.h:41
class use internal by the QueryQueue to postpone Push/Cancel of Queries until next FlushCommands() st...
Definition: queryqueue.h:60
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
void Cancel(IQuery *query)
Must be called from the main thread.
Definition: queryqueue.cpp:39
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
KyFloat32 m_budgetInMilliseconds
The time budget per frame of the QueryQueue. Default value is 1 ms.
Definition: queryqueue.h:54
KyUInt32 m_workingMemoryReallocSize
The additional size of memory in bytes that will be allocated on ReAlloc in the WorkingMemory. Default value is 5 KB.
Definition: queryqueue.h:56
FloatStat maintains current, average, min, max statistics in a sliding window of frames.
Definition: floatstat.h:19
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
void FlushQueries()
When QueryQueue is part of A QueryQueueArray, QueryQueue::FlushQueries() is called in the World::Upda...
Definition: queryqueue.cpp:132
QueryQueueStats m_stats
Remember statistics of this QueryQueue. For Visual Debug.
Definition: queryqueue.h:146
KyFloat32 m_msSpentInProcess
Aggregates the actual time spent in Process(), set to zero in FlushQueries().
Definition: queryqueue.h:145
KyUInt32 m_workingMemoryMaxSize
The amount of memory in bytes the WorkingMemory of this QueryQueue is allowed to allocate. Default value is 1 MB.
Definition: queryqueue.h:55
CircularArray< Ptr< IQuery >, MemStat_QuerySystem > m_queries
Queries to process, this includes queries that have been canceled.
Definition: queryqueue.h:141
WorkingMemory m_workingMemory
Sandbox memory used to perform queries; allocates less memory, and in a thread-local manner...
Definition: queryqueue.h:143
This class is used by the Visual Debug system to profileQueryQueue.
Definition: queryqueue.h:27
double KyFloat64
double
Definition: types.h:33
void DoSendVisualDebug(VisualDebugServer &visualDebugServer, VisualDebugSendChangeEvent changeEvent, KyUInt32 queueIndex, KyUInt32 elementId, KyUInt32 queueArrayProcessMode)
When QueryQueue is part of A QueryQueueArray, call within QueryQueueArray::DoSendVisualDebug().
Definition: queryqueue.cpp:157
KyFloat32 m_msProcessBudget
The time in milliseconds this queue is allowed to use in a call to Process().
Definition: queryqueue.h:144
Abstract class for all queries.
Definition: iquery.h:123
float KyFloat32
float
Definition: types.h:32