mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 19:12:28 +02:00
Updates to tracing, removing log spam
This commit is contained in:
parent
c0d7c06d4a
commit
9b0d0b3e7a
4 changed files with 41 additions and 51 deletions
|
@ -103,11 +103,14 @@ public:
|
|||
}
|
||||
|
||||
void report() {
|
||||
uint64_t now = usecTimestampNow();
|
||||
if ((now - _lastReport) > USECS_PER_SECOND * 5) {
|
||||
_lastReport = now;
|
||||
qCDebug(glLogging) << "Current offscreen texture count " << _allTextureCount;
|
||||
qCDebug(glLogging) << "Current offscreen active texture count " << _activeTextureCount;
|
||||
if (randFloat() < 0.01f) {
|
||||
PROFILE_COUNTER(render_qml_gl, "offscreenTextures", {
|
||||
{ "total", QVariant::fromValue(_allTextureCount.load()) },
|
||||
{ "active", QVariant::fromValue(_activeTextureCount.load()) },
|
||||
});
|
||||
PROFILE_COUNTER(render_qml_gl, "offscreenTextureMemory", {
|
||||
{ "value", QVariant::fromValue(_totalTextureUsage) }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +192,6 @@ private:
|
|||
std::unordered_map<GLuint, uvec2> _textureSizes;
|
||||
Mutex _mutex;
|
||||
std::list<OffscreenQmlSurface::TextureAndFence> _returnedTextures;
|
||||
uint64_t _lastReport { 0 };
|
||||
size_t _totalTextureUsage { 0 };
|
||||
} offscreenTextures;
|
||||
|
||||
|
|
|
@ -12,23 +12,30 @@ StatTracker::StatTracker() {
|
|||
|
||||
}
|
||||
|
||||
QVariant StatTracker::getStat(QString name) {
|
||||
QVariant StatTracker::getStat(const QString& name) {
|
||||
std::lock_guard<std::mutex> lock(_statsLock);
|
||||
return _stats[name];
|
||||
}
|
||||
|
||||
void StatTracker::editStat(QString name, EditStatFunction fn) {
|
||||
std::lock_guard<std::mutex> lock(_statsLock);
|
||||
_stats[name] = fn(_stats[name]);
|
||||
void StatTracker::setStat(const QString& name, int value) {
|
||||
Lock lock(_statsLock);
|
||||
_stats[name] = value;
|
||||
}
|
||||
|
||||
void StatTracker::incrementStat(QString name) {
|
||||
std::lock_guard<std::mutex> lock(_statsLock);
|
||||
QVariant stat = _stats[name];
|
||||
_stats[name] = _stats[name].toInt() + 1;
|
||||
void StatTracker::updateStat(const QString& name, int value) {
|
||||
Lock lock(_statsLock);
|
||||
auto itr = _stats.find(name);
|
||||
if (_stats.end() == itr) {
|
||||
_stats[name] = value;
|
||||
} else {
|
||||
*itr = *itr + value;
|
||||
}
|
||||
}
|
||||
|
||||
void StatTracker::decrementStat(QString name) {
|
||||
std::lock_guard<std::mutex> lock(_statsLock);
|
||||
_stats[name] = _stats[name].toInt() - 1;
|
||||
void StatTracker::incrementStat(const QString& name) {
|
||||
updateStat(name, 1);
|
||||
}
|
||||
|
||||
void StatTracker::decrementStat(const QString& name) {
|
||||
updateStat(name, -1);
|
||||
}
|
|
@ -8,10 +8,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QVariantMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QVariantMap>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "DependencyManager.h"
|
||||
#include "Trace.h"
|
||||
|
||||
|
@ -20,13 +23,16 @@ using EditStatFunction = std::function<QVariant(QVariant currentValue)>;
|
|||
class StatTracker : public Dependency {
|
||||
public:
|
||||
StatTracker();
|
||||
QVariant getStat(QString name);
|
||||
void editStat(QString name, EditStatFunction fn);
|
||||
void incrementStat(QString name);
|
||||
void decrementStat(QString name);
|
||||
QVariant getStat(const QString& name);
|
||||
void setStat(const QString& name, int value);
|
||||
void updateStat(const QString& name, int mod);
|
||||
void incrementStat(const QString& name);
|
||||
void decrementStat(const QString& name);
|
||||
private:
|
||||
std::mutex _statsLock;
|
||||
QVariantMap _stats;
|
||||
using Mutex = std::mutex;
|
||||
using Lock = std::lock_guard<Mutex>;
|
||||
Mutex _statsLock;
|
||||
QHash<QString, int> _stats;
|
||||
};
|
||||
|
||||
class CounterStat {
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
//
|
||||
// Created by Bradley Austin Davis on 2016/12/12
|
||||
// Copyright 2013-2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
Script.setTimeout(function() {
|
||||
var loggingRules = "" +
|
||||
"*.debug=false\n" +
|
||||
"hifi.render.debug=true\n" +
|
||||
"hifi.interface.debug=true\n" +
|
||||
"";
|
||||
Test.startTracing(loggingRules);
|
||||
}, 1 * 1000);
|
||||
|
||||
|
||||
Script.setTimeout(function() {
|
||||
Test.stopTracing("h:/testScriptTrace.json.gz");
|
||||
Test.quit();
|
||||
}, 10 * 1000);
|
||||
|
||||
|
Loading…
Reference in a new issue