@@ -33,6 +33,28 @@ if (process.env.path !== undefined) {
33
33
process . env . PATH = nodeModulesPathPrefix + process . env . PATH ;
34
34
}
35
35
36
+ function toNs ( diff ) {
37
+ return diff [ 0 ] * 1e9 + diff [ 1 ] ;
38
+ }
39
+
40
+ function mark ( ) {
41
+ if ( ! fold . isTravis ( ) ) return ;
42
+ var stamp = process . hrtime ( ) ;
43
+ var id = Math . floor ( Math . random ( ) * 0xFFFFFFFF ) . toString ( 16 ) ;
44
+ console . log ( "travis_time:start:" + id + "\r" ) ;
45
+ return {
46
+ stamp : stamp ,
47
+ id : id
48
+ } ;
49
+ }
50
+
51
+ function measure ( marker ) {
52
+ if ( ! fold . isTravis ( ) ) return ;
53
+ var diff = process . hrtime ( marker . stamp ) ;
54
+ var total = [ marker . stamp [ 0 ] + diff [ 0 ] , marker . stamp [ 1 ] + diff [ 1 ] ] ;
55
+ console . log ( "travis_time:end:" + marker . id + ":start=" + toNs ( marker . stamp ) + ",finish=" + toNs ( total ) + ",duration=" + toNs ( diff ) + "\r" ) ;
56
+ }
57
+
36
58
var compilerSources = [
37
59
"core.ts" ,
38
60
"performance.ts" ,
@@ -286,6 +308,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
286
308
*/
287
309
function compileFile ( outFile , sources , prereqs , prefixes , useBuiltCompiler , opts , callback ) {
288
310
file ( outFile , prereqs , function ( ) {
311
+ var startCompileTime = mark ( ) ;
289
312
opts = opts || { } ;
290
313
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler ;
291
314
var options = "--noImplicitAny --noImplicitThis --noEmitOnError --types "
@@ -362,11 +385,13 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
362
385
callback ( ) ;
363
386
}
364
387
388
+ measure ( startCompileTime ) ;
365
389
complete ( ) ;
366
390
} ) ;
367
391
ex . addListener ( "error" , function ( ) {
368
392
fs . unlinkSync ( outFile ) ;
369
393
fail ( "Compilation of " + outFile + " unsuccessful" ) ;
394
+ measure ( startCompileTime ) ;
370
395
} ) ;
371
396
ex . run ( ) ;
372
397
} , { async : true } ) ;
@@ -769,6 +794,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
769
794
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
770
795
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
771
796
if ( ! runInParallel ) {
797
+ var startTime = mark ( ) ;
772
798
tests = tests ? ' -g "' + tests + '"' : '' ;
773
799
var cmd = "mocha" + ( debug ? " --debug-brk" : "" ) + " -R " + reporter + tests + colors + bail + ' -t ' + testTimeout + ' ' + run ;
774
800
console . log ( cmd ) ;
@@ -777,20 +803,23 @@ function runConsoleTests(defaultReporter, runInParallel) {
777
803
process . env . NODE_ENV = "development" ;
778
804
exec ( cmd , function ( ) {
779
805
process . env . NODE_ENV = savedNodeEnv ;
806
+ measure ( startTime ) ;
780
807
runLinter ( ) ;
781
808
finish ( ) ;
782
809
} , function ( e , status ) {
783
810
process . env . NODE_ENV = savedNodeEnv ;
811
+ measure ( startTime ) ;
784
812
finish ( status ) ;
785
813
} ) ;
786
814
787
815
}
788
816
else {
789
817
var savedNodeEnv = process . env . NODE_ENV ;
790
818
process . env . NODE_ENV = "development" ;
819
+ var startTime = mark ( ) ;
791
820
runTestsInParallel ( taskConfigsFolder , run , { testTimeout : testTimeout , noColors : colors === " --no-colors " } , function ( err ) {
792
821
process . env . NODE_ENV = savedNodeEnv ;
793
-
822
+ measure ( startTime ) ;
794
823
// last worker clean everything and runs linter in case if there were no errors
795
824
deleteTemporaryProjectOutput ( ) ;
796
825
jake . rmRf ( taskConfigsFolder ) ;
@@ -1069,6 +1098,7 @@ var lintTargets = compilerSources
1069
1098
desc ( "Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex" ) ;
1070
1099
task ( "lint" , [ "build-rules" ] , function ( ) {
1071
1100
if ( fold . isTravis ( ) ) console . log ( fold . start ( "lint" ) ) ;
1101
+ var startTime = mark ( ) ;
1072
1102
var lintOptions = getLinterOptions ( ) ;
1073
1103
var failed = 0 ;
1074
1104
var fileMatcher = RegExp ( process . env . f || process . env . file || process . env . files || "" ) ;
@@ -1084,6 +1114,7 @@ task("lint", ["build-rules"], function() {
1084
1114
done [ target ] = true ;
1085
1115
}
1086
1116
}
1117
+ measure ( startTime ) ;
1087
1118
if ( fold . isTravis ( ) ) console . log ( fold . end ( "lint" ) ) ;
1088
1119
if ( failed > 0 ) {
1089
1120
fail ( 'Linter errors.' , failed ) ;
0 commit comments