/usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/PerformanceMetrics/PerformanceOverlay.qml is in qml-module-ubuntu-performancemetrics-gles 1.3.1918+16.04.20160404-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | /*
* Copyright 2014 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import Ubuntu.PerformanceMetrics 1.0 as PerformanceMetrics
/*!
\qmltype PerformanceOverlay
\inqmlmodule Ubuntu.PerformanceMetrics 0.1
\ingroup ubuntu-performance-metrics
\brief Overlay displaying performance related metrics (rendering time, CPU usage, etc.)
PerformanceOverlay displays various performance related indicators to help
developers detect issues in their application.
Examples:
\qml
PerformanceOverlay {
active: true
}
\endqml
*/
Item {
id: overlay
anchors.fill: parent
Component {
id: overlayContent
Item {
MouseArea {
anchors.fill: content
drag.target: content
onClicked: overlay.active = false
}
Item {
id: content
x: parent.width - width - units.gu(2)
y: units.gu(10)
width: units.gu(38)
height: childrenRect.height
PerformanceMetrics.RenderingTimes {
id: renderingTimes
period: 2000
samples: renderingTimeGraph.width
timerType: PerformanceMetrics.RenderingTimes.Trivial
}
PerformanceMetrics.CpuUsage {
id: cpuUsage
period: 5000
samplingInterval: 200
}
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: units.gu(1)
BarGraph {
id: renderingTimeGraph
anchors.left: parent.left
anchors.right: parent.right
model: renderingTimes.graphModel
maximumValue: 20
threshold: 16
labels: [{"color": "darkorange", "value": 10, "label": "10 ms"},
{"color": "red", "value": 16, "label": "16 ms"}]
labelFormat: "%1 ms"
}
BarGraph {
id: cpuUsageGraph
anchors.left: parent.left
anchors.right: parent.right
model: cpuUsage.graphModel
maximumValue: 100
threshold: 75
labels: [{"color": "green", "value": 25, "label": "25%"},
{"color": "darkorange", "value": 50, "label": "50%"},
{"color": "red", "value": 75, "label": "75%"}]
labelFormat: "%1 %"
}
}
}
}
}
/*!
Whether or not the PerformanceOverlay is displayed.
*/
property bool active: true
MouseArea {
property var timeLastPress
property int delayBetweenPresses: 500
property int pressCount: 0
property int pressCountToActivate: 4
anchors.fill: parent
enabled: performanceOverlayEnabled
onPressed: {
mouse.accepted = false;
var timePress = new Date().getTime();
if (timeLastPress && timePress - timeLastPress > delayBetweenPresses) {
pressCount = 0;
}
pressCount += 1;
if (pressCount >= pressCountToActivate) {
overlay.active = true;
pressCount = 0;
}
timeLastPress = timePress;
}
}
Loader {
id: loader
anchors.fill: parent
active: overlay.active
asynchronous: true
sourceComponent: overlayContent
}
}
|