|
From: | Erik Walthinsen |
Subject: | Re: [avr-chat] Tenfold acceleration of Simulavr is possible. |
Date: | Tue, 03 May 2005 21:06:26 -0700 |
User-agent: | Debian Thunderbird 1.0.2 (X11/20050331) |
Dmitry K. wrote:
I have try to clean body of function `get_program_time' (src/utils.c) -- by `return 0'.
This makes sense, as gettimeofday() in libc is a kernel syscall. A better, but more arch-specific method, would be to use the RDTSC instruction on x86 and counterparts on other architectures. Currently there is no good portable way of doing this, though I have code floating around that I really should package for that purpose specifically.
I'm rather surprised that glibc hasn't been patched to make use of the relevant instructions. RDTSC takes about 22 cycles on a PIII proc, possibly less on a P4 (haven't checked in a long time), and the 64-bit math necessary is probably not much more lengthy. Then again get_program_time is already performing the equivalent math anyway, a conversion would just involve different "constants".
However, I can see that a libc version would be complicated by threading, and would require TLS (Thread Local Storage) to work properly. Oh well.
I would assume that by bypassing get_program_time you lose some kind of functionality (haven't used simulavr myself yet), but I guess the physical simulation time really isn't important, compared to the measured *target* cycle times...
[Prev in Thread] | Current Thread | [Next in Thread] |