Re: Mystery getting localtime from C++ app.
- From: Carlos Moreno <moreno_at_mochima_dot_com@xxxxxxxxxxxxxx>
- Date: Thu, 12 Oct 2006 11:14:49 -0400
Nils O. Selåsdal wrote:
That call to localtime_r seems to be taking lots of time.
How do you know it's localtime_r that takes time ?
strace output (see my other message for my interpretation of
that output)
There are two other calls to current_date(), and for those,
the lstat64 takes 2 or 3 seconds.
an lstat call might involves IO, if it lstats a file on a network share,
it can take time. If a local filesystem is very busy, I've
seen file access take much longer than that when you're unlucky.
It is a local file (/etc/localtime), and the thing is that it
is consistent -- I run the program 5 times, and 5 times I get
those 4 or 5 seconds between the moment the strace output
shows stat64 and the time the next line shows.
The thing is, can you think of scenarios/conditions that
could cause the above to take ridiculously longer than
normal to run? (the "trouble program" is also doing
connections to a PostgreSQL database server, which also
involve connections to the DNS server)
So, DNS timeouts ? network delays ? Takes time for postgres
to authenticate you .. etc.
But the thing is, I'm observing a delay of 5 seconds in a
section of the program where there's no SQL activity at
that point (I do see the delays corresponding to SQL and
DNS in other sections of the strace output, and they seem
reasonable to me -- they're always within a fraction of a
second)
* comment away calls to current_date or do a dummy implementation, so
you can prove it is/isn't current_date that is the problem..
That's a good point!
* Time functions yourself.
That's what I've been calling "plan B" so far :-) It would
require that I modify the program, so I was hoping to be
able to find the problem without resorting to that (since
we're talking production code).
Thanks for your suggestions!
Carlos
--
.
- References:
- Mystery getting localtime from C++ app.
- From: Carlos Moreno
- Re: Mystery getting localtime from C++ app.
- From: "Nils O. Selåsdal"
- Mystery getting localtime from C++ app.
- Prev by Date: Re: Mystery getting localtime from C++ app.
- Next by Date: Re: Mystery getting localtime from C++ app.
- Previous by thread: Re: Mystery getting localtime from C++ app.
- Next by thread: Re: BIOS calls
- Index(es):
Relevant Pages
|
Loading