Taking time of operations

Last edited on

Python

import time

def main( argv ):
    start_time = time.time()

    # Do the operation, for example snoozing...
    snooze(2)

    t = time.time() - start_time
    test.log("Done after %.2f seconds." % t)
test.py

Also see:

JavaScript

function main()
{
    var start_time = new Date().getTime();

    // Do the operation, for example snoozing...
    snooze(2);

    var t = new Date().getTime() - start_time;
    test.log("Done after " + (t/1000.0) + " seconds.")
}
test.js

Also see: