Adding code to track expression rendering time

This commit is contained in:
Jeff Avallone
2015-01-01 11:57:11 -05:00
parent 37fca15bc8
commit 491c9535a9
2 changed files with 15 additions and 1 deletions
+6 -1
View File
@@ -125,7 +125,8 @@ export default class Regexper {
}
renderRegexp(expression) {
var parseError = false;
var parseError = false,
startTime, endTime;
if (this.running) {
let deferred = Q.defer();
@@ -141,6 +142,7 @@ export default class Regexper {
this.state = 'is-loading';
window._gaq.push(['_trackEvent', 'visualization', 'start']);
startTime = new Date().getTime();
this.running = new Parser(this.svgContainer);
@@ -161,6 +163,9 @@ export default class Regexper {
this.updateLinks();
this.displayWarnings(this.running.warnings);
window._gaq.push(['_trackEvent', 'visualization', 'complete']);
endTime = new Date().getTime();
window._gaq.push(['_trackTiming', 'visualization', 'total time', endTime - startTime]);
})
.then(null, message => {
if (message === 'Render cancelled') {