Hello.. > I want very accurate timing inside my app. That means, my process > will ask for it's exact age at various times. How about using rdtsc()? that will fetch "timestamp" for Time Stamp Counter and AFAIK that is a high precision timer. Another option is by fetching value from HPET but I don't know the related function to fetch the value... do rdtsc() on the very beginning of your program, save it inside a variable (maybe with type "long long") and at another time you wish, do another rdstc() and you will get the age by substracting current rdtsc() with "born". But this means, it includes the time time it stays out of the run queue ( in other word, not scheduled in) >This age should not > include times when some other process was scheduled, but it should > include the overhead of the timing itself, which gets done by my > process. Let me clear this up...you mean, the time accounting you need is strictly the time slice spent your process only, am I right? If yes, maybe you need to take a look on how "getrusage" libc is implemented by the related kernel system call. But from what I read, getrusage() returns time spent by process in microseconds precision. Is that enough? > I think that poking about in /proc would be too slow, but I bet the > kernel knows how many jiffies my process has had, and if I could yes, kernel is doing timekeeping of every running process.... see scheduler_tick()...But (again), another problem is scheduler_tick is called on every 1/HZ interval. That means, on HZ=1000, it is called every 1 mili second. Is that enough for you? BTW, you said "a VM hosting zillion of script"? this VM..is it Xen? UML? or do you create your own VM? A timer to terminate greedy script? do you want to this in kernel space or user space? For kernel space, take a look at setitimer(), for kernel space, see init_timer(), add_timer() and the gangs. For complete explanation, read Linux Driver Driver 3rd edition. I might give wrong hints, so please CMIIW regards Mulyadi -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/