C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

How to capture the process time of an aspx page


Posted Date: 09 Nov 2004    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: Venkata Siva BhaskararaoMember Level: Bronze    
Rating: 1 out of 5Points: 5



The following example demonstrates how to capture the process time of an web page.

Follow the steps:
step 1 : Declare two variables "_beginTime" and "_endTime" as DateTime datatype.

step 2 : Write the following code in Application_BeginRequest event.
 _beginTime=DateTime.Now; 


step 3 : Write the following code in Application_EndRequest event.
  	
_endTime=DateTime.Now;
int _processTime=_endTime.Millisecond -_beginTime.Millisecond;
if (_processTime<0)
{
_processTime=1000+_processTime;
}

Response.Output.Write("<script>alert('Process Time={0} MilliSeconds')</script>",_processTime);


Feel free to comment
Bhaskar



Responses

Author: sumesh    18 Nov 2004Member Level: Silver   Points : 0
why u are adding 1000 to process time if it is less than 0. I think
we will always get process time as positive value b'cos atleast a
fragment of time will be spent for that.
Sumesh


Author: Venkata Siva Bhaskararao    19 Nov 2004Member Level: Bronze   Points : 0
Am capturing time as milliseconds, so for every 1000 millisecond again it starts from first millisecond.
For example if starttime is 900th millisecond and it taken 200 milliseconds to process then the endtime will be 100th millisecond instead of 1100th millisecond. Thatz y am adding 1000 to process time to get positive and correct value.



Author: azmi    22 Nov 2004Member Level: Bronze   Points : 0
hi.. what should i do to convert from miliseconds to seconds

e.g: result 280 miliseconds but want it to display as 0.28 seconds

Thanks in advance


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Generating Bar Chart in ASP.net
Previous Resource: Paging in asp.net - part II (Custom Paging in datagrid).
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use