Sad Clouds <cryintotheblue...@googlemail.com> wrote: > Well, quite often you need to call time function in a loop. For > example, you have a loop that accepts network packets, or connections > and every so often you need to have current system time. The resolution > of the timer can be specific to application, i.e. it could be seconds, > milliseconds, or microseconds.a > > uint64_t current_time; > while(1) > { > get_network_data(); > current_time = update_current_time(); > ... > use_current_time(); > } > > So in a tight loop, if update_current_time() calls clock_gettime() on > every loop iteration, what would kill performance.
The advantage of using something like a time() syscall is that it could allow the scheduler to give the CPU to another process. If you did implement a mmap()ed time interface, this would not happen and the process would loop in user space and thus be allowed to keep the CPU until the quantum is expired. Jörg -- EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin j...@cs.tu-berlin.de (uni) joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code