From 7ec5941b0e2b826d480320f82512b6ad246830bd Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Wed, 10 Feb 2021 15:48:25 -0500 Subject: [PATCH] Add qml profile notes --- assets/qml/Widgets/BarDelegate.qml | 5 +++++ assets/qml/Widgets/GraphDelegate.qml | 3 +++ assets/qml/Widgets/GroupDelegate.qml | 6 ++++++ assets/qml/Widgets/LED.qml | 1 + assets/qml/Widgets/MapDelegate.qml | 2 ++ assets/qml/Windows/Console.qml | 2 ++ assets/qml/Windows/DataGrid.qml | 4 +++- assets/qml/Windows/Widgets.qml | 2 ++ src/CSV/Export.cpp | 3 +-- 9 files changed, 25 insertions(+), 3 deletions(-) diff --git a/assets/qml/Widgets/BarDelegate.qml b/assets/qml/Widgets/BarDelegate.qml index 01d7ad0b..42797a38 100644 --- a/assets/qml/Widgets/BarDelegate.qml +++ b/assets/qml/Widgets/BarDelegate.qml @@ -89,6 +89,9 @@ Window { // Connections { target: Cpp_UI_WidgetProvider + + //*! Optimize this function + // About 6% of the UI thread is spent here function onDataChanged() { root.updateValues() } @@ -97,6 +100,8 @@ Window { // // Updates the internal values of the bar widget // + //*! Optimize this function + // About 6% of the UI thread is spent here function updateValues() { if (Cpp_UI_WidgetProvider.barDatasetCount() > root.datasetIndex) { root.minimumValue = Cpp_UI_WidgetProvider.barMin(root.datasetIndex) diff --git a/assets/qml/Widgets/GraphDelegate.qml b/assets/qml/Widgets/GraphDelegate.qml index 6d4c40ff..ff5d444b 100644 --- a/assets/qml/Widgets/GraphDelegate.qml +++ b/assets/qml/Widgets/GraphDelegate.qml @@ -41,6 +41,9 @@ Window { Connections { target: Cpp_UI_GraphProvider + + //*! Optimize this function + // About 5% of the UI thread is spent here function onDataUpdated() { // Cancel if window is not enabled if (!root.enabled) diff --git a/assets/qml/Widgets/GroupDelegate.qml b/assets/qml/Widgets/GroupDelegate.qml index 5ccf4c19..3c736927 100644 --- a/assets/qml/Widgets/GroupDelegate.qml +++ b/assets/qml/Widgets/GroupDelegate.qml @@ -42,6 +42,9 @@ Window { Connections { target: Cpp_UI_Provider + + //*! Optimize this function + // About 14% of the UI thread time is spent here function onUpdated() { if (root.enabled) { var g = Cpp_UI_Provider.getGroup(groupId) @@ -73,6 +76,9 @@ Window { model: group !== null ? group.datasetCount : 0 delegate: DataDelegate { Layout.fillWidth: true + + //*! Optimize this function + // About 11% of UI thread time is spent here dataset: group.datasets[index] } } diff --git a/assets/qml/Widgets/LED.qml b/assets/qml/Widgets/LED.qml index 21b24da0..10a1c438 100644 --- a/assets/qml/Widgets/LED.qml +++ b/assets/qml/Widgets/LED.qml @@ -40,6 +40,7 @@ RowLayout { property alias flashDuration: _timer.interval // + //*! Optimize this function // Turns on the LED for a short period of time // function flash() { diff --git a/assets/qml/Widgets/MapDelegate.qml b/assets/qml/Widgets/MapDelegate.qml index 0c42cede..c7866c70 100644 --- a/assets/qml/Widgets/MapDelegate.qml +++ b/assets/qml/Widgets/MapDelegate.qml @@ -70,6 +70,8 @@ Window { // Connections { target: Cpp_UI_WidgetProvider + + //*! Optimize this function function onDataChanged() { root.updateValues() } diff --git a/assets/qml/Windows/Console.qml b/assets/qml/Windows/Console.qml index 95b6dc3a..3fa25216 100644 --- a/assets/qml/Windows/Console.qml +++ b/assets/qml/Windows/Console.qml @@ -170,6 +170,8 @@ Control { Connections { target: Cpp_IO_Console + //*! Optimize these functions + //*! Over 50% of the UI thread time is lost here function onLineReceived(text) { textEdit.append(text) } diff --git a/assets/qml/Windows/DataGrid.qml b/assets/qml/Windows/DataGrid.qml index 7d09cd35..ff251ae7 100644 --- a/assets/qml/Windows/DataGrid.qml +++ b/assets/qml/Windows/DataGrid.qml @@ -50,6 +50,8 @@ Control { // Connections { target: Cpp_UI_Provider + + //*! Optimize this function function onUpdated() { root.title = Cpp_UI_Provider.title if (groupGenerator.model !== Cpp_UI_Provider.groupCount) { @@ -592,7 +594,7 @@ Control { font.family: app.monoFont color: palette.brightText visible: !Cpp_CSV_Player.isOpen - text: Cpp_IO_Manager.receivedDataLength + text: Cpp_IO_Manager.receivedDataLength //*! Optimize this function anchors { right: parent.right diff --git a/assets/qml/Windows/Widgets.qml b/assets/qml/Windows/Widgets.qml index c1c90e34..0df3b000 100644 --- a/assets/qml/Windows/Widgets.qml +++ b/assets/qml/Windows/Widgets.qml @@ -44,6 +44,8 @@ Control { // Connections { target: Cpp_UI_WidgetProvider + + //*! Optimize this function function onDataChanged() { // Generate accelerometer widgets if (accGenerator.model !== Cpp_UI_WidgetProvider.accelerometerGroupCount()) { diff --git a/src/CSV/Export.cpp b/src/CSV/Export.cpp index 88e0c101..e3318717 100644 --- a/src/CSV/Export.cpp +++ b/src/CSV/Export.cpp @@ -146,8 +146,7 @@ void Export::closeFile() /** * Creates a CSV file based on the JSON frames contained in the JSON list. - * @note This function is called periodically every 1 second. It shall write - * at maximum 10 rows to avoid blocking the rest of the program. + * @note This function is called periodically every 1 second. */ void Export::writeValues() {