File tree 4 files changed +33
-7
lines changed
4 files changed +33
-7
lines changed Original file line number Diff line number Diff line change 1
1
require ( "globals" ) ;
2
2
var profiling = require ( './profiling' ) ;
3
- profiling . start ( 'application-start' ) ;
3
+ // profiling.start('application-start');
4
4
5
5
var reflectMetadata = require ( "reflect-metadata" ) ;
6
6
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " tns-template-hello-world" ,
3
+ "main" : " starter.js" ,
3
4
"jsoptions" : " --expose_gc" ,
4
5
"version" : " 1.4.0" ,
5
6
"author" : " Telerik <support@telerik.com>" ,
Original file line number Diff line number Diff line change @@ -11,14 +11,16 @@ function time() {
11
11
}
12
12
}
13
13
exports . time = time ;
14
- var timers = new Map ( ) ;
14
+ if ( ! global . timers ) {
15
+ global . timers = new Map ( ) ;
16
+ }
15
17
function start ( name ) {
16
18
if ( ! exports . ENABLE_PROFILING ) {
17
19
return ;
18
20
}
19
21
var info ;
20
- if ( timers . has ( name ) ) {
21
- info = timers . get ( name ) ;
22
+ if ( global . timers . has ( name ) ) {
23
+ info = global . timers . get ( name ) ;
22
24
if ( info . currentStart != 0 ) {
23
25
throw new Error ( "Timer already started: " + name ) ;
24
26
}
@@ -30,7 +32,7 @@ function start(name) {
30
32
count : 0 ,
31
33
currentStart : time ( )
32
34
} ;
33
- timers . set ( name , info ) ;
35
+ global . timers . set ( name , info ) ;
34
36
}
35
37
}
36
38
exports . start = start ;
@@ -48,14 +50,15 @@ function stop(name) {
48
50
}
49
51
var info = pauseInternal ( name ) ;
50
52
console . log ( "---- [" + name + "] STOP total: " + info . totalTime + " count:" + info . count ) ;
51
- timers . delete ( name ) ;
53
+ global . timers . delete ( name ) ;
52
54
}
53
55
exports . stop = stop ;
54
56
function pauseInternal ( name ) {
55
- var info = timers . get ( name ) ;
57
+ var info = global . timers . get ( name ) ;
56
58
if ( ! info ) {
57
59
throw new Error ( "No timer started: " + name ) ;
58
60
}
61
+ console . dump ( info ) ;
59
62
info . lastTime = Math . round ( time ( ) - info . currentStart ) ;
60
63
info . totalTime += info . lastTime ;
61
64
info . count ++ ;
Original file line number Diff line number Diff line change
1
+ if ( ! global . timers ) {
2
+ global . timers = new Map ( ) ;
3
+ }
4
+
5
+ function time ( ) {
6
+ if ( global . android ) {
7
+ return java . lang . System . nanoTime ( ) / 1000000 ; // 1 ms = 1000000 ns
8
+ }
9
+ else {
10
+ return CACurrentMediaTime ( ) * 1000 ;
11
+ }
12
+ }
13
+
14
+ var timerEntry = {
15
+ totalTime : 0 ,
16
+ count : 0 ,
17
+ currentStart : time ( )
18
+ } ;
19
+
20
+ global . timers . set ( "application-start" , timerEntry ) ;
21
+
22
+ require ( "./index.js" ) ;
You can’t perform that action at this time.
0 commit comments