How to check that how many miliseconds system has taken to execute code

Kishore4321
Tera Contributor

Hi all,

 

Can come one please help me that how to check that how many milliseconds system has taken to execute below code.

 

Script include :

var result = [];
   
    // if our list is empty, avoid the query...
    if (list.isEmpty())
        return result;
       
    // query for the records on the list...
    var gr = new GlideRecord(tableName);
    gr.addQuery('sys_id', list);
    gr.addActiveQuery();
    gr.query();
   
    // now iterate through our records, building our result list...
    while (gr.next()) {
        var le = new className(gr);
        if (le.isValid())
            result.push(le);
    }
    if (result.length != list.size()){
............
}
return result ;
},
1 REPLY 1

Sumanth16
Kilo Patron

Hi @Kishore4321 ,

 

Please refer to below thread:

https://www.servicenow.com/community/developer-blog/community-code-snippet-server-side-millisecond-t...

https://www.servicenow.com/community/developer-forum/scripting-how-to-measure-the-execution-time-of-...

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda