Hi Devart,
We're trying to measure some metrics on our code.
Is there any way to get the time spent between sending query out and data fetched on the client? We tried to use OracleMonitor class, but looks like After Execute event it doesn't include the fetching time. Please advice.
Thank you.
Get execution timings
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Get execution timings
OracleMonitor class has the TraceEvent event that allows getting duration of a fetch operation. For more information, please refer to http://www.devart.com/dotconnect/oracle ... nt_EV.html
Here is the example, demonstrating how to get duration of a fetch operation with this event.
In your case, the duration of the fetch operation is equal to the duration of preparing and executing the statement:
Here is the example, demonstrating how to get duration of a fetch operation with this event.
In your case, the duration of the fetch operation is equal to the duration of preparing and executing the statement:
Code: Select all
static void Main(string[] args)
{
OracleMonitor mon = new OracleMonitor();
mon.IsActive = true;
mon.TraceEvent += new Devart.Common.MonitorEventHandler(mon_TraceEvent);
OracleConnection conn = new OracleConnection("your connection string");
conn.Open();
OracleCommand comm = new OracleCommand("select * from dept", conn);
var reader = comm.ExecuteReader();
}
static void mon_TraceEvent(object sender, Devart.Common.MonitorEventArgs e)
{
if (e.TracePoint == MonitorTracePoint.AfterEvent&&(e.EventType==MonitorEventType.Execute||e.EventType==MonitorEventType.Prepare))
{
Console.WriteLine("Description: " + e.Description);
Console.WriteLine(" Duration: " + e.Duration);
}
}
Re: Get execution timings
Hi Pinturiccio,
Thanks for the prompt response!
Does that include time of iterating through data reader and getting all the data loaded on the client?
Our queries are produced by Entity Framework (we use Entity Developer for our model).
Is there any way for us to get elapsed time between the query was sent to Oracle and Devart's internal data reader finished with enumerating data to provide that to the upper layer?
Thank you.
Thanks for the prompt response!
Does that include time of iterating through data reader and getting all the data loaded on the client?
Our queries are produced by Entity Framework (we use Entity Developer for our model).
Is there any way for us to get elapsed time between the query was sent to Oracle and Devart's internal data reader finished with enumerating data to provide that to the upper layer?
Thank you.
Re: Get execution timings
No, this is the time to wait for any server reply since the command was sent to a server, and it doesn't include the time necessary to fetch data if the command selects some data.Partizan wrote:Does that include time of iterating through data reader and getting all the data loaded on the client?
Our EF provider is not shipped with any embedded tools for this task. You should implement metrics in your code.Partizan wrote:Is there any way for us to get elapsed time between the query was sent to Oracle and Devart's internal data reader finished with enumerating data to provide that to the upper layer?