C# Profiling Duration
Does anyone have an example of how to get the millisecond/microsecond execution time of a query in C#? I can't find any examples of this online.
Solution:Jump to solution
I don't have really good alternative.
Option is to run same traversal from Gremlin Console or java GLV.
If you have GremlinGroovyScriptEngine (it's default for TinkerPop 3.6-3.7) then workaround is to convert response to string or Map before sending back from server, something like
await client.SubmitWithSingleResultAsync<Object>("g.V().profile().toList().toString()");
...6 Replies
Milliseconds can be get with StopWatch https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.stopwatch?view=net-8.0
Stopwatch Class (System.Diagnostics)
Provides a set of methods and properties that you can use to accurately measure elapsed time.
Are there any caveats with using profile() in dotnet ? Is it as simple as g.<query>.Profile() ? Also what's the format of the response ?
profile() will not work, dotnet GLV can't deserialize server response of TraversalMetrics type
is there an alternative to profile in that case ?
Solution
I don't have really good alternative.
Option is to run same traversal from Gremlin Console or java GLV.
If you have GremlinGroovyScriptEngine (it's default for TinkerPop 3.6-3.7) then workaround is to convert response to string or Map before sending back from server, something like
await client.SubmitWithSingleResultAsync<Object>("g.V().profile().toList().toString()");
ok we'll try this. Thanks @Valentyn Kahamlyk