Nanosecond timestamps for ev_stat

Marc Lehmann schmorp at schmorp.de
Wed May 13 05:34:07 CEST 2015


On Tue, May 12, 2015 at 05:59:33PM +0300, Roman Tsisyk <roman at tarantool.org> wrote:
> I made a patch to add support for nanosecond timestamps in ev_stat.
> Please review and consider to merge.

Hi, thanks for the patch, but I am afraid it isn't so simple.

While providing nanosecond resulitioon if possible is one of our goals, too,
we haven't found a way to make it possible.

Simply making the ev_stat internal test a bit more sensitive without being
able to tell the user of ev_stat does not allow the libev user to make active
use of this feature - the user still has to assumer there is only the
standard one second resolution, both because that might be the actual
filesystem resolution, and libev might not have tested this at all.

To put it differently - the libev user has to cope with one second
resolution, whether libev was compiled to compare nanoseconds or not.

There are other problems, for example, on GNU/Linux for some inexplicable
reason only has a 32 bit struct stat by default, when basically everybody
else supports 64 bit, which makes libev incompatible to programs compiled
in the nonstandard (on gnu/linux) lfs environnment.

I think the only workable solution is to replace the rather fuzzy struct
stat by some ev_stat struct that has ev_stamp members for the times, in
which higher resolution timestamps could be stored, and/or always provide
the full nanosecond resolution, independent of compilatzion environment
and compilation method.

Also, the detection for the struct member availability should work without
autoconf, at least in most cases, and there would need to be a way to signal
this to the libev users.

We have though long and hard about this problem, but haven't found a good
solution (one that allows libev users to actively take advantage of the
extra resolution).

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list