Hi, On 2014-05-13 18:58:11 -0400, Tom Lane wrote: > Anyway it looks like clock_gettime() might be worth using on Linux > just for the more precise output. It doesn't seem to exist on OS X > though, and I have no idea about elsewhere.
Agreed that using clock_gettime() would be a good idea. I'd say we should have a wrapper around it that is able to provide nanosecond precision. If only gettimeofday() (and whatever windows is using) is available, we can dynamically fall back to that. > I'm curious if anybody has ideas about other things we might do for > portable high-precision timing. It's far from a solve-it-all, but can we perhaps try to coalesce repeated time measurements? We'll very frequently do a InstrStopNode(); /* minimal amount of work */ InstrStartNode(); which will measure the time twice. I think there's a fair number of scenarios where once would be enough. I'll freely admit that I haven't looked enough to determine how we could do that API wise. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers