Finding the Page Generation Time [modified]
-
:confused: How in Asp.Net can you find the amount of time it took to generate the page? I see this sort of stuff on the bottom of websites all the time. Code or a link to a tutorial would be greatly appreciated:) -- modified at 19:21 Wednesday 2nd August, 2006
-
:confused: How in Asp.Net can you find the amount of time it took to generate the page? I see this sort of stuff on the bottom of websites all the time. Code or a link to a tutorial would be greatly appreciated:) -- modified at 19:21 Wednesday 2nd August, 2006
You can't, really. You can get the execution time of part of the generation process, but not the whole. However, that is probably what the others that you saw does anyway. What you can't measure is the compilation and creation of the page object, and the rendering of the page. The compilation takes about three seconds for the first page, and the time used for object creation and page rendering doesn't vary very much, so it's not very interresting anyway. Get the current time as early in the page creation process as you can, like in the PreInit or Init event. Then get the current time as late as possible while you still can put anything in the page, like in the PreRender event. Subtract the times and put the result in the page.
--- b { font-weight: normal; }
-
You can't, really. You can get the execution time of part of the generation process, but not the whole. However, that is probably what the others that you saw does anyway. What you can't measure is the compilation and creation of the page object, and the rendering of the page. The compilation takes about three seconds for the first page, and the time used for object creation and page rendering doesn't vary very much, so it's not very interresting anyway. Get the current time as early in the page creation process as you can, like in the PreInit or Init event. Then get the current time as late as possible while you still can put anything in the page, like in the PreRender event. Subtract the times and put the result in the page.
--- b { font-weight: normal; }
-
:confused: How in Asp.Net can you find the amount of time it took to generate the page? I see this sort of stuff on the bottom of websites all the time. Code or a link to a tutorial would be greatly appreciated:) -- modified at 19:21 Wednesday 2nd August, 2006
what ever guffa said is the better but slight change is save the current time in page on_init() time1 page_render() time2 procestime = time2-time1 then u will get absolute processtime