Skip to content
This repository has been archived by the owner on Jul 12, 2018. It is now read-only.

Don't add negative values to the start times since they break things (fi... #50

Merged
1 commit merged into from Apr 4, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 19 additions & 11 deletions js/data.js
Expand Up @@ -233,7 +233,7 @@ getAllStartupTimes = function(median) {
startupTimeMedian = 0;

for(paintTime in paintTimes) {
if(paintTimes.hasOwnProperty(paintTime)) {
if(paintTimes.hasOwnProperty(paintTime) && paintTimes[paintTime]>0) {
startupTimesTotal = startupTimesTotal + paintTimes[paintTime];
}
}
Expand All @@ -243,24 +243,30 @@ getAllStartupTimes = function(median) {
} else {
// This day only has one session, convert to seconds, no need to calculate
// a median.
graphData.startupTimes.push([new Date(currentDay).getTime(), paintTimes[paintTime] / 1000]);
if (paintTimes[paintTime]>0) {
graphData.startupTimes.push([new Date(currentDay).getTime(), paintTimes[paintTime] / 1000]);
}
}
} else {
for(paintTime in paintTimes) {
graphData.startupTimes.push([new Date(currentDay).getTime(), paintTimes[paintTime] / 1000]);
if (paintTimes[paintTime]>0) {
graphData.startupTimes.push([new Date(currentDay).getTime(), paintTimes[paintTime] / 1000]);
}
}
}
}
}
}
var latest = new Date().getTime();
// Add one more for the current day.
graphData.dateCount = graphData.dateCount + 1;
// Add the current session's startup time to the end of the array
graphData.startupTimes.push([
latest,
payload.data.last['org.mozilla.appSessions.current'].firstPaint / 1000
]);
if (payload.data.last['org.mozilla.appSessions.current'].firstPaint > 0) {
graphData.dateCount = graphData.dateCount + 1;
// Add the current session's startup time to the end of the array
graphData.startupTimes.push([
latest,
payload.data.last['org.mozilla.appSessions.current'].firstPaint / 1000
]);
}

return graphData;
},
Expand Down Expand Up @@ -288,8 +294,10 @@ calculateMedianStartupTime = function() {
// and ensure that we have paint times to add.
if(counter < 10 && typeof paintTimes !== 'undefined') {
for(var paintTime in paintTimes) {
startupTimes.push(paintTimes[paintTime]);
++counter;
if (paintTime > 0) {
startupTimes.push(paintTimes[paintTime]);
++counter;
}
}
}
}
Expand Down