Rawhi
Rawhi

Reputation: 6403

how to measure the page time load?

I want to know how much time a specific code in my App takes ?!!! Thank you

Upvotes: 1

Views: 455

Answers (2)

m.edmondson
m.edmondson

Reputation: 30862

Aside from @Darins answer you won't be able to measure page load time on the client as they are across a network and there are many variables involved (i.e. You can start a javascript timer as the page would need loaded first). However anything on the server can be timed.

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

You could use the Stopwatch class:

var watch = Stopwatch.StartNew();
// Run your code here
watch.Stop();
long milliseconds = watch.ElapsedMilliseconds; 

Upvotes: 7

Related Questions