[MediaWiki-commits] [Gerrit] performance/WebPageTest[master]: Verify that CPU timings exists before they are used

2016-10-12 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Verify that CPU timings exists before they are used
..


Verify that CPU timings exists before they are used

WebPageTest has changed the API or something is failing in WPT
because we don't get CPUTimesDoc anymore (CPU timings til
document complete). Verify that they exist before we use them
and report a bug for WPT.

Bug: T148002
Change-Id: I2b2dc17e0d0ad995bd74b7e1e3e80a6ce725ff5c
---
M lib/collectMetrics.js
1 file changed, 14 insertions(+), 10 deletions(-)

Approvals:
  Phedenskog: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/collectMetrics.js b/lib/collectMetrics.js
index bf9ed42..2a46d72 100644
--- a/lib/collectMetrics.js
+++ b/lib/collectMetrics.js
@@ -61,16 +61,20 @@
 
 // you need to turn on timeline collecting and use Chrome for 
this to work
 if (argv.timeline) {
-var cpuTimes = 
cpuTime.sum(wptJson.data.median[view].cpuTimes);
-Object.keys(cpuTimes).forEach(function(time) {
-metricsToSend.cpuTimes[keyStart + 'cpuTimes.' + time] =
-cpuTimes[time];
-});
-var cpuTimesDoc = 
cpuTime.sum(wptJson.data.median[view].cpuTimesDoc);
-Object.keys(cpuTimesDoc).forEach(function(cpuTimeDoc) {
-metricsToSend.cpuTimes[keyStart + 'cpuTimesDoc.' + 
cpuTimeDoc] =
-cpuTimesDoc[cpuTimeDoc];
-});
+if (wptJson.data.median[view].cpuTimes) {
+var cpuTimes = 
cpuTime.sum(wptJson.data.median[view].cpuTimes);
+Object.keys(cpuTimes).forEach(function(time) {
+metricsToSend.cpuTimes[keyStart + 'cpuTimes.' + 
time] =
+cpuTimes[time];
+});
+}
+if (wptJson.data.median[view].cpuTimesDoc) {
+var cpuTimesDoc = 
cpuTime.sum(wptJson.data.median[view].cpuTimesDoc);
+Object.keys(cpuTimesDoc).forEach(function(cpuTimeDoc) {
+metricsToSend.cpuTimes[keyStart + 'cpuTimesDoc.' + 
cpuTimeDoc] =
+cpuTimesDoc[cpuTimeDoc];
+});
+}
 }
 
 if (wptJson.data.median[view].userTimes) {

-- 
To view, visit https://gerrit.wikimedia.org/r/315622
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2b2dc17e0d0ad995bd74b7e1e3e80a6ce725ff5c
Gerrit-PatchSet: 1
Gerrit-Project: performance/WebPageTest
Gerrit-Branch: master
Gerrit-Owner: Phedenskog 
Gerrit-Reviewer: Phedenskog 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] performance/WebPageTest[master]: Verify that CPU timings exists before they are used

2016-10-12 Thread Phedenskog (Code Review)
Phedenskog has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315622

Change subject: Verify that CPU timings exists before they are used
..

Verify that CPU timings exists before they are used

WebPageTest has changed the API or something is failing in WPT
because we don't get CPUTimesDoc anymore (CPU timings til
document complete). Verify that they exist before we use them
and report a bug for WPT.

Bug: T148002
Change-Id: I2b2dc17e0d0ad995bd74b7e1e3e80a6ce725ff5c
---
M lib/collectMetrics.js
1 file changed, 14 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/performance/WebPageTest 
refs/changes/22/315622/1

diff --git a/lib/collectMetrics.js b/lib/collectMetrics.js
index bf9ed42..2a46d72 100644
--- a/lib/collectMetrics.js
+++ b/lib/collectMetrics.js
@@ -61,16 +61,20 @@
 
 // you need to turn on timeline collecting and use Chrome for 
this to work
 if (argv.timeline) {
-var cpuTimes = 
cpuTime.sum(wptJson.data.median[view].cpuTimes);
-Object.keys(cpuTimes).forEach(function(time) {
-metricsToSend.cpuTimes[keyStart + 'cpuTimes.' + time] =
-cpuTimes[time];
-});
-var cpuTimesDoc = 
cpuTime.sum(wptJson.data.median[view].cpuTimesDoc);
-Object.keys(cpuTimesDoc).forEach(function(cpuTimeDoc) {
-metricsToSend.cpuTimes[keyStart + 'cpuTimesDoc.' + 
cpuTimeDoc] =
-cpuTimesDoc[cpuTimeDoc];
-});
+if (wptJson.data.median[view].cpuTimes) {
+var cpuTimes = 
cpuTime.sum(wptJson.data.median[view].cpuTimes);
+Object.keys(cpuTimes).forEach(function(time) {
+metricsToSend.cpuTimes[keyStart + 'cpuTimes.' + 
time] =
+cpuTimes[time];
+});
+}
+if (wptJson.data.median[view].cpuTimesDoc) {
+var cpuTimesDoc = 
cpuTime.sum(wptJson.data.median[view].cpuTimesDoc);
+Object.keys(cpuTimesDoc).forEach(function(cpuTimeDoc) {
+metricsToSend.cpuTimes[keyStart + 'cpuTimesDoc.' + 
cpuTimeDoc] =
+cpuTimesDoc[cpuTimeDoc];
+});
+}
 }
 
 if (wptJson.data.median[view].userTimes) {

-- 
To view, visit https://gerrit.wikimedia.org/r/315622
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b2dc17e0d0ad995bd74b7e1e3e80a6ce725ff5c
Gerrit-PatchSet: 1
Gerrit-Project: performance/WebPageTest
Gerrit-Branch: master
Gerrit-Owner: Phedenskog 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits