From d1d88c32c36d813ef1e0fd1566c980115065f6c8 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 12 Nov 2015 23:51:28 -0800 Subject: [PATCH] build(analytics): start tracking gulp startup latency This measures how long does it take for gulp to start the first task up after being invoked from command line. I'm suspecting that we can optimize this significantly, but let's start tracking it first. --- gulpfile.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 07b72c8b4c..4d00a154d7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1282,6 +1282,14 @@ process.on('beforeExit', function() { }); -gulp.on('task_start', (e) => { analytics.buildStart('gulp ' + e.task)}); -gulp.on('task_stop', (e) => { analytics.buildSuccess('gulp ' + e.task, e.duration*1000)}); -gulp.on('task_err', (e) => { analytics.buildError('gulp ' + e.task, e.duration*1000)}); +var firstTask = true; +gulp.on('task_start', (e) => { + if (firstTask) { + firstTask = false; + analytics.buildSuccess('gulp ', process.uptime() * 1000); + } + + analytics.buildStart('gulp ' + e.task) +}); +gulp.on('task_stop', (e) => {analytics.buildSuccess('gulp ' + e.task, e.duration * 1000)}); +gulp.on('task_err', (e) => {analytics.buildError('gulp ' + e.task, e.duration * 1000)});