wtfCreateScope

wtfCreateScope

Experimental Const

Variable Export

export wtfCreateScope

Create trace scope.

Scopes must be strictly nested and are analogous to stack frames, but do not have to follow the stack frames. Instead it is recommended that they follow logical nesting. You may want to use Event Signatures as they are defined in WTF.

Used to mark scope entry. The return value is used to leave the scope.

var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');

someMethod() {
   var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
   // DO SOME WORK HERE
   return wtfLeave(s, 123); // Return value 123
}

Note, adding try-finally block around the work to ensure that wtfLeave gets called can negatively impact the performance of your application. For this reason we recommend that you don't add them to ensure that wtfLeave gets called. In production wtfLeave is a noop and so try-finally block has no value. When debugging perf issues, skipping wtfLeave, do to exception, will produce incorrect trace, but presence of exception signifies logic error which needs to be fixed before the app should be profiled. Add try-finally only when you expect that an exception is expected during normal execution while profiling.

exported from core-index defined in core/src/profile/profile.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/docs/ts/latest/api/core/index/wtfCreateScope-let.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部