Measure execution time

Hi everyone,

I'm totally new to Knime and I hope someone here can help me out with this question:

How could we calculate time taken to execute a node in Knime?

Thanks in advance.

 

The nodes output the time taken as an INFO comment in the console:

 

For exmaple:

INFO LocalNodeExecutionJob Converter 0:528 End execute (1 sec)

Alternatively you could use a couple of Java snippets to roughly calculate the execution time (there will be an overhead involved with using the nodes and you will need to make sure you reset the initial snippet).

 

Here is an example of how you could calculate the processing time in seconds as a flow variable:

 

1) Table creator with some dummy data

2) Java Edit Variable which creates a new variable storing seconds since epoch

 

out_start = (int) (System.currentTimeMillis() / 1000L);

 

3) Extract the RowID

4) Do a simple concatination (to add time, the RowID extract was too quick

5) New Java edit variable calculating the new time since epoch and the difference

 

// Seconds since epoch

int start = v_start;
// Seconds since epoch
int end = (int) (System.currentTimeMillis() / 1000L);
 
// Total time in seconds
int difference = end - start;
 
out_RunTim = difference;
 
---
 
This outputs the time in seconds it took to run the java edit variable, RowID, Java Snippet and second edit vairable up to the time that it got the system time. 
 
There may be a better way to do this though. Ideally you wouldn't use an int for the time value but I don't seem to be able to output a long in the Java snippet nodes, you should be safe until 2038 though.   
 
Cheers
 
Sam
 
2 Likes

Hi,

I don't know if this helps but I used 2 bash nodes to spit out the start and end time and connected the node/s to be measured to it, using flow variable connections. (Enforcing order of execution)

Get a start time and end time. Manipulate the strings and convert to time format. Calculate Time difference using the time nodes in KNIME.

Hope it helps

Varun