mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 21:05:04 +02:00
Repeated logging - reviewer fixes
This commit is contained in:
parent
692ccfc09b
commit
ed3347a89b
9 changed files with 69 additions and 30 deletions
|
@ -151,6 +151,11 @@ int AudioRingBufferTemplate<T>::appendData(char *data, int maxSize) {
|
||||||
return numReadSamples * SampleSize;
|
return numReadSamples * SampleSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
int repeatedOverflowMessageID = 0;
|
||||||
|
std::atomic<int> messageIDInit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
int AudioRingBufferTemplate<T>::writeData(const char* data, int maxSize) {
|
int AudioRingBufferTemplate<T>::writeData(const char* data, int maxSize) {
|
||||||
// only copy up to the number of samples we have capacity for
|
// only copy up to the number of samples we have capacity for
|
||||||
|
@ -164,8 +169,10 @@ int AudioRingBufferTemplate<T>::writeData(const char* data, int maxSize) {
|
||||||
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
||||||
_overflowCount++;
|
_overflowCount++;
|
||||||
|
|
||||||
HIFI_FCDEBUG(audio(), RING_BUFFER_OVERFLOW_DEBUG);
|
if (++messageIDInit == 1) {
|
||||||
qPrintable(RING_BUFFER_OVERFLOW_DEBUG);
|
repeatedOverflowMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
}
|
||||||
|
HIFI_FCDEBUG_ID(audio(), repeatedOverflowMessageID, RING_BUFFER_OVERFLOW_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_endOfLastWrite + numWriteSamples > _buffer + _bufferLength) {
|
if (_endOfLastWrite + numWriteSamples > _buffer + _bufferLength) {
|
||||||
|
@ -273,7 +280,11 @@ int AudioRingBufferTemplate<T>::writeSamples(ConstIterator source, int maxSample
|
||||||
int samplesToDelete = samplesToCopy - samplesRoomFor;
|
int samplesToDelete = samplesToCopy - samplesRoomFor;
|
||||||
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
||||||
_overflowCount++;
|
_overflowCount++;
|
||||||
HIFI_FCDEBUG(audio(), RING_BUFFER_OVERFLOW_DEBUG);
|
|
||||||
|
if (++messageIDInit == 1) {
|
||||||
|
repeatedOverflowMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
}
|
||||||
|
HIFI_FCDEBUG_ID(audio(), repeatedOverflowMessageID, RING_BUFFER_OVERFLOW_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sample* bufferLast = _buffer + _bufferLength - 1;
|
Sample* bufferLast = _buffer + _bufferLength - 1;
|
||||||
|
@ -295,7 +306,11 @@ int AudioRingBufferTemplate<T>::writeSamplesWithFade(ConstIterator source, int m
|
||||||
int samplesToDelete = samplesToCopy - samplesRoomFor;
|
int samplesToDelete = samplesToCopy - samplesRoomFor;
|
||||||
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
||||||
_overflowCount++;
|
_overflowCount++;
|
||||||
HIFI_FCDEBUG(audio(), RING_BUFFER_OVERFLOW_DEBUG);
|
|
||||||
|
if (++messageIDInit == 1) {
|
||||||
|
repeatedOverflowMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
}
|
||||||
|
HIFI_FCDEBUG_ID(audio(), repeatedOverflowMessageID, RING_BUFFER_OVERFLOW_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sample* bufferLast = _buffer + _bufferLength - 1;
|
Sample* bufferLast = _buffer + _bufferLength - 1;
|
||||||
|
|
|
@ -571,13 +571,15 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
|
||||||
totalSourceIndices += (part.quadTrianglesIndices.size() + part.triangleIndices.size());
|
totalSourceIndices += (part.quadTrianglesIndices.size() + part.triangleIndices.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int repeatMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
|
||||||
if (!totalSourceIndices) {
|
if (!totalSourceIndices) {
|
||||||
HIFI_FCDEBUG(modelformat(), "buildModelMesh failed -- no indices, url = " << url);
|
HIFI_FCDEBUG_ID(modelformat(), repeatMessageID, "buildModelMesh failed -- no indices, url = " << url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extractedMesh.vertices.size() == 0) {
|
if (extractedMesh.vertices.size() == 0) {
|
||||||
HIFI_FCDEBUG(modelformat(), "buildModelMesh failed -- no vertices, url = " << url);
|
HIFI_FCDEBUG_ID(modelformat(), repeatMessageID, "buildModelMesh failed -- no vertices, url = " << url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,9 +85,11 @@ btTypedConstraint* ObjectConstraintBallSocket::getConstraint() {
|
||||||
return constraint;
|
return constraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int repeatMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
|
||||||
btRigidBody* rigidBodyA = getRigidBody();
|
btRigidBody* rigidBodyA = getRigidBody();
|
||||||
if (!rigidBodyA) {
|
if (!rigidBodyA) {
|
||||||
HIFI_FCDEBUG(physics(), "ObjectConstraintBallSocket::getConstraint -- no rigidBodyA");
|
HIFI_FCDEBUG_ID(physics(), repeatMessageID, "ObjectConstraintBallSocket::getConstraint -- no rigidBodyA");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +98,7 @@ btTypedConstraint* ObjectConstraintBallSocket::getConstraint() {
|
||||||
|
|
||||||
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
||||||
if (!rigidBodyB) {
|
if (!rigidBodyB) {
|
||||||
HIFI_FCDEBUG(physics(), "ObjectConstraintBallSocket::getConstraint -- no rigidBodyB");
|
HIFI_FCDEBUG_ID(physics(), repeatMessageID, "ObjectConstraintBallSocket::getConstraint -- no rigidBodyB");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,9 +96,11 @@ btTypedConstraint* ObjectConstraintConeTwist::getConstraint() {
|
||||||
return constraint;
|
return constraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int repeatMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
|
||||||
btRigidBody* rigidBodyA = getRigidBody();
|
btRigidBody* rigidBodyA = getRigidBody();
|
||||||
if (!rigidBodyA) {
|
if (!rigidBodyA) {
|
||||||
HIFI_FCDEBUG(physics(), "ObjectConstraintConeTwist::getConstraint -- no rigidBodyA");
|
HIFI_FCDEBUG_ID(physics(), repeatMessageID, "ObjectConstraintConeTwist::getConstraint -- no rigidBodyA");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +129,7 @@ btTypedConstraint* ObjectConstraintConeTwist::getConstraint() {
|
||||||
|
|
||||||
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
||||||
if (!rigidBodyB) {
|
if (!rigidBodyB) {
|
||||||
HIFI_FCDEBUG(physics(), "ObjectConstraintConeTwist::getConstraint -- no rigidBodyB");
|
HIFI_FCDEBUG_ID(physics(), repeatMessageID, "ObjectConstraintConeTwist::getConstraint -- no rigidBodyB");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,11 @@ btTypedConstraint* ObjectConstraintHinge::getConstraint() {
|
||||||
return constraint;
|
return constraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int repeatMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
|
||||||
btRigidBody* rigidBodyA = getRigidBody();
|
btRigidBody* rigidBodyA = getRigidBody();
|
||||||
if (!rigidBodyA) {
|
if (!rigidBodyA) {
|
||||||
HIFI_FCDEBUG(physics(), "ObjectConstraintHinge::getConstraint -- no rigidBodyA");
|
HIFI_FCDEBUG_ID(physics(), repeatMessageID, "ObjectConstraintHinge::getConstraint -- no rigidBodyA");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +114,7 @@ btTypedConstraint* ObjectConstraintHinge::getConstraint() {
|
||||||
// This hinge is between two entities... find the other rigid body.
|
// This hinge is between two entities... find the other rigid body.
|
||||||
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
||||||
if (!rigidBodyB) {
|
if (!rigidBodyB) {
|
||||||
HIFI_FCDEBUG(physics(), "ObjectConstraintHinge::getConstraint -- no rigidBodyB");
|
HIFI_FCDEBUG_ID(physics(), repeatMessageID, "ObjectConstraintHinge::getConstraint -- no rigidBodyB");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,11 @@ btTypedConstraint* ObjectConstraintSlider::getConstraint() {
|
||||||
return constraint;
|
return constraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int repeatMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
|
||||||
btRigidBody* rigidBodyA = getRigidBody();
|
btRigidBody* rigidBodyA = getRigidBody();
|
||||||
if (!rigidBodyA) {
|
if (!rigidBodyA) {
|
||||||
HIFI_FCDEBUG(physics(), "ObjectConstraintSlider::getConstraint -- no rigidBodyA");
|
HIFI_FCDEBUG_ID(physics(), repeatMessageID, "ObjectConstraintSlider::getConstraint -- no rigidBodyA");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +120,7 @@ btTypedConstraint* ObjectConstraintSlider::getConstraint() {
|
||||||
|
|
||||||
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
||||||
if (!rigidBodyB) {
|
if (!rigidBodyB) {
|
||||||
HIFI_FCDEBUG(physics(), "ObjectConstraintSlider::getConstraint -- no rigidBodyB");
|
HIFI_FCDEBUG_ID(physics(), repeatMessageID, "ObjectConstraintSlider::getConstraint -- no rigidBodyB");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,11 @@ void render::renderItems(const RenderContextPointer& renderContext, const ItemBo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
int repeatedInvalidKeyMessageID = 0;
|
||||||
|
std::atomic<int> messageIDInit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, const Item& item, const ShapeKey& globalKey) {
|
void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, const Item& item, const ShapeKey& globalKey) {
|
||||||
assert(item.getKey().isShape());
|
assert(item.getKey().isShape());
|
||||||
auto key = item.getShapeKey() | globalKey;
|
auto key = item.getShapeKey() | globalKey;
|
||||||
|
@ -55,7 +60,10 @@ void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, cons
|
||||||
} else if (key.hasOwnPipeline()) {
|
} else if (key.hasOwnPipeline()) {
|
||||||
item.render(args);
|
item.render(args);
|
||||||
} else {
|
} else {
|
||||||
HIFI_FCDEBUG(renderlogging(), "Item could not be rendered with invalid key" << key);
|
if (++messageIDInit == 1) {
|
||||||
|
repeatedInvalidKeyMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
}
|
||||||
|
HIFI_FCDEBUG_ID(renderlogging(), repeatedInvalidKeyMessageID, "Item could not be rendered with invalid key" << key);
|
||||||
}
|
}
|
||||||
args->_itemShapeKey = 0;
|
args->_itemShapeKey = 0;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +114,10 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext,
|
||||||
} else if (key.hasOwnPipeline()) {
|
} else if (key.hasOwnPipeline()) {
|
||||||
ownPipelineBucket.push_back( std::make_tuple(item, key) );
|
ownPipelineBucket.push_back( std::make_tuple(item, key) );
|
||||||
} else {
|
} else {
|
||||||
HIFI_FCDEBUG(renderlogging(), "Item could not be rendered with invalid key" << key);
|
if (++messageIDInit == 1) {
|
||||||
|
repeatedInvalidKeyMessageID = LogHandler::getInstance().newRepeatedMessageID();
|
||||||
|
}
|
||||||
|
HIFI_FCDEBUG_ID(renderlogging(), repeatedInvalidKeyMessageID, "Item could not be rendered with invalid key" << key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,15 +92,15 @@ void LogHandler::setShouldDisplayMilliseconds(bool shouldDisplayMilliseconds) {
|
||||||
void LogHandler::flushRepeatedMessages() {
|
void LogHandler::flushRepeatedMessages() {
|
||||||
QMutexLocker lock(&_mutex);
|
QMutexLocker lock(&_mutex);
|
||||||
|
|
||||||
// New repeat-supress scheme:
|
// New repeat-suppress scheme:
|
||||||
for (int m = 0; m < (int)_repeatCounts.size(); ++m) {
|
for (int m = 0; m < (int)_repeatedMessageRecords.size(); ++m) {
|
||||||
int repeatCount = _repeatCounts[m];
|
int repeatCount = _repeatedMessageRecords[m].repeatCount;
|
||||||
if (repeatCount > 1) {
|
if (repeatCount > 1) {
|
||||||
QString repeatLogMessage = QString().setNum(repeatCount) + " repeated log entries - Last entry: \""
|
QString repeatLogMessage = QString().setNum(repeatCount) + " repeated log entries - Last entry: \""
|
||||||
+ _repeatedMessageStrings[m] + "\"";
|
+ _repeatedMessageRecords[m].repeatString + "\"";
|
||||||
printMessage(LogSuppressed, QMessageLogContext(), repeatLogMessage);
|
printMessage(LogSuppressed, QMessageLogContext(), repeatLogMessage);
|
||||||
_repeatCounts[m] = 0;
|
_repeatedMessageRecords[m].repeatCount = 0;
|
||||||
_repeatedMessageStrings[m] = QString();
|
_repeatedMessageRecords[m].repeatString = QString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,8 +193,8 @@ int LogHandler::newRepeatedMessageID() {
|
||||||
QMutexLocker lock(&_mutex);
|
QMutexLocker lock(&_mutex);
|
||||||
int newMessageId = _currentMessageID;
|
int newMessageId = _currentMessageID;
|
||||||
++_currentMessageID;
|
++_currentMessageID;
|
||||||
_repeatCounts.push_back(0);
|
RepeatedMessageRecord newRecord { 0 };
|
||||||
_repeatedMessageStrings.resize(_currentMessageID);
|
_repeatedMessageRecords.push_back(newRecord);
|
||||||
return newMessageId;
|
return newMessageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,11 +205,11 @@ void LogHandler::printRepeatedMessage(int messageID, LogMsgType type, const QMes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_repeatCounts[messageID] == 0) {
|
if (_repeatedMessageRecords[messageID].repeatCount == 0) {
|
||||||
printMessage(type, context, message);
|
printMessage(type, context, message);
|
||||||
} else {
|
} else {
|
||||||
_repeatedMessageStrings[messageID] = message;
|
_repeatedMessageRecords[messageID].repeatString = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
++_repeatCounts[messageID];
|
++_repeatedMessageRecords[messageID].repeatCount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,8 +76,11 @@ private:
|
||||||
std::vector<OnceOnlyMessage> _onetimeMessages;
|
std::vector<OnceOnlyMessage> _onetimeMessages;
|
||||||
|
|
||||||
int _currentMessageID { 0 };
|
int _currentMessageID { 0 };
|
||||||
std::vector<int> _repeatCounts;
|
struct RepeatedMessageRecord {
|
||||||
std::vector<QString> _repeatedMessageStrings;
|
int repeatCount;
|
||||||
|
QString repeatString;
|
||||||
|
};
|
||||||
|
std::vector<RepeatedMessageRecord> _repeatedMessageRecords;
|
||||||
static QMutex _mutex;
|
static QMutex _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,6 +109,6 @@ private:
|
||||||
} \
|
} \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
#define HIFI_FDEBUG_ID(message) HIFI_FCDEBUG_ID((*QLoggingCategory::defaultCategory()), message)
|
#define HIFI_FDEBUG_ID(messageID, message) HIFI_FCDEBUG_ID((*QLoggingCategory::defaultCategory()), messageID, message)
|
||||||
|
|
||||||
#endif // hifi_LogHandler_h
|
#endif // hifi_LogHandler_h
|
||||||
|
|
Loading…
Reference in a new issue