473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Page Generation Time

I am wanting to include a message in the footer of my application which
displays the server-side page generation time. An example of what I
want is at http://p2p.wrox.com/ (This page was generated in x seconds.)

I am aware that I can find this information by adding trace="true" to
the page directive, but is there any way to access the information
otherwise (as this is something I want incorporated into the design,
not to be used for debugging)

If not, I would like some help on manually generating this myself. I
would like it to be done in the master page (or some other way where I
don't have to include it on every page I create) So would like to time
from the earliest point possible, to the latest possible (with still
being able to output to the browser). Any help would be greatly
appreciated!

Oct 26 '06 #1
5 1875
Well, you could simply do it at the start of onInit and at the end of
onPreRender in your master page.

You could actually start a little earlier, like in Application_BeginRequest
Begin_Request
HttpContext.Current.Items.Add("startTime", DateTime.Now);
onpreRender
if (HttpContext.Current.Items["startTime"] != null)
{
footerLiteral.Text =
DateTime.Now.Subtract((DateTime)HttpContext.Curren t.Items["startTime"]).TotalSeconds.ToString();
}
Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"Nick Ashley" <bs*****@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
>I am wanting to include a message in the footer of my application which
displays the server-side page generation time. An example of what I
want is at http://p2p.wrox.com/ (This page was generated in x seconds.)

I am aware that I can find this information by adding trace="true" to
the page directive, but is there any way to access the information
otherwise (as this is something I want incorporated into the design,
not to be used for debugging)

If not, I would like some help on manually generating this myself. I
would like it to be done in the master page (or some other way where I
don't have to include it on every page I create) So would like to time
from the earliest point possible, to the latest possible (with still
being able to output to the browser). Any help would be greatly
appreciated!

Oct 26 '06 #2
Hmmm, wouldn't you have to use something like :
DateTime.Now.ToString("ss.fffffff")

....in order to get a meaningful elapsed time ?

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME netwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
Well, you could simply do it at the start of onInit and at the end of onPreRender in your master
page.

You could actually start a little earlier, like in Application_BeginRequest
Begin_Request
HttpContext.Current.Items.Add("startTime", DateTime.Now);
onpreRender
if (HttpContext.Current.Items["startTime"] != null)
{
footerLiteral.Text =
DateTime.Now.Subtract((DateTime)HttpContext.Curren t.Items["startTime"]).TotalSeconds.ToString();
}
Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"Nick Ashley" <bs*****@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
>>I am wanting to include a message in the footer of my application which
displays the server-side page generation time. An example of what I
want is at http://p2p.wrox.com/ (This page was generated in x seconds.)

I am aware that I can find this information by adding trace="true" to
the page directive, but is there any way to access the information
otherwise (as this is something I want incorporated into the design,
not to be used for debugging)

If not, I would like some help on manually generating this myself. I
would like it to be done in the master page (or some other way where I
don't have to include it on every page I create) So would like to time
from the earliest point possible, to the latest possible (with still
being able to output to the browser). Any help would be greatly
appreciated!


Oct 27 '06 #3
Dunno... ??? :)

--
http://www.openmymind.net/
http://www.codebetter.com/
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:ey****************@TK2MSFTNGP04.phx.gbl...
Hmmm, wouldn't you have to use something like :
DateTime.Now.ToString("ss.fffffff")

...in order to get a meaningful elapsed time ?

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
netwrote in message news:%2******************@TK2MSFTNGP04.phx.gbl...
>Well, you could simply do it at the start of onInit and at the end of
onPreRender in your master page.

You could actually start a little earlier, like in
Application_BeginRequest
Begin_Request
HttpContext.Current.Items.Add("startTime", DateTime.Now);
onpreRender
if (HttpContext.Current.Items["startTime"] != null)
{
footerLiteral.Text =
DateTime.Now.Subtract((DateTime)HttpContext.Curre nt.Items["startTime"]).TotalSeconds.ToString();
}
Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"Nick Ashley" <bs*****@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegr oups.com...
>>>I am wanting to include a message in the footer of my application which
displays the server-side page generation time. An example of what I
want is at http://p2p.wrox.com/ (This page was generated in x seconds.)

I am aware that I can find this information by adding trace="true" to
the page directive, but is there any way to access the information
otherwise (as this is something I want incorporated into the design,
not to be used for debugging)

If not, I would like some help on manually generating this myself. I
would like it to be done in the master page (or some other way where I
don't have to include it on every page I create) So would like to time
from the earliest point possible, to the latest possible (with still
being able to output to the browser). Any help would be greatly
appreciated!



Oct 27 '06 #4
Karl,

I implemented what you suggested, and it worked beautifully.

Juan, I'm not sure what you are suggesting, is it just an alternate way
to format? I took Karl's advice, then simply added Math.Round to round
the result to the nearest 100th of a second.

Thanks for the help guys, I appreciate it.

On Oct 27, 4:38 am, "Karl Seguin [MVP]" <karl REMOVE @ REMOVE
openmymind REMOVEMETOO . ANDME netwrote:
Dunno... ??? :)

--http://www.openmymind.net/http://www.codebetter.com/

"Juan T. Llibre" <nomailrepl...@nowhere.comwrote in messagenews:ey****************@TK2MSFTNGP04.phx.gb l...
Hmmm, wouldn't you have to use something like :
DateTime.Now.ToString("ss.fffffff")
...in order to get a meaningful elapsed time ?
Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
===================================
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
netwrote in messagenews:%2******************@TK2MSFTNGP04.phx. gbl...
Well, you could simply do it at the start of onInit and at the end of
onPreRender in your master page.
You could actually start a little earlier, like in
Application_BeginRequest
Begin_Request
HttpContext.Current.Items.Add("startTime", DateTime.Now);
onpreRender
if (HttpContext.Current.Items["startTime"] != null)
{
footerLiteral.Text =
DateTime.Now.Subtract((DateTime)HttpContext.Curren t.Items["startTime"]).TotalSeconds.ToString();
}
Karl
--
http://www.openmymind.net/
http://www.codebetter.com/
"Nick Ashley" <bsbo...@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegr oups.com...
I am wanting to include a message in the footer of my application which
displays the server-side page generation time. An example of what I
want is athttp://p2p.wrox.com/(This page was generated in x seconds.)
>I am aware that I can find this information by adding trace="true" to
the page directive, but is there any way to access the information
otherwise (as this is something I want incorporated into the design,
not to be used for debugging)
>If not, I would like some help on manually generating this myself. I
would like it to be done in the master page (or some other way where I
don't have to include it on every page I create) So would like to time
from the earliest point possible, to the latest possible (with still
being able to output to the browser). Any help would be greatly
appreciated!
Oct 27 '06 #5
re:
added Math.Round to round the result to the nearest 100th of a second
Seconds are not enough to establish the time elapsed between events,
although for a total ET it would work, if you round it as you did.

Also, you have to watch out for the server caching the page.
The results of caching distort the real time it takes.

OnInit and Render seem to happen simultaneously when the page is cached.

Care to share/post your code, so others can benefit ?

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Nick Ashley" <bs*****@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
Karl,

I implemented what you suggested, and it worked beautifully.

Juan, I'm not sure what you are suggesting, is it just an alternate way
to format? I took Karl's advice, then simply added Math.Round to round
the result to the nearest 100th of a second.

Thanks for the help guys, I appreciate it.

On Oct 27, 4:38 am, "Karl Seguin [MVP]" <karl REMOVE @ REMOVE
openmymind REMOVEMETOO . ANDME netwrote:
Dunno... ??? :)

--http://www.openmymind.net/http://www.codebetter.com/

"Juan T. Llibre" <nomailrepl...@nowhere.comwrote in
messagenews:ey****************@TK2MSFTNGP04.phx.gb l...
Hmmm, wouldn't you have to use something like :
DateTime.Now.ToString("ss.fffffff")
...in order to get a meaningful elapsed time ?
Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
===================================
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
netwrote in messagenews:%2******************@TK2MSFTNGP04.phx. gbl...
Well, you could simply do it at the start of onInit and at the end of
onPreRender in your master page.
You could actually start a little earlier, like in
Application_BeginRequest
Begin_Request
HttpContext.Current.Items.Add("startTime", DateTime.Now);
onpreRender
if (HttpContext.Current.Items["startTime"] != null)
{
footerLiteral.Text =
DateTime.Now.Subtract((DateTime)HttpContext.Curren t.Items["startTime"]).TotalSeconds.ToString();
}
Karl
--
http://www.openmymind.net/
http://www.codebetter.com/
"Nick Ashley" <bsbo...@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegr oups.com...
I am wanting to include a message in the footer of my application which
displays the server-side page generation time. An example of what I
want is athttp://p2p.wrox.com/(This page was generated in x seconds.)
>I am aware that I can find this information by adding trace="true" to
the page directive, but is there any way to access the information
otherwise (as this is something I want incorporated into the design,
not to be used for debugging)
>If not, I would like some help on manually generating this myself. I
would like it to be done in the master page (or some other way where I
don't have to include it on every page I create) So would like to time
from the earliest point possible, to the latest possible (with still
being able to output to the browser). Any help would be greatly
appreciated!

Oct 27 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
7
by: indie | last post by:
how to make a user management in php, i mean that i want to limit the user access to my page. the script will not allow 2 user have an access to my page at the same time. the script only allow 1...
8
by: Max M | last post by:
Yesterday there was an article on Slashdot: http://books.slashdot.org/article.pl?sid=03/09/04/1415210&mode=flat&tid=108&tid=126&tid=156 It is about automatic code generation. I got interrested...
11
by: David Given | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Say I have a piece of Javascript that transforms the HTML on a page. (In order to work around CSS bugs.) I could invoke this from the BODY onload...
1
by: Fabricio Tofoli | last post by:
Hello all, I have a simple ASP.NET project that displays the contents of a MySql database table in the web page. All pages are extremelly slow, and not only the first time you access them, it's...
4
by: Scott Reynolds | last post by:
Hello! How I can calculate and display page loading/generation time? Thanks! Scott
13
by: urs | last post by:
Hi, please look at the site http://www.prismatest.ch/catalog/EM.ASPX (user=prismashop, password=minicooper). When paginating through the list, the page rebuilds itself every time on firefox and...
31
by: eliben | last post by:
Hello, In a Python program I'm writing I need to dynamically generate functions and store them in a dict. eval() can't work for me because a function definition is a statement and not an...
3
by: raghulvarma | last post by:
Consider the following scenario. Currently a .Net application is used to generate reports. The end user needs the reports twice in a day.So he runs the application at scheduled time for report...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.