12 #ifndef hifi_OctreeSceneStats_h
13 #define hifi_OctreeSceneStats_h
18 #include <shared/ReadWriteLockable.h>
20 #include "OctreePacketData.h"
21 #include "SequenceNumberStats.h"
22 #include "OctalCode.h"
24 #define GREENISH 0x40ff40d0
25 #define YELLOWISH 0xffef40c0
26 #define GREYISH 0xd0d0d0a0
41 void sceneStarted(
bool fullScene,
bool moving,
const OctreeElementPointer& root);
42 bool getIsSceneStarted()
const {
return _isStarted; }
47 void printDebugDetails();
59 void traversed(
const OctreeElementPointer& element);
77 void colorSent(
const OctreeElementPointer& element);
80 void didntFit(
const OctreeElementPointer& element);
103 NLPacket& getStatsMessage() {
return *_statsPacket; }
116 ITEM_SKIPPED_DISTANCE,
117 ITEM_SKIPPED_OUT_OF_VIEW,
118 ITEM_SKIPPED_WAS_IN_VIEW,
119 ITEM_SKIPPED_NO_CHANGE,
120 ITEM_SKIPPED_OCCLUDED,
128 char const*
const caption;
131 const char* detailsLabels;
142 bool isMoving()
const {
return _isMoving; }
143 bool isFullScene()
const {
return _isFullScene; }
144 quint64 getTotalElements()
const {
return _totalElements; }
145 quint64 getTotalInternal()
const {
return _totalInternal; }
146 quint64 getTotalLeaves()
const {
return _totalLeaves; }
147 quint64 getTotalEncodeTime()
const {
return _totalEncodeTime; }
148 quint64 getElapsedTime()
const {
return _elapsed; }
150 quint64 getLastFullElapsedTime()
const {
return _lastFullElapsed; }
151 quint64 getLastFullTotalEncodeTime()
const {
return _lastFullTotalEncodeTime; }
152 quint32 getLastFullTotalPackets()
const {
return _lastFullTotalPackets; }
153 quint64 getLastFullTotalBytes()
const {
return _lastFullTotalBytes; }
156 void trackIncomingOctreePacket(ReceivedMessage& message,
bool wasStatsPacket, qint64 nodeClockSkewUsec);
158 quint32 getIncomingPackets()
const {
return _incomingPacket; }
159 quint64 getIncomingBytes()
const {
return _incomingBytes; }
160 quint64 getIncomingWastedBytes()
const {
return _incomingWastedBytes; }
161 float getIncomingFlightTimeAverage() {
return _incomingFlightTimeAverage.getAverage(); }
163 const SequenceNumberStats& getIncomingOctreeSequenceNumberStats()
const {
return _incomingOctreeSequenceNumberStats; }
164 SequenceNumberStats& getIncomingOctreeSequenceNumberStats() {
return _incomingOctreeSequenceNumberStats; }
172 std::unique_ptr<NLPacket> _statsPacket = NLPacket::create(PacketType::OctreeStats, -1,
true);
180 quint64 _lastFullElapsed;
181 quint64 _lastFullTotalEncodeTime;
182 quint32 _lastFullTotalPackets;
183 quint64 _lastFullTotalBytes;
185 SimpleMovingAverage _elapsedAverage;
186 SimpleMovingAverage _bitsPerOctreeAverage;
188 quint64 _totalEncodeTime;
189 quint64 _encodeStart;
192 quint64 _totalElements;
193 quint64 _totalInternal;
194 quint64 _totalLeaves;
200 quint64 _skippedDistance;
201 quint64 _internalSkippedDistance;
202 quint64 _leavesSkippedDistance;
204 quint64 _skippedOutOfView;
205 quint64 _internalSkippedOutOfView;
206 quint64 _leavesSkippedOutOfView;
208 quint64 _skippedWasInView;
209 quint64 _internalSkippedWasInView;
210 quint64 _leavesSkippedWasInView;
212 quint64 _skippedNoChange;
213 quint64 _internalSkippedNoChange;
214 quint64 _leavesSkippedNoChange;
216 quint64 _skippedOccluded;
217 quint64 _internalSkippedOccluded;
218 quint64 _leavesSkippedOccluded;
221 quint64 _internalColorSent;
222 quint64 _leavesColorSent;
225 quint64 _internalDidntFit;
226 quint64 _leavesDidntFit;
228 quint64 _colorBitsWritten;
229 quint64 _existsBitsWritten;
230 quint64 _existsInPacketBitsWritten;
231 quint64 _treesRemoved;
254 quint32 _incomingPacket;
255 quint64 _incomingBytes;
256 quint64 _incomingWastedBytes;
258 SequenceNumberStats _incomingOctreeSequenceNumberStats;
260 SimpleMovingAverage _incomingFlightTimeAverage;
267 static ItemInfo _ITEMS[];
268 static const int MAX_ITEM_VALUE_LENGTH = 128;
269 char _itemValueBuffer[MAX_ITEM_VALUE_LENGTH];
275 typedef NodeToOctreeSceneStats::iterator NodeToOctreeSceneStatsIterator;
Definition: OctreeSceneStats.h:274
Collects statistics for calculating and sending a scene from a octree server to an interface client.
Definition: OctreeSceneStats.h:31
void sceneStarted(bool fullScene, bool moving, const OctreeElementPointer &root)
Call when beginning the computation of a scene. Initializes internal structures.
Definition: OctreeSceneStats.cpp:122
int packIntoPacket()
Pack the details of the statistics into a buffer for sending as a network packet.
Definition: OctreeSceneStats.cpp:304
const char * getItemValue(Item item)
Definition: OctreeSceneStats.cpp:478
void traversed(const OctreeElementPointer &element)
Track that a element was traversed as part of computation of a scene.
Definition: OctreeSceneStats.cpp:215
void skippedOccluded(const OctreeElementPointer &element)
Track that a element was skipped as part of computation of a scene due to being occluded.
Definition: OctreeSceneStats.cpp:260
void existsInPacketBitsWritten()
Track that the exists in packet bitmask was was sent as part of computation of a scene.
Definition: OctreeSceneStats.cpp:291
void skippedDistance(const OctreeElementPointer &element)
Track that a element was skipped as part of computation of a scene due to being beyond the LOD distan...
Definition: OctreeSceneStats.cpp:224
void existsBitsWritten()
Track that the exists in tree bitmask was was sent as part of computation of a scene.
Definition: OctreeSceneStats.cpp:287
bool isReadyToSend() const
Indicates that a scene has been completed and the statistics are ready to be sent.
Definition: OctreeSceneStats.h:98
void encodeStopped()
Tracks the ending of an encode pass during scene calculation.
Definition: OctreeSceneStats.cpp:156
void childBitsRemoved(bool includesExistsBits)
Fix up tracking statistics in case where bitmasks were removed for some reason.
Definition: OctreeSceneStats.cpp:295
void didntFit(const OctreeElementPointer &element)
Track that a element was due to be sent, but didn't fit in the packet and was moved to next packet.
Definition: OctreeSceneStats.cpp:278
int unpackFromPacket(ReceivedMessage &packet)
Unpack the details of the statistics from a network packet.
Definition: OctreeSceneStats.cpp:342
void sceneCompleted()
Call when the computation of a scene is completed. Finalizes internal structures.
Definition: OctreeSceneStats.cpp:135
void skippedWasInView(const OctreeElementPointer &element)
Track that a element was skipped as part of computation of a scene due to previously being in view wh...
Definition: OctreeSceneStats.cpp:242
void skippedNoChange(const OctreeElementPointer &element)
Track that a element was skipped as part of computation of a scene due to not having changed since la...
Definition: OctreeSceneStats.cpp:251
void packetSent(int bytes)
Track that a packet was sent as part of the scene.
Definition: OctreeSceneStats.cpp:210
Item
List of various items tracked by OctreeSceneStats which can be accessed via getItemInfo() and getItem...
Definition: OctreeSceneStats.h:106
void skippedOutOfView(const OctreeElementPointer &element)
Track that a element was skipped as part of computation of a scene due to being out of view.
Definition: OctreeSceneStats.cpp:233
void markAsSent()
Mark that the scene statistics have been sent.
Definition: OctreeSceneStats.h:101
ItemInfo & getItemInfo(Item item)
Definition: OctreeSceneStats.h:136
void colorSent(const OctreeElementPointer &element)
Track that a element's color was was sent as part of computation of a scene.
Definition: OctreeSceneStats.cpp:269
void encodeStarted()
Tracks the beginning of an encode pass during scene calculation.
Definition: OctreeSceneStats.cpp:152
Meta information about each stats item.
Definition: OctreeSceneStats.h:127