Monday, April 15, 2019

How to find out how long a script took to execute

A user may determine how long a script ran for or which part of their script is causing the most slowness using standard JavaScript and nlapiLogExection for logging.

Here is an example code for a script deployment which has the log level set to DEBUG:

var date1 = new Date();
nlapiLogExecution('DEBUG', 'time entered script', date1);

var date2 = new Date();
nlapiLogExecution('DEBUG', 'time exited script', date2);

The user can enter these two log executions in sections of your code where you want to track the execution time. He/she can view the script deployment execution logs to view these entries.

No comments:

Post a Comment