High Resolution Timer

While working for at Persistent Systems Pvt. Ltd., Pune, we developed a small library with Java and C++ wrappers to implement very high resolution timers. We use these timers to count the ticks when doing performance analysis and stuff like that. I would like to thank Nikhil Deshpande and Chandraprakash Jain, my seniors at work, in helping me out while I was working on this tool. Infact, the java wrapper for this library is a contribution from Nikhil.

The library I developed exploited the system dependent timers / clocks and provided a timer like interface to the same. The library, compiles and functions on Linux, Solaris and Windows. The attached file, has build scripts for Linux and Solaris. There is also a Java wrapper over the library, which uses JNI to use the timer interfaces.

My observation is that while Linux system timers allow a resolution to count till microseconds, a Solaris box can provide resolution to nanosecond levels.

The code is pretty dirty when it comes to system specific decisions, but provides a clean interface - complete with error message details, error handling, easy to use functions, extensible and customizable design.

The ReadMe.txt file, explains some of the stuff that I've done. Click here to read the file, without having to download the entire code. The library is LGPL licensed - you are free to use, redistribute and modify the same to suit your requirement, as long as you confirm the license agreement.

Click on the links below to download the source code for the high resolution timer library :

freshclam: "Problem with internal logger"

I had a happily running server with clam-av-0.88 (Clam Antivirus version 0.88). Suddenly, I started getting cron messages, regarding "freshclam-sleep" spitting out an error message "ERROR: problem with internal logger".

After a bit of searching, our first hit was that there was a permission issue. However, that was not the case for me.

The solution finally was that I had to restart the freshclam daemon. From the commmand :

ps aux | grep clam

I realised that there was a stray freshclam-sleep process runing. The oputput looked like this :

qscand 2056 0.0 0.9 81384 38820 ? Ss 2006 20:13 /usr/sbin/clamd
qscand 2064 0.0 0.0 2548 1072 ? Ss 2006 0:01 /usr/bin/freshclam -d -p /var/run/clamav/freshclam.pid
root 1454 0.0 0.0 2260 936 ? Ss Mar28 0:00 /bin/bash /usr/share/clamav/freshclam-sleep
qscand 12425 0.0 0.0 2544 1004 ? S Mar28 0:00 /usr/bin/freshclam --quiet
root 17913 0.0 0.0 3860 668 pts/0 S+ 05:30 0:00 grep clam

I just killed all the freshclam processes, deleted the lock file for freshclam and started the daemon with

/sbin/service freshclam start

and voila everything started working like a champ!!!

That was pretty much it....
Hope that helps.