blob: fb72750d21b7691acdcb71ee2be88d7a969fe676 (
plain)
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
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Controls
Item {
id: base
width: 800
height: 600
property list<string> graphsTests: ["GraphsLineTest.qml", "GraphsAreaTest.qml", "GraphsBarTest.qml"]
property list<string> chartsTests: ["ChartsLineTest.qml", "ChartsAreaTest.qml", "ChartsBarTest.qml", "ChartsOpenGLLineTest.qml"]
property list<string> tests: []
property int testIndex: 0
property int fps: 0
property var results: ({})
property string resultType: ""
Component.onCompleted: {
if (resultsIO.useCharts())
tests = chartsTests;
else
tests = graphsTests;
for (var i = 0; i < tests.length; i++) {
results[tests[i]] = {};
results[tests[i]].fps = [];
results[tests[i]].counts = [];
}
}
Column {
anchors.horizontalCenter: base.horizontalCenter
spacing: 2
Button {
text: "Run Benchmark"
onClicked: {
timer.running = true;
loader.source = base.tests[base.testIndex];
}
}
Button {
text: "Show Results"
onClicked: {
base.resultType = ""
loader.source = "Results.qml"
}
}
Button {
text: "Show Line Results"
onClicked: {
base.resultType = "Line"
loader.source = "Results.qml"
}
}
Button {
text: "Show Area Results"
onClicked: {
base.resultType = "Area"
loader.source = "Results.qml"
}
}
Button {
text: "Show Bar Results"
onClicked: {
base.resultType = "Bar"
loader.source = "Results.qml"
}
}
}
Loader {
id: loader
anchors.fill: parent
}
Connections {
target: loader.item
function onMeasure(count) {
var test = base.tests[base.testIndex];
base.results[test].fps.push(base.fps);
base.results[test].counts.push(count);
}
}
/*Text {
text: parent.fps
font.family: "Helvetica"
font.pointSize: 24
color: "red"
}*/
Timer {
id: timer
interval: 32000; running: false; repeat: true
onTriggered: {
parent.testIndex++;
if (parent.testIndex < parent.tests.length) {
loader.source = parent.tests[parent.testIndex];
} else {
running = false;
resultsIO.saveResults(JSON.stringify(base.results));
loader.source = "Results.qml";
}
}
}
}
|