[rsyslog] high-performance, low-precision time API under linux?
Aaron Wiebe
epiphani at gmail.com
Mon Jun 15 17:32:13 CEST 2009
I went over your post...
You shouldn't be seeing a 4ms response time on a gettimeofday() call -
this is my test:
gettimeofday({1245079355, 445434}, NULL) = 0 <0.000004>
gettimeofday({1245079355, 445503}, NULL) = 0 <0.000004>
gettimeofday({1245079355, 445560}, NULL) = 0 <0.000003>
gettimeofday({1245079355, 445629}, NULL) = 0 <0.000004>
That's 3-4 microseconds.
For the sake of argument, I checked time() as well, which is obsoleted
by gettimeofday()...
ime(NULL) = 1245079501 <0.000008>
time(NULL) = 1245079501 <0.000007>
time(NULL) = 1245079501 <0.000004>
time(NULL) = 1245079501 <0.000008>
time(NULL) = 1245079501 <0.000004>
About half the speed, but still in the microsecond range.
gettimeofday() is one of the fastest syscalls you can issue.
Obviously you don't want to beat on it, but I wouldn't worry about
calling it a few dozen times per second.
-Aaron
More information about the rsyslog
mailing list