SOme stuff workbetter

This commit is contained in:
Sam Gateau 2019-09-18 18:25:42 -07:00
parent 381fc5146f
commit a87db2636c
14 changed files with 195 additions and 102 deletions

View file

@ -148,6 +148,8 @@ void ResourceCacheSharedItems::clear() {
ScriptableResourceCache::ScriptableResourceCache(QSharedPointer<ResourceCache> resourceCache) {
_resourceCache = resourceCache;
connect(&(*_resourceCache), &ResourceCache::dirty,
this, &ScriptableResourceCache::dirty, Qt::DirectConnection);
}
QVariantList ScriptableResourceCache::getResourceList() {

View file

@ -200,12 +200,15 @@ class ResourceCache : public QObject {
Q_PROPERTY(size_t sizeTotal READ getSizeTotalResources NOTIFY dirty)
Q_PROPERTY(size_t sizeCached READ getSizeCachedResources NOTIFY dirty)
Q_PROPERTY(size_t numLoading READ getNumLoadingResources NOTIFY dirty)
public:
size_t getNumTotalResources() const { return _numTotalResources; }
size_t getSizeTotalResources() const { return _totalResourcesSize; }
size_t getNumCachedResources() const { return _numUnusedResources; }
size_t getSizeCachedResources() const { return _unusedResourcesSize; }
size_t getSizeCachedResources() const { return _unusedResourcesSize; }
Q_INVOKABLE QVariantList getResourceList();

View file

@ -63,4 +63,5 @@ void EngineStats::run(const RenderContextPointer& renderContext) {
config->frameSetPipelineCount = _gpuStats._PSNumSetPipelines;
config->frameSetInputFormatCount = _gpuStats._ISNumFormatChanges;
config->emitDirty();
}

View file

@ -24,42 +24,42 @@ namespace render {
class EngineStatsConfig : public Job::Config{
Q_OBJECT
Q_PROPERTY(quint32 bufferCPUCount MEMBER bufferCPUCount NOTIFY dirty)
Q_PROPERTY(quint32 bufferGPUCount MEMBER bufferGPUCount NOTIFY dirty)
Q_PROPERTY(qint64 bufferCPUMemSize MEMBER bufferCPUMemSize NOTIFY dirty)
Q_PROPERTY(qint64 bufferGPUMemSize MEMBER bufferGPUMemSize NOTIFY dirty)
Q_PROPERTY(quint32 bufferCPUCount MEMBER bufferCPUCount NOTIFY newStats)
Q_PROPERTY(quint32 bufferGPUCount MEMBER bufferGPUCount NOTIFY newStats)
Q_PROPERTY(qint64 bufferCPUMemSize MEMBER bufferCPUMemSize NOTIFY newStats)
Q_PROPERTY(qint64 bufferGPUMemSize MEMBER bufferGPUMemSize NOTIFY newStats)
Q_PROPERTY(quint32 textureCPUCount MEMBER textureCPUCount NOTIFY dirty)
Q_PROPERTY(quint32 textureGPUCount MEMBER textureGPUCount NOTIFY dirty)
Q_PROPERTY(quint32 textureResidentGPUCount MEMBER textureResidentGPUCount NOTIFY dirty)
Q_PROPERTY(quint32 textureFramebufferGPUCount MEMBER textureFramebufferGPUCount NOTIFY dirty)
Q_PROPERTY(quint32 textureResourceGPUCount MEMBER textureResourceGPUCount NOTIFY dirty)
Q_PROPERTY(quint32 textureExternalGPUCount MEMBER textureExternalGPUCount NOTIFY dirty)
Q_PROPERTY(quint32 textureCPUCount MEMBER textureCPUCount NOTIFY newStats)
Q_PROPERTY(quint32 textureGPUCount MEMBER textureGPUCount NOTIFY newStats)
Q_PROPERTY(quint32 textureResidentGPUCount MEMBER textureResidentGPUCount NOTIFY newStats)
Q_PROPERTY(quint32 textureFramebufferGPUCount MEMBER textureFramebufferGPUCount NOTIFY newStats)
Q_PROPERTY(quint32 textureResourceGPUCount MEMBER textureResourceGPUCount NOTIFY newStats)
Q_PROPERTY(quint32 textureExternalGPUCount MEMBER textureExternalGPUCount NOTIFY newStats)
Q_PROPERTY(qint64 textureCPUMemSize MEMBER textureCPUMemSize NOTIFY dirty)
Q_PROPERTY(qint64 textureGPUMemSize MEMBER textureGPUMemSize NOTIFY dirty)
Q_PROPERTY(qint64 textureResidentGPUMemSize MEMBER textureResidentGPUMemSize NOTIFY dirty)
Q_PROPERTY(qint64 textureFramebufferGPUMemSize MEMBER textureFramebufferGPUMemSize NOTIFY dirty)
Q_PROPERTY(qint64 textureResourceGPUMemSize MEMBER textureResourceGPUMemSize NOTIFY dirty)
Q_PROPERTY(qint64 textureExternalGPUMemSize MEMBER textureExternalGPUMemSize NOTIFY dirty)
Q_PROPERTY(qint64 textureCPUMemSize MEMBER textureCPUMemSize NOTIFY newStats)
Q_PROPERTY(qint64 textureGPUMemSize MEMBER textureGPUMemSize NOTIFY newStats)
Q_PROPERTY(qint64 textureResidentGPUMemSize MEMBER textureResidentGPUMemSize NOTIFY newStats)
Q_PROPERTY(qint64 textureFramebufferGPUMemSize MEMBER textureFramebufferGPUMemSize NOTIFY newStats)
Q_PROPERTY(qint64 textureResourceGPUMemSize MEMBER textureResourceGPUMemSize NOTIFY newStats)
Q_PROPERTY(qint64 textureExternalGPUMemSize MEMBER textureExternalGPUMemSize NOTIFY newStats)
Q_PROPERTY(quint32 texturePendingGPUTransferCount MEMBER texturePendingGPUTransferCount NOTIFY dirty)
Q_PROPERTY(qint64 texturePendingGPUTransferSize MEMBER texturePendingGPUTransferSize NOTIFY dirty)
Q_PROPERTY(qint64 textureResourcePopulatedGPUMemSize MEMBER textureResourcePopulatedGPUMemSize NOTIFY dirty)
Q_PROPERTY(quint32 texturePendingGPUTransferCount MEMBER texturePendingGPUTransferCount NOTIFY newStats)
Q_PROPERTY(qint64 texturePendingGPUTransferSize MEMBER texturePendingGPUTransferSize NOTIFY newStats)
Q_PROPERTY(qint64 textureResourcePopulatedGPUMemSize MEMBER textureResourcePopulatedGPUMemSize NOTIFY newStats)
Q_PROPERTY(quint32 frameAPIDrawcallCount MEMBER frameAPIDrawcallCount NOTIFY dirty)
Q_PROPERTY(quint32 frameDrawcallCount MEMBER frameDrawcallCount NOTIFY dirty)
Q_PROPERTY(quint32 frameDrawcallRate MEMBER frameDrawcallRate NOTIFY dirty)
Q_PROPERTY(quint32 frameAPIDrawcallCount MEMBER frameAPIDrawcallCount NOTIFY newStats)
Q_PROPERTY(quint32 frameDrawcallCount MEMBER frameDrawcallCount NOTIFY newStats)
Q_PROPERTY(quint32 frameDrawcallRate MEMBER frameDrawcallRate NOTIFY newStats)
Q_PROPERTY(quint32 frameTriangleCount MEMBER frameTriangleCount NOTIFY dirty)
Q_PROPERTY(quint32 frameTriangleRate MEMBER frameTriangleRate NOTIFY dirty)
Q_PROPERTY(quint32 frameTriangleCount MEMBER frameTriangleCount NOTIFY newStats)
Q_PROPERTY(quint32 frameTriangleRate MEMBER frameTriangleRate NOTIFY newStats)
Q_PROPERTY(quint32 frameTextureCount MEMBER frameTextureCount NOTIFY dirty)
Q_PROPERTY(quint32 frameTextureRate MEMBER frameTextureRate NOTIFY dirty)
Q_PROPERTY(quint64 frameTextureMemoryUsage MEMBER frameTextureMemoryUsage NOTIFY dirty)
Q_PROPERTY(quint32 frameTextureCount MEMBER frameTextureCount NOTIFY newStats)
Q_PROPERTY(quint32 frameTextureRate MEMBER frameTextureRate NOTIFY newStats)
Q_PROPERTY(quint64 frameTextureMemoryUsage MEMBER frameTextureMemoryUsage NOTIFY newStats)
Q_PROPERTY(quint32 frameSetPipelineCount MEMBER frameSetPipelineCount NOTIFY dirty)
Q_PROPERTY(quint32 frameSetInputFormatCount MEMBER frameSetInputFormatCount NOTIFY dirty)
Q_PROPERTY(quint32 frameSetPipelineCount MEMBER frameSetPipelineCount NOTIFY newStats)
Q_PROPERTY(quint32 frameSetInputFormatCount MEMBER frameSetInputFormatCount NOTIFY newStats)
public:
@ -104,10 +104,8 @@ namespace render {
void emitDirty() { emit dirty(); }
void emitDirty() { emit newStats(); }
signals:
void dirty();
};
class EngineStats {

View file

@ -49,7 +49,7 @@ function openView() {
pages.clear();
}
pages.addPage('Cash', 'Cash', "../cash.qml", 300, 420, openCashWindow, closeCashWindow);
pages.addPage('Cash', 'Cash', "../cash.qml", 300, 500, openCashWindow, closeCashWindow);
pages.addPage('openModelCacheInspector', 'Model Cache Inspector', "./ModelCacheInspector.qml", 300, 500);
pages.addPage('openMaterialCacheInspector', 'Material Cache Inspector', "./MaterialCacheInspector.qml", 300, 500);
pages.addPage('openTextureCacheInspector', 'Texture Cache Inspector', "./TextureCacheInspector.qml", 300, 500);

View file

@ -15,6 +15,7 @@ import controlsUit 1.0 as HifiControls
import "../lib/prop" as Prop
import "cash"
import "../lib/plotperf"
Rectangle {
anchors.fill: parent
@ -32,6 +33,58 @@ Rectangle {
Column {
id: column
width: parent.width
Prop.PropFolderPanel {
label: "Stats"
isUnfold: true
panelFrameData: Component { Column {
PlotPerf {
title: "Resources"
height: 200
valueScale: 1
valueUnit: ""
plots: [
{
object: TextureCache,
prop: "numTotal",
label: "Textures",
color: "#1AC567"
},
{
object: TextureCache,
prop: "numCached",
label: "Textures Cached",
color: "#FEC567"
},
{
object: ModelCache,
prop: "numTotal",
label: "Models",
color: "#FED959"
},
{
object: ModelCache,
prop: "numCached",
label: "Models Cached",
color: "#FEFE59"
},
{
object: MaterialCache,
prop: "numTotal",
label: "Materials",
color: "#00B4EF"
},
{
object: MaterialCache,
prop: "numCached",
label: "Materials Cached",
color: "#FFB4EF"
}
]
}
}}
}
Prop.PropFolderPanel {
label: "Cache Inspectors"
isUnfold: true

View file

@ -17,4 +17,5 @@ ResourceCacheInspector {
id: root;
anchors.fill: parent.fill
cache: AnimationCache
cacheResourceName: "Animation"
}

View file

@ -17,4 +17,5 @@ ResourceCacheInspector {
id: root;
anchors.fill: parent.fill
cache: MaterialCache
cacheResourceName: "Material"
}

View file

@ -17,4 +17,5 @@ ResourceCacheInspector {
id: root;
anchors.fill: parent.fill
cache: ModelCache
cacheResourceName: "Model"
}

View file

@ -17,41 +17,104 @@ Item {
id: root;
anchors.fill: parent.fill
property var cache: {}
property string cacheResourceName: ""
function fromScript(message) {
switch (message.method) {
case "setJSON":
// jsonText.items = message.params.items;
break;
case "setItemList":
//console.log(message.params.items)
resouceItemsModel.resetItemList(message.params.items)
break;
case "resetItemList":
resetItemList()
resetItemListFromCache()
break;
}
}
Component.onCompleted: {
// if (cache !== undefined) {
resetItemList();
// }
resetItemListFromCache();
}
function resetItemList() {
var theList = cache.getResourceList();
resouceItemsModel.resetItemList(theList)
function fetchItemsList() {
var theList;
if (cache !== undefined) {
theList = cache.getResourceList();
} else {
theList = [{"name": "ResourceCacheInspector.cache is undefined"}];
}
return theList;
}
function resetItemListFromCache() {
resourceItemsModel.resetItemList(fetchItemsList())
}
function updateItemListFromCache() {
resourceItemsModel.updateItemList(fetchItemsList())
}
Column {
id: header
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
/*Prop.PropButton {
anchors.left: parent.left
id: refresh
text: "Refresh"
onClicked: {
resetItemListFromCache()
}
}*/
Item {
anchors.left: parent.left
anchors.right: parent.right
Prop.PropScalar {
id: totalCount
anchors.left: parent.left
anchors.right: parent.horizontalCenter
label: "Count"
object: root.cache
property: "numTotal"
integral: true
readOnly: true
onSourceValueVarChanged: { console.log( root.cacheResourceName + " NumResource Value Changed!!!!") ;updateItemListFromCache() }
}
Prop.PropScalar {
id: cachedCount
anchors.left: parent.horizontalCenter
anchors.right: parent.right
label: "Cached"
object: root.cache
property: "numCached"
integral: true
readOnly: true
onSourceValueVarChanged: { console.log( root.cacheResourceName + " NumResource Value Changed!!!!") ;updateItemListFromCache() }
}
height: totalCount.height
}
}
ListModel {
id: resouceItemsModel
id: resourceItemsModel
function packItemEntry(item) {
var some_uri = Qt.resolvedUrl(item)
return { "name": item, "url": some_uri}
}
function resetItemList(itemList) {
resouceItemsModel.clear()
resourceItemsModel.clear()
for (var i in itemList) {
//resouceItemsModel.append({ "name": itemList[i]})
resouceItemsModel.append({ "name": itemList[i].toString()})
resourceItemsModel.append(packItemEntry(itemList[i]))
}
}
function updateItemList(itemList) {
resourceItemsModel.clear()
for (var i in itemList) {
resourceItemsModel.append(packItemEntry(itemList[i]))
}
}
}
@ -60,53 +123,22 @@ Item {
id: resouceItemDelegate
Row {
id: itemRow
Prop.PropLabel {
text: model.name
Prop.PropText {
text: model.index
width: 30
}
Prop.PropSplitter {
size:8
}
Prop.PropLabel {
text: JSON.stringify(model.url)
}
/* Prop.PropLabel {
text: model.url
}*/
}
}
Item {
id: header
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
Prop.PropButton {
anchors.left: parent.left
id: refresh
text: "Refresh"
onClicked: {
resetItemList()
}
}
Prop.PropScalar {
id: totalCount
anchors.right: parent.right
label: "Count"
sourceValueVar: resouceItemsModel.count
integral: true
readOnly: true
}
Prop.PropScalar {
id: totalCount
anchors.right: parent.right
label: "Count"
sourceValueVar: resouceItemsModel.count
integral: true
readOnly: true
}
height: refresh.height
}
ScrollView {
anchors.top: header.bottom
anchors.bottom: parent.bottom
@ -115,7 +147,7 @@ Item {
clip: true
ListView {
id: listView
model: resouceItemsModel
model: resourceItemsModel
delegate: resouceItemDelegate
}
}

View file

@ -17,4 +17,5 @@ ResourceCacheInspector {
id: root;
anchors.fill: parent.fill
cache: SoundCache
cacheResourceName: "Sound"
}

View file

@ -17,4 +17,5 @@ ResourceCacheInspector {
id: root;
anchors.fill: parent.fill
cache: TextureCache
cacheResourceName: "Texture"
}

View file

@ -24,11 +24,11 @@ Item {
// By default, these just go get or set the value from the object[property]
//
function defaultGet() { var v = root.object[root.property]; return v; }
// function defaultGet() { return root.object[root.property]; }
function defaultSet(value) { root.object[root.property] = value; }
// function defaultSetReadOnly(value) { log ( "read only " + property + ", NOT setting to " + value); }
// function defaultSetReadOnly(value) {}
// property var valueVarSetter: (root.readOnly ? defaultSetReadOnly : defaultSet)
property var valueVarSetter: defaultSet
function defaultSetReadOnly(value) {}
property var valueVarSetter: (readOnly ? defaultSetReadOnly : defaultSet)
property var valueVarGetter: defaultGet
// PropItem is stretching horizontally accross its parent

View file

@ -32,9 +32,7 @@ PropItem {
property var sourceValueVar: root.valueVarGetter()
function applyValueVarFromWidgets(value) {
if (!root.readOnly) {
root.valueVarSetter(value)
}
root.valueVarSetter(value)
}
PropLabel {
@ -58,6 +56,7 @@ PropItem {
MouseArea{
id: mousearea
enabled: !root.readOnly
anchors.fill: parent
onDoubleClicked: { sliderControl.visible = !sliderControl.visible }
}