-
-
Notifications
You must be signed in to change notification settings - Fork 135
How to profile JavaScript
Mihail Slavchev edited this page Dec 17, 2015
·
9 revisions
Note: this functionality may change in future
NativeScript runtime for Android provides __startCPUProfiler
and __stopCPUProfiler
global functions which help you to profile your JavaScript code. Here is an exameple
__startCPUProfiler("myprofile");
// some JavaScript code
__stopCPUProfiler("myprofile");
This will create file with the following naming scheme /sdcard/<package name>-<profile>-<timestamp>.cpuprofile
.For example, if your application package name is org.nativescript.app1
then the output file will be named org.nativescript.app1-myprofile-19388793.672149.cpuprofile
. Once you have a *.cpuprofile
file you can pull it from the device with the following command
adb pull /sdcard/org.nativescript.app1-myprofile-19388793.672149.cpuprofile
The you can load it with Chrome DevTools.