This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: How to convert time tick to real time
- To: 'David Geng' <deli dot geng at ncl dot ac dot uk>, ecos-discuss at sourceware dot cygnus dot com
- Subject: RE: [ECOS] How to convert time tick to real time
- From: Fabrice Gautier <Fabrice_Gautier at sdesigns dot com>
- Date: Fri, 3 Nov 2000 14:36:02 -0800
> -----Original Message-----
> From: David Geng [mailto:deli.geng@ncl.ac.uk]
> Sent: Friday, November 03, 2000 1:04 PM
> To: ecos-discuss@sourceware.cygnus.com
> Subject: [ECOS] How to convert time tick to real time
>
>
> Hi,
>
> I'd like to know the time consumed in running certain code,
> in order to
> compare different platform as well as profile this code. I
> used clock() and
> cyg_current_time() to get the differential time. On my 133MHz
> SA1100 board
> the result is 29986 and 1794 respectively, while 2726 and 1001 on i386
> platform with 6x86CPU of 266MHz.
>
> But, that is only system time, i.e., timer ticks passed. How
> can I convert
> it to real-time, such as second. I think there should be some system
> constant containing how many timer ticks within one second,
> or something
> like this. I can not find it, could any one help me?
You can do it using the resolution of the real-time clock.
By the way, there is already some conversion functions in C++ in the kernel.
And I send a patch about a week ago to add a C API of this functions.
RedHat guys, have you considered this patch for inclusion in your sources?
Regards,
--
Fabrice Gautier
fabrice_gautier@sdesigns.com