A more useful measurement might be to set task_t0 as a global variable
at the top of your file, with only the import of "time" preceding it

import time
task_t0 = time.time()

... other imports
... code

A lot of things happen before your post() handler. Not just imports
but potentially the registration of wsgi handlers and so on.

Nick Verne

On Tue, Jun 21, 2011 at 10:04 AM, Waleed Abdulla <[email protected]> wrote:
> Thanks, Nick. I guess I assumed the issue is not in my code so didn't find a
> need to include more details. That, obviously, is a bad assumption, so here
> is more details:
> I'm using Python. I'm calculating the time in my code as follows:
>   def post(self):
>     task_t0 = time.time()
>     logging.info("start task")
>     .... code of the method ....
>     logging.info("time to finish task: %r seconds", time.time() - task_t0)
>   # last line in the function
>
> Regards,
> Waleed
>
>
>
> On Mon, Jun 20, 2011 at 3:29 PM, Nicholas Verne <[email protected]> wrote:
>>
>> Waleed,
>>
>> It's hard to make suggestions without knowing whether this is a Java
>> or Python app, or where in your code the "start_time" measurement is
>> taken.
>>
>> In the case of a Python app, if you have import statements before you
>> set start_time, then it is probably those imports that are taking up
>> the excess time.
>>
>> Nick Verne
>>
>> On Tue, Jun 21, 2011 at 6:32 AM, Renan Mobile
>> <[email protected]> wrote:
>> > Interesting... i really know why. Because u use less CPU then google
>> > shows.
>> > Will u pay for the 10seconds or for 0.8?
>> >
>> > Em 20/06/2011 15:53, "Waleed Abdulla" <[email protected]> escreveu:
>> >> I've been having a hard time getting GAE to run my taskqueue tasks as
>> >> fast
>> >> as I want them to run (described it in a previous thread). Part of my
>> >> research, I put a timer in my code to see how long each part of my code
>> >> takes. I noticed that while the task takes 0.8 seconds to run, the
>> >> actual
>> >> processing time as shown in GAE logs goes up to 10 seconds (see
>> >> attached
>> >> screen shot). Why such a big difference? And what's happening in that
>> >> time?
>> >>
>> >> Waleed
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Google App Engine" 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/google-appengine?hl=en.
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Google App Engine" 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/google-appengine?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" 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/google-appengine?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" 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/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en.

Reply via email to