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
=== modified file 'src/Ubuntu/Components/plugin/ucperformancemonitor.cpp'
--- src/Ubuntu/Components/plugin/ucperformancemonitor.cpp 2016-03-15 13:46:27 +0000
+++ src/Ubuntu/Components/plugin/ucperformancemonitor.cpp 2016-06-09 19:32:20 +0000
@@ -21,10 +21,23 @@
2121
22Q_LOGGING_CATEGORY(ucPerformance, "[PERFORMANCE]")22Q_LOGGING_CATEGORY(ucPerformance, "[PERFORMANCE]")
2323
24const int singleFrameThreshold = 32;24static int singleFrameThreshold = 32;
25const int multipleFrameThreshold = 17;25static int multipleFrameThreshold = 17;
26const int framesCountThreshold = 10;26static int framesCountThreshold = 10;
27const int warningCountThreshold = 30;27static int warningCountThreshold = 30;
28
29// TODO Qt 5.5. switch to qEnvironmentVariableIntValue
30static int getenvInt(const char* name, int defaultValue)
31{
32 if (qEnvironmentVariableIsSet(name)) {
33 QByteArray stringValue = qgetenv(name);
34 bool ok;
35 int value = stringValue.toFloat(&ok);
36 return ok ? value : defaultValue;
37 } else {
38 return defaultValue;
39 }
40}
2841
29UCPerformanceMonitor::UCPerformanceMonitor(QObject* parent) :42UCPerformanceMonitor::UCPerformanceMonitor(QObject* parent) :
30 QObject(parent),43 QObject(parent),
@@ -34,6 +47,11 @@
34{47{
35 QObject::connect((QGuiApplication*)QGuiApplication::instance(), &QGuiApplication::applicationStateChanged,48 QObject::connect((QGuiApplication*)QGuiApplication::instance(), &QGuiApplication::applicationStateChanged,
36 this, &UCPerformanceMonitor::onApplicationStateChanged);49 this, &UCPerformanceMonitor::onApplicationStateChanged);
50
51 singleFrameThreshold = getenvInt("PERFORMANCE_MONITOR_SINGLE_FRAME_THRESHOLD", singleFrameThreshold);
52 multipleFrameThreshold = getenvInt("PERFORMANCE_MONITOR_MULTIPLE_FRAME_THRESHOLD", multipleFrameThreshold);
53 framesCountThreshold = getenvInt("PERFORMANCE_MONITOR_FRAMES_COUNT_THRESHOLD", framesCountThreshold);
54 warningCountThreshold = getenvInt("PERFORMANCE_MONITOR_WARNING_COUNT_THRESHOLD", warningCountThreshold);
37}55}
3856
39UCPerformanceMonitor::~UCPerformanceMonitor()57UCPerformanceMonitor::~UCPerformanceMonitor()

Subscribers

People subscribed via source and target branches