/-----------------------------------------------------------------------------\
| Tony Denault | Internet: [EMAIL PROTECTED] |
| NASA IRTF, Institute of Astronomy | Phone: (808) 974-4206 |
| 1175 Manono St., Bldg 393 | Fax: (808) 974-4207 |
| Hilo, Hawaii 96720 | |
\-----------------------------------------------------------------------------/
On Wed, 23 Jan 2002, Pablo Alvarez wrote:
> Hi all,
>
> When I try to do an integer division of an hrtime_t variable within the
> kernel, I get the following error upon inserting the module:
>
> my_module.o: unresolved symbol __divdi3
> make: *** [test] Error 1
>
> As best I can tell, __divdi3 is called by the compiler to do that division,
> and is not available within the kernel (actually, it is available from the
> NVdriver module for my nvidia graphics card, but that leads to other
> problems).
>
> Does anybody know of a way to avoid using this function, or to make this
> function available in the kernel, or am I stuck multiplying by 0.0000001?
>
I had this problem. I worked around it by not using 64 bit type in my
division:
hrtime_t start_time;
hrtime_t end_time;
long usec;
long divisor = 1000; // nano to micro
start_time = gethrtime();
my_hardworking_function();
end_time = gethrtime();
usec = end_time - start_time; // store difference in 32-bit variable.
usec /= divisor; // 32-bit division
Of course, I just needed to measure how long it took my code to run.
And since my code needed to be fast the (end-start) never exceeded the
the 32-bit value. Using long give you (I think about 2 sec) in hrtime_r
resolution.
Hopefully this will work for you... otherwise you may need to find
64 bit math libs. If you don't one suggestion is to look for the idiv
source code in the glib...maybe it might be a inline function in the
header file?
Tony
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/