On 6/10/26 12:13, Helge Deller wrote:
+ if (clock_getres(CLOCK_REALTIME, &res) == -1) {
+ res.tv_nsec = 1;
+ }
+ freq_mhz = 1000.0 / res.tv_nsec;
Seems ok.
Yes. But it will allways print 1000.000MHz, which isn't that useful either.
Shall I keep it nevertheless?
Well, depends on the host, I suppose. Perhaps we can get away with omitting it, though I
suppose it all depends on why you're implementing /proc/cpuinfo in the first place.
I'll note that unlike "clock", "timebase" *is* used by glibc, but only if we don't
implement the __kernel_get_tbfreq vdso call. For linux-user, cpu_ppc_load_tbl() uses
cpu_get_host_ticks(). Ideally we'd report the host_ticks frequency for timebase, but we
don't have a function for that.
Perhaps we should switch cpu_ppc_load_tbl() to get_clock(), and then report timebase =
1GHz. That would certainly make the vdso implementation simple.
r~