mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 12:57:38 +02:00
cleanup comments and coding standard
This commit is contained in:
parent
3a16a4935d
commit
7cc5339702
4 changed files with 33 additions and 25 deletions
|
@ -366,8 +366,8 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod
|
|||
if (!nodeData->nodeBag.isEmpty()) {
|
||||
int bytesWritten = 0;
|
||||
uint64_t start = usecTimestampNow();
|
||||
uint64_t startCompressTimeMsecs = VoxelPacketData::_checkCompressTime / 1000;
|
||||
uint64_t startCompressCalls = VoxelPacketData::_checkCompressCalls;
|
||||
uint64_t startCompressTimeMsecs = VoxelPacketData::getCompressContentTime() / 1000;
|
||||
uint64_t startCompressCalls = VoxelPacketData::getCompressContentCalls();
|
||||
|
||||
bool shouldSendEnvironments = _myServer->wantSendEnvironments() && shouldDo(ENVIRONMENT_SEND_INTERVAL_USECS, VOXEL_SEND_INTERVAL_USECS);
|
||||
|
||||
|
@ -526,10 +526,10 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod
|
|||
uint64_t end = usecTimestampNow();
|
||||
int elapsedmsec = (end - start)/1000;
|
||||
|
||||
uint64_t endCompressCalls = VoxelPacketData::_checkCompressCalls;
|
||||
uint64_t endCompressCalls = VoxelPacketData::getCompressContentCalls();
|
||||
int elapsedCompressCalls = endCompressCalls - startCompressCalls;
|
||||
|
||||
uint64_t endCompressTimeMsecs = VoxelPacketData::_checkCompressTime / 1000;
|
||||
uint64_t endCompressTimeMsecs = VoxelPacketData::getCompressContentTime() / 1000;
|
||||
int elapsedCompressTimeMsecs = endCompressTimeMsecs - startCompressTimeMsecs;
|
||||
|
||||
|
||||
|
|
|
@ -268,9 +268,9 @@ int VoxelServer::civetwebRequestHandler(struct mg_connection* connection) {
|
|||
uint64_t totalOutboundPackets = VoxelSendThread::_totalPackets;
|
||||
uint64_t totalOutboundBytes = VoxelSendThread::_totalBytes;
|
||||
uint64_t totalWastedBytes = VoxelSendThread::_totalWastedBytes;
|
||||
uint64_t totalBytesOfOctalCodes = VoxelPacketData::_totalBytesOfOctalCodes;
|
||||
uint64_t totalBytesOfBitMasks = VoxelPacketData::_totalBytesOfBitMasks;
|
||||
uint64_t totalBytesOfColor = VoxelPacketData::_totalBytesOfColor;
|
||||
uint64_t totalBytesOfOctalCodes = VoxelPacketData::getTotalBytesOfOctalCodes();
|
||||
uint64_t totalBytesOfBitMasks = VoxelPacketData::getTotalBytesOfBitMasks();
|
||||
uint64_t totalBytesOfColor = VoxelPacketData::getTotalBytesOfColor();
|
||||
|
||||
const int COLUMN_WIDTH = 10;
|
||||
mg_printf(connection, " Total Outbound Packets: %s packets\r\n",
|
||||
|
|
|
@ -117,12 +117,11 @@ const unsigned char* VoxelPacketData::getFinalizedData() {
|
|||
return &_uncompressed[0];
|
||||
}
|
||||
|
||||
|
||||
if (_dirty) {
|
||||
if (_debug) {
|
||||
printf("getFinalizedData() _compressedBytes=%d _bytesInUse=%d\n",_compressedBytes, _bytesInUse);
|
||||
}
|
||||
checkCompress();
|
||||
compressContent();
|
||||
}
|
||||
return &_compressed[0];
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ int VoxelPacketData::getFinalizedSize() {
|
|||
if (_debug) {
|
||||
printf("getFinalizedSize() _compressedBytes=%d _bytesInUse=%d\n",_compressedBytes, _bytesInUse);
|
||||
}
|
||||
checkCompress();
|
||||
compressContent();
|
||||
}
|
||||
|
||||
return _compressedBytes;
|
||||
|
@ -231,11 +230,11 @@ bool VoxelPacketData::appendColor(const nodeColor& color) {
|
|||
return success;
|
||||
}
|
||||
|
||||
uint64_t VoxelPacketData::_checkCompressTime = 0;
|
||||
uint64_t VoxelPacketData::_checkCompressCalls = 0;
|
||||
uint64_t VoxelPacketData::_compressContentTime = 0;
|
||||
uint64_t VoxelPacketData::_compressContentCalls = 0;
|
||||
|
||||
bool VoxelPacketData::checkCompress() {
|
||||
PerformanceWarning warn(false,"VoxelPacketData::checkCompress()",false,&_checkCompressTime,&_checkCompressCalls);
|
||||
bool VoxelPacketData::compressContent() {
|
||||
PerformanceWarning warn(false, "VoxelPacketData::compressContent()", false, &_compressContentTime, &_compressContentCalls);
|
||||
|
||||
// without compression, we always pass...
|
||||
if (!_enableCompression) {
|
||||
|
@ -261,8 +260,6 @@ bool VoxelPacketData::checkCompress() {
|
|||
_dirty = false;
|
||||
success = true;
|
||||
}
|
||||
|
||||
//printf("checkCompress() returning %s _compressedBytes=%d\n",debug::valueOf(success), _compressedBytes);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ const int REASONABLE_NUMBER_OF_PACKING_ATTEMPTS = 5;
|
|||
const int PACKET_IS_COLOR_BIT = 0;
|
||||
const int PACKET_IS_COMPRESSED_BIT = 1;
|
||||
|
||||
/// An opaque key used when starting, ending, and discarding encoding/packing levels of VoxelPacketData
|
||||
class LevelDetails {
|
||||
LevelDetails(int startIndex, int bytesOfOctalCodes, int bytesOfBitmasks, int bytesOfColor) :
|
||||
_startIndex(startIndex),
|
||||
|
@ -59,6 +60,7 @@ private:
|
|||
int _bytesOfColor;
|
||||
};
|
||||
|
||||
/// Handles packing of the data portion of PACKET_TYPE_VOXEL_DATA messages.
|
||||
class VoxelPacketData {
|
||||
public:
|
||||
VoxelPacketData(bool enableCompression = false, int maxFinalizedSize = MAX_VOXEL_PACKET_DATA_SIZE);
|
||||
|
@ -124,18 +126,21 @@ public:
|
|||
/// load finalized content to allow access to decoded content for parsing
|
||||
void loadFinalizedContent(const unsigned char* data, int length);
|
||||
|
||||
/// returns whether or not zlib compression enabled on finalization
|
||||
bool isCompressed() const { return _enableCompression; }
|
||||
|
||||
/// returns the target uncompressed size
|
||||
int getTargetSize() const { return _targetSize; }
|
||||
|
||||
/// displays contents for debugging
|
||||
void debugContent();
|
||||
|
||||
static uint64_t getCompressContentTime() { return _compressContentTime; } /// total time spent compressing content
|
||||
static uint64_t getCompressContentCalls() { return _compressContentCalls; } /// total calls to compress content
|
||||
static uint64_t getTotalBytesOfOctalCodes() { return _totalBytesOfOctalCodes; } /// total bytes for octal codes
|
||||
static uint64_t getTotalBytesOfBitMasks() { return _totalBytesOfBitMasks; } /// total bytes of bitmasks
|
||||
static uint64_t getTotalBytesOfColor() { return _totalBytesOfColor; } /// total bytes of color
|
||||
|
||||
static uint64_t _checkCompressTime;
|
||||
static uint64_t _checkCompressCalls;
|
||||
|
||||
static uint64_t _totalBytesOfOctalCodes;
|
||||
static uint64_t _totalBytesOfBitMasks;
|
||||
static uint64_t _totalBytesOfColor;
|
||||
|
||||
private:
|
||||
/// appends raw bytes, might fail if byte would cause packet to be too large
|
||||
bool append(const unsigned char* data, int length);
|
||||
|
@ -151,7 +156,7 @@ private:
|
|||
int _bytesAvailable;
|
||||
int _subTreeAt;
|
||||
|
||||
bool checkCompress();
|
||||
bool compressContent();
|
||||
|
||||
unsigned char _compressed[MAX_VOXEL_UNCOMRESSED_PACKET_SIZE];
|
||||
int _compressedBytes;
|
||||
|
@ -165,7 +170,13 @@ private:
|
|||
int _bytesOfOctalCodesCurrentSubTree;
|
||||
|
||||
static bool _debug;
|
||||
|
||||
|
||||
static uint64_t _compressContentTime;
|
||||
static uint64_t _compressContentCalls;
|
||||
|
||||
static uint64_t _totalBytesOfOctalCodes;
|
||||
static uint64_t _totalBytesOfBitMasks;
|
||||
static uint64_t _totalBytesOfColor;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__VoxelPacketData__) */
|
Loading…
Reference in a new issue