mirror of
https://github.com/lubosz/overte.git
synced 2025-04-10 08:57:12 +02:00
add to stats
This commit is contained in:
parent
c474f38860
commit
b5b7167644
9 changed files with 134 additions and 23 deletions
|
@ -116,6 +116,22 @@ Item {
|
|||
visible: root.expanded
|
||||
text: "Avatars NOT Updated: " + root.notUpdatedAvatarCount
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "Total picks:\n " +
|
||||
root.stylusPicksCount + " styluses\n " +
|
||||
root.rayPicksCount + " rays\n " +
|
||||
root.parabolaPicksCount + " parabolas\n " +
|
||||
root.collisionPicksCount + " colliders"
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "Intersection calls: Entities/Overlays/Avatars/HUD\n " +
|
||||
root.stylusPicksUpdated.x + "/" + root.stylusPicksUpdated.y + "/" + root.stylusPicksUpdated.z + "/" + root.stylusPicksUpdated.w + "\n " +
|
||||
root.rayPicksUpdated.x + "/" + root.rayPicksUpdated.y + "/" + root.rayPicksUpdated.z + "/" + root.rayPicksUpdated.w + "\n " +
|
||||
root.parabolaPicksUpdated.x + "/" + root.parabolaPicksUpdated.y + "/" + root.parabolaPicksUpdated.z + "/" + root.parabolaPicksUpdated.w + "\n " +
|
||||
root.collisionPicksUpdated.x + "/" + root.collisionPicksUpdated.y + "/" + root.collisionPicksUpdated.z + "/" + root.collisionPicksUpdated.w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <OffscreenUi.h>
|
||||
#include <PerfStat.h>
|
||||
#include <plugins/DisplayPlugin.h>
|
||||
#include <PickManager.h>
|
||||
|
||||
#include <gl/Context.h>
|
||||
|
||||
|
@ -146,6 +147,20 @@ void Stats::updateStats(bool force) {
|
|||
}
|
||||
STAT_UPDATE(gameLoopRate, (int)qApp->getGameLoopRate());
|
||||
|
||||
auto pickManager = DependencyManager::get<PickManager>();
|
||||
if (pickManager && (_expanded || force)) {
|
||||
std::vector<int> totalPicks = pickManager->getTotalPickCounts();
|
||||
STAT_UPDATE(stylusPicksCount, totalPicks[PickQuery::Stylus]);
|
||||
STAT_UPDATE(rayPicksCount, totalPicks[PickQuery::Ray]);
|
||||
STAT_UPDATE(parabolaPicksCount, totalPicks[PickQuery::Parabola]);
|
||||
STAT_UPDATE(collisionPicksCount, totalPicks[PickQuery::Collision]);
|
||||
std::vector<QVector4D> updatedPicks = pickManager->getUpdatedPickCounts();
|
||||
STAT_UPDATE(stylusPicksUpdated, updatedPicks[PickQuery::Stylus]);
|
||||
STAT_UPDATE(rayPicksUpdated, updatedPicks[PickQuery::Ray]);
|
||||
STAT_UPDATE(parabolaPicksUpdated, updatedPicks[PickQuery::Parabola]);
|
||||
STAT_UPDATE(collisionPicksUpdated, updatedPicks[PickQuery::Collision]);
|
||||
}
|
||||
|
||||
auto bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
|
||||
STAT_UPDATE(packetInCount, (int)bandwidthRecorder->getCachedTotalAverageInputPacketsPerSecond());
|
||||
STAT_UPDATE(packetOutCount, (int)bandwidthRecorder->getCachedTotalAverageOutputPacketsPerSecond());
|
||||
|
@ -285,7 +300,7 @@ void Stats::updateStats(bool force) {
|
|||
// downloads << (int)(resource->getProgress() * 100.0f) << "% ";
|
||||
//}
|
||||
//downloads << "(" << << " pending)";
|
||||
} // expanded avatar column
|
||||
}
|
||||
|
||||
// Fourth column, octree stats
|
||||
int serverCount = 0;
|
||||
|
|
|
@ -22,7 +22,6 @@ public: \
|
|||
private: \
|
||||
type _##name{ initialValue };
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* @namespace Stats
|
||||
*
|
||||
|
@ -168,6 +167,15 @@ private: \
|
|||
* @property {number} implicitHeight
|
||||
*
|
||||
* @property {object} layer - <em>Read-only.</em>
|
||||
|
||||
* @property {number} stylusPicksCount - <em>Read-only.</em>
|
||||
* @property {number} rayPicksCount - <em>Read-only.</em>
|
||||
* @property {number} parabolaPicksCount - <em>Read-only.</em>
|
||||
* @property {number} collisionPicksCount - <em>Read-only.</em>
|
||||
* @property {Vec4} stylusPicksUpdated - <em>Read-only.</em>
|
||||
* @property {Vec4} rayPicksUpdated - <em>Read-only.</em>
|
||||
* @property {Vec4} parabolaPicksUpdated - <em>Read-only.</em>
|
||||
* @property {Vec4} collisionPicksUpdated - <em>Read-only.</em>
|
||||
*/
|
||||
// Properties from x onwards are QQuickItem properties.
|
||||
|
||||
|
@ -285,6 +293,15 @@ class Stats : public QQuickItem {
|
|||
STATS_PROPERTY(float, avatarSimulationTime, 0)
|
||||
Q_PROPERTY(QStringList animStackNames READ animStackNames NOTIFY animStackNamesChanged)
|
||||
|
||||
STATS_PROPERTY(int, stylusPicksCount, 0)
|
||||
STATS_PROPERTY(int, rayPicksCount, 0)
|
||||
STATS_PROPERTY(int, parabolaPicksCount, 0)
|
||||
STATS_PROPERTY(int, collisionPicksCount, 0)
|
||||
STATS_PROPERTY(QVector4D, stylusPicksUpdated, QVector4D(0, 0, 0, 0))
|
||||
STATS_PROPERTY(QVector4D, rayPicksUpdated, QVector4D(0, 0, 0, 0))
|
||||
STATS_PROPERTY(QVector4D, parabolaPicksUpdated, QVector4D(0, 0, 0, 0))
|
||||
STATS_PROPERTY(QVector4D, collisionPicksUpdated, QVector4D(0, 0, 0, 0))
|
||||
|
||||
public:
|
||||
static Stats* getInstance();
|
||||
|
||||
|
@ -1245,6 +1262,62 @@ signals:
|
|||
* @function Stats.update
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>stylusPicksCount</code> property changes.
|
||||
* @function Stats.stylusPicksCountChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void stylusPicksCountChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>rayPicksCount</code> property changes.
|
||||
* @function Stats.rayPicksCountChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void rayPicksCountChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>parabolaPicksCount</code> property changes.
|
||||
* @function Stats.parabolaPicksCountChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void parabolaPicksCountChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>collisionPicksCount</code> property changes.
|
||||
* @function Stats.collisionPicksCountChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void collisionPicksCountChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>stylusPicksUpdated</code> property changes.
|
||||
* @function Stats.stylusPicksUpdatedChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void stylusPicksUpdatedChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>rayPicksUpdated</code> property changes.
|
||||
* @function Stats.rayPicksUpdatedChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void rayPicksUpdatedChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>parabolaPicksUpdated</code> property changes.
|
||||
* @function Stats.parabolaPicksUpdatedChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void parabolaPicksUpdatedChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>collisionPicksUpdated</code> property changes.
|
||||
* @function Stats.collisionPicksUpdatedChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void collisionPicksUpdatedChanged();
|
||||
|
||||
private:
|
||||
int _recentMaxPackets{ 0 } ; // recent max incoming voxel packets to process
|
||||
bool _resetRecentMaxPacketsSoon{ true };
|
||||
|
|
|
@ -571,7 +571,6 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o
|
|||
}
|
||||
|
||||
glm::mat4 wtvMatrix = worldToVoxelMatrix();
|
||||
glm::mat4 vtwMatrix = voxelToWorldMatrix();
|
||||
glm::vec3 normDirection = glm::normalize(direction);
|
||||
|
||||
// the PolyVox ray intersection code requires a near and far point.
|
||||
|
|
|
@ -145,7 +145,6 @@ EntityItemID EntityTreeElement::findRayIntersection(const glm::vec3& origin, con
|
|||
bool visibleOnly, bool collidableOnly, QVariantMap& extraInfo, bool precisionPicking) {
|
||||
|
||||
EntityItemID result;
|
||||
float distanceToElementCube = FLT_MAX;
|
||||
BoxFace localFace;
|
||||
glm::vec3 localSurfaceNormal;
|
||||
|
||||
|
@ -153,8 +152,6 @@ EntityItemID EntityTreeElement::findRayIntersection(const glm::vec3& origin, con
|
|||
return result;
|
||||
}
|
||||
|
||||
// if the distance to the element cube is not less than the current best distance, then it's not possible
|
||||
// for any details inside the cube to be closer so we don't need to consider them.
|
||||
QVariantMap localExtraInfo;
|
||||
float distanceToElementDetails = distance;
|
||||
EntityItemID entityID = findDetailedRayIntersection(origin, direction, element, distanceToElementDetails,
|
||||
|
@ -285,7 +282,6 @@ EntityItemID EntityTreeElement::findParabolaIntersection(const glm::vec3& origin
|
|||
QVariantMap& extraInfo, bool precisionPicking) {
|
||||
|
||||
EntityItemID result;
|
||||
float distanceToElementCube = std::numeric_limits<float>::max();
|
||||
BoxFace localFace;
|
||||
glm::vec3 localSurfaceNormal;
|
||||
|
||||
|
@ -293,8 +289,6 @@ EntityItemID EntityTreeElement::findParabolaIntersection(const glm::vec3& origin
|
|||
return result;
|
||||
}
|
||||
|
||||
// if the distance to the element cube is not less than the current best distance, then it's not possible
|
||||
// for any details inside the cube to be closer so we don't need to consider them.
|
||||
QVariantMap localExtraInfo;
|
||||
float distanceToElementDetails = parabolicDistance;
|
||||
// We can precompute the world-space parabola normal and reuse it for the parabola plane intersects AABox sphere check
|
||||
|
|
|
@ -37,7 +37,7 @@ template<typename T>
|
|||
class PickCacheOptimizer {
|
||||
|
||||
public:
|
||||
void update(std::unordered_map<uint32_t, std::shared_ptr<PickQuery>>& picks, uint32_t& nextToUpdate, uint64_t expiry, bool shouldPickHUD);
|
||||
QVector4D update(std::unordered_map<uint32_t, std::shared_ptr<PickQuery>>& picks, uint32_t& nextToUpdate, uint64_t expiry, bool shouldPickHUD);
|
||||
|
||||
protected:
|
||||
typedef std::unordered_map<T, std::unordered_map<PickCacheKey, PickResultPointer>> PickCache;
|
||||
|
@ -67,8 +67,9 @@ void PickCacheOptimizer<T>::cacheResult(const bool intersects, const PickResultP
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
void PickCacheOptimizer<T>::update(std::unordered_map<uint32_t, std::shared_ptr<PickQuery>>& picks,
|
||||
QVector4D PickCacheOptimizer<T>::update(std::unordered_map<uint32_t, std::shared_ptr<PickQuery>>& picks,
|
||||
uint32_t& nextToUpdate, uint64_t expiry, bool shouldPickHUD) {
|
||||
QVector4D numIntersectionsComputed;
|
||||
PickCache results;
|
||||
const uint32_t INVALID_PICK_ID = 0;
|
||||
auto itr = picks.begin();
|
||||
|
@ -91,6 +92,7 @@ void PickCacheOptimizer<T>::update(std::unordered_map<uint32_t, std::shared_ptr<
|
|||
PickCacheKey entityKey = { pick->getFilter().getEntityFlags(), pick->getIncludeItems(), pick->getIgnoreItems() };
|
||||
if (!checkAndCompareCachedResults(mathematicalPick, results, res, entityKey)) {
|
||||
PickResultPointer entityRes = pick->getEntityIntersection(mathematicalPick);
|
||||
numIntersectionsComputed[0]++;
|
||||
if (entityRes) {
|
||||
cacheResult(entityRes->doesIntersect(), entityRes, entityKey, res, mathematicalPick, results, pick);
|
||||
}
|
||||
|
@ -101,6 +103,7 @@ void PickCacheOptimizer<T>::update(std::unordered_map<uint32_t, std::shared_ptr<
|
|||
PickCacheKey overlayKey = { pick->getFilter().getOverlayFlags(), pick->getIncludeItems(), pick->getIgnoreItems() };
|
||||
if (!checkAndCompareCachedResults(mathematicalPick, results, res, overlayKey)) {
|
||||
PickResultPointer overlayRes = pick->getOverlayIntersection(mathematicalPick);
|
||||
numIntersectionsComputed[1]++;
|
||||
if (overlayRes) {
|
||||
cacheResult(overlayRes->doesIntersect(), overlayRes, overlayKey, res, mathematicalPick, results, pick);
|
||||
}
|
||||
|
@ -111,6 +114,7 @@ void PickCacheOptimizer<T>::update(std::unordered_map<uint32_t, std::shared_ptr<
|
|||
PickCacheKey avatarKey = { pick->getFilter().getAvatarFlags(), pick->getIncludeItems(), pick->getIgnoreItems() };
|
||||
if (!checkAndCompareCachedResults(mathematicalPick, results, res, avatarKey)) {
|
||||
PickResultPointer avatarRes = pick->getAvatarIntersection(mathematicalPick);
|
||||
numIntersectionsComputed[2]++;
|
||||
if (avatarRes) {
|
||||
cacheResult(avatarRes->doesIntersect(), avatarRes, avatarKey, res, mathematicalPick, results, pick);
|
||||
}
|
||||
|
@ -122,6 +126,7 @@ void PickCacheOptimizer<T>::update(std::unordered_map<uint32_t, std::shared_ptr<
|
|||
PickCacheKey hudKey = { pick->getFilter().getHUDFlags(), QVector<QUuid>(), QVector<QUuid>() };
|
||||
if (!checkAndCompareCachedResults(mathematicalPick, results, res, hudKey)) {
|
||||
PickResultPointer hudRes = pick->getHUDIntersection(mathematicalPick);
|
||||
numIntersectionsComputed[3]++;
|
||||
if (hudRes) {
|
||||
cacheResult(true, hudRes, hudKey, res, mathematicalPick, results, pick);
|
||||
}
|
||||
|
@ -145,6 +150,7 @@ void PickCacheOptimizer<T>::update(std::unordered_map<uint32_t, std::shared_ptr<
|
|||
break;
|
||||
}
|
||||
}
|
||||
return numIntersectionsComputed;
|
||||
}
|
||||
|
||||
#endif // hifi_PickCacheOptimizer_h
|
||||
|
|
|
@ -20,6 +20,7 @@ unsigned int PickManager::addPick(PickQuery::PickType type, const std::shared_pt
|
|||
id = _nextPickID++;
|
||||
_picks[type][id] = pick;
|
||||
_typeMap[id] = type;
|
||||
_totalPickCounts[type]++;
|
||||
}
|
||||
});
|
||||
return id;
|
||||
|
@ -41,6 +42,7 @@ void PickManager::removePick(unsigned int uid) {
|
|||
if (type != _typeMap.end()) {
|
||||
_picks[type->second].erase(uid);
|
||||
_typeMap.erase(uid);
|
||||
_totalPickCounts[type->second]--;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -96,12 +98,12 @@ void PickManager::update() {
|
|||
});
|
||||
|
||||
bool shouldPickHUD = _shouldPickHUDOperator();
|
||||
// we pass the same expiry to both updates, but the stylus updates are relatively cheap
|
||||
// and the rayPicks updae will ALWAYS update at least one ray even when there is no budget
|
||||
_stylusPickCacheOptimizer.update(cachedPicks[PickQuery::Stylus], _nextPickToUpdate[PickQuery::Stylus], expiry, false);
|
||||
_rayPickCacheOptimizer.update(cachedPicks[PickQuery::Ray], _nextPickToUpdate[PickQuery::Ray], expiry, shouldPickHUD);
|
||||
_parabolaPickCacheOptimizer.update(cachedPicks[PickQuery::Parabola], _nextPickToUpdate[PickQuery::Parabola], expiry, shouldPickHUD);
|
||||
_collisionPickCacheOptimizer.update(cachedPicks[PickQuery::Collision], _nextPickToUpdate[PickQuery::Collision], expiry, false);
|
||||
// FIXME: give each type its own expiry
|
||||
// Each type will update at least one pick, regardless of the expiry
|
||||
_updatedPickCounts[PickQuery::Stylus] = _stylusPickCacheOptimizer.update(cachedPicks[PickQuery::Stylus], _nextPickToUpdate[PickQuery::Stylus], expiry, false);
|
||||
_updatedPickCounts[PickQuery::Ray] = _rayPickCacheOptimizer.update(cachedPicks[PickQuery::Ray], _nextPickToUpdate[PickQuery::Ray], expiry, shouldPickHUD);
|
||||
_updatedPickCounts[PickQuery::Parabola] = _parabolaPickCacheOptimizer.update(cachedPicks[PickQuery::Parabola], _nextPickToUpdate[PickQuery::Parabola], expiry, shouldPickHUD);
|
||||
_updatedPickCounts[PickQuery::Collision] = _collisionPickCacheOptimizer.update(cachedPicks[PickQuery::Collision], _nextPickToUpdate[PickQuery::Collision], expiry, false);
|
||||
}
|
||||
|
||||
bool PickManager::isLeftHand(unsigned int uid) {
|
||||
|
|
|
@ -58,10 +58,16 @@ public:
|
|||
|
||||
bool getForceCoarsePicking() { return _forceCoarsePicking; }
|
||||
|
||||
const std::vector<QVector4D>& getUpdatedPickCounts() { return _updatedPickCounts; }
|
||||
const std::vector<int>& getTotalPickCounts() { return _totalPickCounts; }
|
||||
|
||||
public slots:
|
||||
void setForceCoarsePicking(bool forceCoarsePicking) { _forceCoarsePicking = forceCoarsePicking; }
|
||||
|
||||
protected:
|
||||
std::vector<QVector4D> _updatedPickCounts { PickQuery::NUM_PICK_TYPES };
|
||||
std::vector<int> _totalPickCounts { 0, 0, 0, 0 };
|
||||
|
||||
bool _forceCoarsePicking { false };
|
||||
std::function<bool()> _shouldPickHUDOperator;
|
||||
std::function<glm::vec2(const glm::vec3&)> _calculatePos2DFromHUDOperator;
|
||||
|
|
|
@ -385,9 +385,9 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g
|
|||
Triangle bestWorldTriangle;
|
||||
glm::vec3 bestWorldIntersectionPoint;
|
||||
glm::vec3 bestMeshIntersectionPoint;
|
||||
int bestPartIndex;
|
||||
int bestShapeID;
|
||||
int bestSubMeshIndex;
|
||||
int bestPartIndex = 0;
|
||||
int bestShapeID = 0;
|
||||
int bestSubMeshIndex = 0;
|
||||
|
||||
const FBXGeometry& geometry = getFBXGeometry();
|
||||
if (!_triangleSetsValid) {
|
||||
|
@ -527,9 +527,9 @@ bool Model::findParabolaIntersectionAgainstSubMeshes(const glm::vec3& origin, co
|
|||
Triangle bestWorldTriangle;
|
||||
glm::vec3 bestWorldIntersectionPoint;
|
||||
glm::vec3 bestMeshIntersectionPoint;
|
||||
int bestPartIndex;
|
||||
int bestShapeID;
|
||||
int bestSubMeshIndex;
|
||||
int bestPartIndex = 0;
|
||||
int bestShapeID = 0;
|
||||
int bestSubMeshIndex = 0;
|
||||
|
||||
const FBXGeometry& geometry = getFBXGeometry();
|
||||
if (!_triangleSetsValid) {
|
||||
|
|
Loading…
Reference in a new issue