mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
Merge pull request #9236 from jherico/chrome_tracing
Updates to tracing, removing log spam
This commit is contained in:
commit
5cc1cd758f
4 changed files with 41 additions and 51 deletions
|
@ -103,11 +103,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void report() {
|
void report() {
|
||||||
uint64_t now = usecTimestampNow();
|
if (randFloat() < 0.01f) {
|
||||||
if ((now - _lastReport) > USECS_PER_SECOND * 5) {
|
PROFILE_COUNTER(render_qml_gl, "offscreenTextures", {
|
||||||
_lastReport = now;
|
{ "total", QVariant::fromValue(_allTextureCount.load()) },
|
||||||
qCDebug(glLogging) << "Current offscreen texture count " << _allTextureCount;
|
{ "active", QVariant::fromValue(_activeTextureCount.load()) },
|
||||||
qCDebug(glLogging) << "Current offscreen active texture count " << _activeTextureCount;
|
});
|
||||||
|
PROFILE_COUNTER(render_qml_gl, "offscreenTextureMemory", {
|
||||||
|
{ "value", QVariant::fromValue(_totalTextureUsage) }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +192,6 @@ private:
|
||||||
std::unordered_map<GLuint, uvec2> _textureSizes;
|
std::unordered_map<GLuint, uvec2> _textureSizes;
|
||||||
Mutex _mutex;
|
Mutex _mutex;
|
||||||
std::list<OffscreenQmlSurface::TextureAndFence> _returnedTextures;
|
std::list<OffscreenQmlSurface::TextureAndFence> _returnedTextures;
|
||||||
uint64_t _lastReport { 0 };
|
|
||||||
size_t _totalTextureUsage { 0 };
|
size_t _totalTextureUsage { 0 };
|
||||||
} offscreenTextures;
|
} 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);
|
std::lock_guard<std::mutex> lock(_statsLock);
|
||||||
return _stats[name];
|
return _stats[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatTracker::editStat(QString name, EditStatFunction fn) {
|
void StatTracker::setStat(const QString& name, int value) {
|
||||||
std::lock_guard<std::mutex> lock(_statsLock);
|
Lock lock(_statsLock);
|
||||||
_stats[name] = fn(_stats[name]);
|
_stats[name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatTracker::incrementStat(QString name) {
|
void StatTracker::updateStat(const QString& name, int value) {
|
||||||
std::lock_guard<std::mutex> lock(_statsLock);
|
Lock lock(_statsLock);
|
||||||
QVariant stat = _stats[name];
|
auto itr = _stats.find(name);
|
||||||
_stats[name] = _stats[name].toInt() + 1;
|
if (_stats.end() == itr) {
|
||||||
|
_stats[name] = value;
|
||||||
|
} else {
|
||||||
|
*itr = *itr + value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatTracker::decrementStat(QString name) {
|
void StatTracker::incrementStat(const QString& name) {
|
||||||
std::lock_guard<std::mutex> lock(_statsLock);
|
updateStat(name, 1);
|
||||||
_stats[name] = _stats[name].toInt() - 1;
|
}
|
||||||
|
|
||||||
|
void StatTracker::decrementStat(const QString& name) {
|
||||||
|
updateStat(name, -1);
|
||||||
}
|
}
|
|
@ -8,10 +8,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QString>
|
#include <QtCore/QString>
|
||||||
#include <QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QVariantMap>
|
#include <QtCore/QSet>
|
||||||
|
#include <QtCore/QVariantMap>
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "DependencyManager.h"
|
#include "DependencyManager.h"
|
||||||
#include "Trace.h"
|
#include "Trace.h"
|
||||||
|
|
||||||
|
@ -20,13 +23,16 @@ using EditStatFunction = std::function<QVariant(QVariant currentValue)>;
|
||||||
class StatTracker : public Dependency {
|
class StatTracker : public Dependency {
|
||||||
public:
|
public:
|
||||||
StatTracker();
|
StatTracker();
|
||||||
QVariant getStat(QString name);
|
QVariant getStat(const QString& name);
|
||||||
void editStat(QString name, EditStatFunction fn);
|
void setStat(const QString& name, int value);
|
||||||
void incrementStat(QString name);
|
void updateStat(const QString& name, int mod);
|
||||||
void decrementStat(QString name);
|
void incrementStat(const QString& name);
|
||||||
|
void decrementStat(const QString& name);
|
||||||
private:
|
private:
|
||||||
std::mutex _statsLock;
|
using Mutex = std::mutex;
|
||||||
QVariantMap _stats;
|
using Lock = std::lock_guard<Mutex>;
|
||||||
|
Mutex _statsLock;
|
||||||
|
QHash<QString, int> _stats;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CounterStat {
|
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