From b0185dc355590eb578004b4f6c7e47eedf07dfad Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Fri, 1 Apr 2016 19:52:08 -0700 Subject: [PATCH] Add cacheStats.js --- examples/utilities/cache/cacheStats.js | 21 +++++++ examples/utilities/cache/stats.qml | 77 ++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 examples/utilities/cache/cacheStats.js create mode 100644 examples/utilities/cache/stats.qml diff --git a/examples/utilities/cache/cacheStats.js b/examples/utilities/cache/cacheStats.js new file mode 100644 index 0000000000..e58a5d0e21 --- /dev/null +++ b/examples/utilities/cache/cacheStats.js @@ -0,0 +1,21 @@ +// +// cacheStats.js +// examples/utilities/cache +// +// Zach Pomerantz, created on 4/1/2016. +// Copyright 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 +// + +// Set up the qml ui +var qml = Script.resolvePath('stats.qml'); +var window = new OverlayWindow({ + title: 'Cache Stats', + source: qml, + width: 300, + height: 200 +}); +window.setPosition(500, 50); +window.closed.connect(function() { Script.stop(); }); diff --git a/examples/utilities/cache/stats.qml b/examples/utilities/cache/stats.qml new file mode 100644 index 0000000000..d7888eb1aa --- /dev/null +++ b/examples/utilities/cache/stats.qml @@ -0,0 +1,77 @@ +// +// stats.qml +// examples/utilities/cache +// +// Created by Zach Pomerantz on 4/1/2016 +// Copyright 2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import "../lib/plotperf" + +Item { + id: root + anchors.fill: parent + + property var caches: [["Animation", AnimationCache], ["Model", ModelCache], ["Texture", TextureCache], ["Sound", SoundCache]] + + Grid { + id: grid + rows: root.caches.length; columns: 1; spacing: 8 + anchors.fill: parent + + Repeater { + id: repeater + + model: root.caches + + Row { + PlotPerf { + title: modelData[0] + " Count" + anchors.left: parent + height: (grid.height - (grid.spacing * (root.caches.length + 1))) / root.caches.length + width: grid.width / 2 - grid.spacing * 1.5 + object: modelData[1] + valueNumDigits: "1" + plots: [ + { + prop: "numTotal", + label: "total", + color: "#00B4EF" + }, + { + prop: "numCached", + label: "cached", + color: "#1AC567" + } + ] + } + PlotPerf { + title: modelData[0] + " Size" + anchors.right: parent + height: (grid.height - (grid.spacing * (root.caches.length + 1))) / root.caches.length + width: grid.width / 2 - grid.spacing * 1.5 + object: modelData[1] + valueScale: 1048576 + valueUnit: "Mb" + valueNumDigits: "1" + plots: [ + { + prop: "sizeTotal", + label: "total", + color: "#00B4EF" + }, + { + prop: "sizeCached", + label: "cached", + color: "#1AC567" + } + ] + } + } + } + } +}