summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Weimer <bernd.weimer@pelagicore.com>2018-02-19 11:55:15 +0100
committerDominik Holland <dominik.holland@pelagicore.com>2018-02-20 09:09:50 +0000
commitca784dce93e58b02833b250cfa847489e173bca6 (patch)
treeae39fb67a35f6586a1c227a999980536e1cd1e04
parent06f3adf84ee4fc2287def8ca1c6b4036409f5c86 (diff)
Change memory consumption in monitor example
In the monitor example the application simulates an increasing memory consumption, rather based on a bug in the JavaScript engine, which lead to other side effects. The new version should be more reliable. Also provided some hints for single-process mode and when no app windows are available. Task-number: QTAUTO-786 Change-Id: I5a055d775d5705487dc6fcdc1a81889f7dd14e07 Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r--examples/monitor/apps/tld.monitor.app/app.qml9
-rw-r--r--examples/monitor/system-ui/main.qml34
2 files changed, 29 insertions, 14 deletions
diff --git a/examples/monitor/apps/tld.monitor.app/app.qml b/examples/monitor/apps/tld.monitor.app/app.qml
index 0318e34f..e8c57e0a 100644
--- a/examples/monitor/apps/tld.monitor.app/app.qml
+++ b/examples/monitor/apps/tld.monitor.app/app.qml
@@ -69,12 +69,11 @@ ApplicationWindow {
running: true
repeat: true
onTriggered: {
- if (count < 500) {
+ if (count < 100) {
var arr = [];
- var busy = Math.random() * 5000;
- while (busy > 0)
- arr[busy] = busy--;
- interval = 20 + Math.random() * 80;
+ var idx = 200000;
+ while (idx > 0)
+ arr[idx] = idx--;
count++;
} else {
repeat = false;
diff --git a/examples/monitor/system-ui/main.qml b/examples/monitor/system-ui/main.qml
index 2d7e6e8e..a3ddb658 100644
--- a/examples/monitor/system-ui/main.qml
+++ b/examples/monitor/system-ui/main.qml
@@ -60,7 +60,6 @@ Window {
property var primaryWindow
property var secondaryWindow
- property var monitoredAppWindow
width: 720
height: 600
@@ -122,14 +121,29 @@ Window {
spacing: 20
MonitorText {
- text: "Process: " + (processMon.applicationId === "" ? "System-UI" : processMon.applicationId)
+ text: processMon.applicationId === "" ? "System-UI" : processMon.applicationId
font.pixelSize: 26
}
MonitorText { text: "Process ID: " + processMon.processId }
Switch {
- onToggle: processMon.applicationId = processMon.applicationId === ""
+ onToggle: {
+ processMon.applicationId = processMon.applicationId === ""
? ApplicationManager.application(0).id : ""
+ if (processMon.applicationId !== "") {
+ if (ApplicationManager.singleProcess)
+ console.warn("There is no dedicated application process in single-process mode");
+
+ if (primaryWindow && secondaryWindow) {
+ processMon.monitoredWindows = primary.active ? [primaryWindow] : [secondaryWindow]
+ } else {
+ processMon.monitoredWindows = []
+ console.warn("No application window available. Please check your QtWayland configuration.");
+ }
+ } else {
+ processMon.monitoredWindows = [root]
+ }
+ }
}
}
}
@@ -147,7 +161,7 @@ Window {
id: primary
active: true
onActivated: {
- root.monitoredAppWindow = [primaryWindow];
+ processMon.monitoredWindows = [primaryWindow];
secondary.active = false;
}
}
@@ -155,7 +169,7 @@ Window {
WindowContainer {
id: secondary
onActivated: {
- root.monitoredAppWindow = [secondaryWindow];
+ processMon.monitoredWindows = [secondaryWindow];
primary.active = false;
}
}
@@ -201,7 +215,6 @@ Window {
primaryWindow = window
window.parent = primary.container
window.anchors.fill = primary.container
- root.monitoredAppWindow = [primaryWindow];
} else {
secondaryWindow = window
window.parent = secondary.container
@@ -210,7 +223,7 @@ Window {
}
onWindowLost: {
- root.monitoredAppWindow = []
+ processMon.monitoredWindows = []
WindowManager.releaseWindow(window);
}
}
@@ -223,10 +236,13 @@ Window {
memoryReportingEnabled: true
frameRateReportingEnabled: true
- monitoredWindows: (applicationId === "" || ApplicationManager.singleProcess) ? [ root ] : root.monitoredAppWindow
+ monitoredWindows: [root]
onMemoryReportingChanged: processPss.reading = (memoryPss.total / 1e6).toFixed(0) + " MB";
- onFrameRateReportingChanged: frameChart.reading = frameRate[0].average.toFixed(0) + " fps";
+ onFrameRateReportingChanged: {
+ if (frameRate[0])
+ frameChart.reading = frameRate[0].average.toFixed(0) + " fps";
+ }
}
Connections {