cpu-timers: high-resolution CPU clocks for POSIX clock_* syscalls
A message that is not in the archive (sent off-list or not yet received): 200412140355.iBE3t7KL008040@magilla.sf.frob.com.suse.lists.linux.kernel
Review
Quoted 11 lines · Roland McGrath
/*
+ * This is called on clock ticks and on context switches.
+ * Bank inp->sched_timethe ns elapsed since the last tick or switch.
+ */(quoted diff) +6
-0+static void update_cpu_clock(task_t *p, runqueue_t *rq, + unsigned long long now) +{ + unsigned long long last = max(p->timestamp, rq->timestamp_last_tick); + p->sched_time += now - last; +}
This will completely mess up the register allocation in schedule() long long on i386 forces basically everything else out onto the stack because it needs 4 aligned registers.
I suspect when you benchmark it it will become visibly slower.
In general it seems like a bad idea to polute the extremly critical fast paths in schedule with support for such an obscure operation. Is there really any real need for such a high resolution per process timer anyways? I have my doubts about it, I would suspect most apps are more interested in wall clock time.
I don't think this should be merged until a clear need from a useful application is demonstrated for it.
-Andi
Quoted 2 lines · Andi Kleen
I don't think this should be merged until a clear need from a useful application is demonstrated for it.
This is something which is requested countless times. Everybody doing development of sophisticated programs adds some kind of self monitoring. And there is of course profiling. The most widely used program which needs this is probably the JVM. Don't ask me for the specific class, but the JVM developers asked for these clocks in this form. Without the support available the Linux JVM is never going to reach par.
Quoted 8 lines · Ulrich Drepper
Quoted 2 lines · Andi Kleen
I don't think this should be merged until a clear need from a useful application is demonstrated for it.
This is something which is requested countless times. Everybody doing development of sophisticated programs adds some kind of self monitoring. And there is of course profiling. The most widely used
You mean statistical profiling? I don't see why you need a bigger resolution than HZ for that.
Quoted 3 lines
program which needs this is probably the JVM. Don't ask me for the specific class, but the JVM developers asked for these clocks in this form. Without the support available the Linux JVM is never going to
They didn't ask linux-kernel at least. Perhaps their requirements should be discussed here first before messing up all kinds of fast paths with dubious changes?
-Andi