user2125107
user2125107

Reputation: 21

Measure ASP.NET method performance client-side

I have a web application in ASP.NET with a save function at one point, that I want to measure the execution time since our users are complaining about the save process being slow.

I get the idea that I could add a client-side script on the button to get the starting time of the method call, but is there a way, still on the client side, to know when the save process is complete, to know the end time? Or should I consider the end time at the end of the method execution, since it is done on server-side?

Basically, I need to know the time it takes when the user hits the save button until they are returned to the other page after the save.

Thanks in advance, Bruno

Upvotes: 2

Views: 349

Answers (3)

Singleton
Singleton

Reputation: 3679

For server side methods :

you need to enable tracing to get to know what process and which method is getting time on server side. http://wiki.asp.net/page.aspx/435/aspnet-tracing/

For client side

fiddler or ySlow can help you in this regards.

Advance: Ant profiler can help you to find bottle neck in your code

Upvotes: 1

Jack Marchetti
Jack Marchetti

Reputation: 15754

If your save function is calling something server side.

Just do this:

//start of function
DateTime dt1 = DateTime.Now;

.
.
.
.

//end of function, right before return
DateTime dt2 = DateTime.Now;
TimeSpan ts = dt2.Subtract(dt1);

The ts will give you totalseconds, totalminutes, etc...

Upvotes: 1

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114347

.NET runs on the server, not the client.

You can use your browser debugger and monitor the NETWORK panel to see where the delay is, regardless of the technology used.

Upvotes: 1

Related Questions