tags:

views:

47

answers:

1

I need to capture how long it takes for my application to execute a stored procedure. The results of the procedure are being stored in a dataset by a DataAdapter. My question is does DataAdapter.Fill execute the stored procedure? If so I know I'm measuring the correct "start" point for the time interval I'm measuring.

+3  A: 

If you need to measure it directly, why not use SQL Profiler? That way, you can capture the RCP Begin and End events, and know exactly how long the execution took on the database server.

From your application's perspective, though, .Fill does execute the SP when it populates the Dataset, so seeing how long this .Fill takes will give you a picture of how long the SP takes, including network latency and the processing of the .NET framework, which will add some slight overhead.

rwmnau
The main thing is that measuring through the application gives us less impact on the database. We are getting sporatic performance issues that aren't the "normal" so we needed a way of tracking them down.
Achilles
+1 -- had pretty much the exact same typed up. While timing `Fill` is handy, breaking it (even in just 2 chunks -- overall and time on SQL Server) gives you a better idea of what to fix.
Austin Salonen
Thanks guys, my code is good for now then :-D
Achilles