But isn't that only part of the picture? Does the controller code
actually get loaded first on a request?

On Mar 5, 8:55 pm, "Florent Aide" <[EMAIL PROTECTED]> wrote:
> You can also do the same with
> import time
> t1 = time.time()
> t2 = time.time()
> elapsed_time = t2 - t1
>
> in this case elapsed_time is a float expressed in seconds.
>
> Cheers.
>
> On 3/5/07, Florent Aide <[EMAIL PROTECTED]> wrote:
>
> > On 3/5/07, Mikkel Høgh <[EMAIL PROTECTED]> wrote:
>
> > > Hi guys,
>
> > Hi Mikkel,
>
> > > I was wondering wheter it is possible to output the page generation
> > > time, like many PHP-based sites do.
> > > It is great to get an overview how wasteful your code is :)
>
> > import datetime
>
> > class Root(controllers.RootController):
> >     @expose(template="tmc.templates.welcome")
> >     def index(self):
> >         t1 = datetime.datetime.now()
> >         #do some stuff here
> >         t2 = datetime.datetime.now()
> >         elapsed_time = t2 - t1
> >         return dict(elapsed_time=elapsed_time)
>
> > elapsed_time is a timedelta. You can use its attributes to have the
> > seconds and microseconds elapsed. ie:
>
> > elapsed_time.seconds
> > elapsed_time.microseconds
>
> > you can even have days but hopefully it will return 0 :)
>
> > assert elapsed_time.days == 0, "Houston we got a problem here..."
>
> > Regards,
>
> > Florent AIDE.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to