Merge lp:~aacid/ubuntu-ui-toolkit/performance_monitor_env_vars into lp:ubuntu-ui-toolkit/staging

Proposed by Albert Astals Cid
Status: Merged
Approved by: Zsombor Egri
Approved revision: no longer in the source branch.
Merged at revision: 1999
Proposed branch: lp:~aacid/ubuntu-ui-toolkit/performance_monitor_env_vars
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 43 lines (+22/-4)
1 file modified
src/Ubuntu/Components/plugin/ucperformancemonitor.cpp (+22/-4)
To merge this branch: bzr merge lp:~aacid/ubuntu-ui-toolkit/performance_monitor_env_vars
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Gerry Boland (community) Approve
Review via email: mp+296990@code.launchpad.net

Commit message

Add envvars to change the performance monitor variables

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

LGTM

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
1999. By Albert Astals Cid

Add envvars to change the performance monitor variables.

Approved by ubuntu-sdk-build-bot, Gerry Boland.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/plugin/ucperformancemonitor.cpp'
2--- src/Ubuntu/Components/plugin/ucperformancemonitor.cpp 2016-03-15 13:46:27 +0000
3+++ src/Ubuntu/Components/plugin/ucperformancemonitor.cpp 2016-06-09 19:32:20 +0000
4@@ -21,10 +21,23 @@
5
6 Q_LOGGING_CATEGORY(ucPerformance, "[PERFORMANCE]")
7
8-const int singleFrameThreshold = 32;
9-const int multipleFrameThreshold = 17;
10-const int framesCountThreshold = 10;
11-const int warningCountThreshold = 30;
12+static int singleFrameThreshold = 32;
13+static int multipleFrameThreshold = 17;
14+static int framesCountThreshold = 10;
15+static int warningCountThreshold = 30;
16+
17+// TODO Qt 5.5. switch to qEnvironmentVariableIntValue
18+static int getenvInt(const char* name, int defaultValue)
19+{
20+ if (qEnvironmentVariableIsSet(name)) {
21+ QByteArray stringValue = qgetenv(name);
22+ bool ok;
23+ int value = stringValue.toFloat(&ok);
24+ return ok ? value : defaultValue;
25+ } else {
26+ return defaultValue;
27+ }
28+}
29
30 UCPerformanceMonitor::UCPerformanceMonitor(QObject* parent) :
31 QObject(parent),
32@@ -34,6 +47,11 @@
33 {
34 QObject::connect((QGuiApplication*)QGuiApplication::instance(), &QGuiApplication::applicationStateChanged,
35 this, &UCPerformanceMonitor::onApplicationStateChanged);
36+
37+ singleFrameThreshold = getenvInt("PERFORMANCE_MONITOR_SINGLE_FRAME_THRESHOLD", singleFrameThreshold);
38+ multipleFrameThreshold = getenvInt("PERFORMANCE_MONITOR_MULTIPLE_FRAME_THRESHOLD", multipleFrameThreshold);
39+ framesCountThreshold = getenvInt("PERFORMANCE_MONITOR_FRAMES_COUNT_THRESHOLD", framesCountThreshold);
40+ warningCountThreshold = getenvInt("PERFORMANCE_MONITOR_WARNING_COUNT_THRESHOLD", warningCountThreshold);
41 }
42
43 UCPerformanceMonitor::~UCPerformanceMonitor()

Subscribers

People subscribed via source and target branches