Re: Mystery getting localtime from C++ app.



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
--
.



Relevant Pages

  • Re: RWW Issue
    ... can resolve this issue: ... | I remote desktop into it. ... | desktop is enabled to allow remote connections. ... | DNS server failed the update request. ...
    (microsoft.public.windows.server.sbs)
  • Re: Any known issues withsp2 and non-sp xp ics?
    ... you might not be able to access the internet or some resources.This problem ... occured because the network did not assign a network address to the computer. ... from the network connections folder because it is not physically in the ... DNS Server: 192.168.0.1 or your ISP's DNS server ...
    (microsoft.public.windowsxp.network_web)
  • Re: OT - Ned Help W/Outlook Express
    ... > Nate wrote: ... >> laptop and can get pop3 e-mails, in and out, right? ... In the dialog box that opens, click the Connections tab. ... a DNS server is also required for POP3 ...
    (rec.outdoors.rv-travel)
  • RWW Issue
    ... I have a small sbs network with 5 xp pro desktops all patched, ... I remote desktop into it. ... Remote connections might not be enabled or the computer might be too ... DNS server failed the update request. ...
    (microsoft.public.windows.server.sbs)
  • Re: Mystery getting localtime from C++ app.
    ... string current_date (const string & format) ... could cause the above to take ridiculously longer than ... connections to a PostgreSQL database server, ...
    (comp.os.linux.development.apps)

Loading