How to time the graph algorithm execution

I am testing graph algorithms in Tigergraph: https://github.com/tigergraph/gsql-graph-algorithms.
However, I could not find timers to measure the execution time of the algorithms.

Is there a way to add timers to the .gsql files to measure just the execution time excluding graph reading or results writing to a file? I don’t want to use Linux utility time as it measure end to end time.

You can use log statement to mark time
https://docs.tigergraph.com/dev/gsql-ref/querying/output-statements-and-file-objects#log-statement
then you can find them in gpe info log

The values will be recorded in the GPE log. To find the log file after the query has completed, open a Linux shell and use the command “gadmin log gpe”. It may show you more than one log file name; use the one ending in “INFO”. Search this file for “UDF_”.

1 Like

If it is OK to see the timing after the execution, try this:

CREATE QUERY MyQuery(...) FOR GRAPH MyGraph { 

	  DATETIME before;
	
	  start = SomeVertex.*;
	  
	  before = now();

	  <black magic here>
	
	  PRINT("Black magic took " + to_string(datetime_diff(now(), before)) + " seconds") AS timing;
	
	  PRINT <black magic results>;
}

and then you will see this in the result set:

{
    "timing": "Black magic took 5 seconds"
},

I don’t think we can measure <1s durations this way.

2 Likes

@Szilard_Barany, the answer works, but only in seconds, if I want milliseconds, how can I change the syntax?