[PATCH] Let RTEMS provide clock()

Corinna Vinschen vinschen@redhat.com
Wed Sep 6 13:56:00 GMT 2017


Hi Sebastian,

On Sep  6 08:58, Sebastian Huber wrote:
> Newlib uses _times_r() in clock().  The problem is that the _times_r()
> clock frequency is defined by sysconf(_SC_CLK_TCK).  The clock frequency
> of clock() is the constant CLOCKS_PER_SEC.
> 
> FreeBSD uses getrusage() for clock().  Since RTEMS has only one process,
> the implementation can be simplified.
> 
> Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
> ---
>  newlib/configure.host | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/newlib/configure.host b/newlib/configure.host
> index 3d967a11b..ba2d8c6c7 100644
> --- a/newlib/configure.host
> +++ b/newlib/configure.host
> @@ -605,7 +605,7 @@ case "${host}" in
>  	default_newlib_io_long_long="yes"
>  	default_newlib_io_c99_formats="yes"
>  	newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
> -	newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
> +	newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
>          # turn off unsupported items in posix directory 
>  	newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN"
>          # turn off using cli/sti in i386 setjmp/longjmp
> -- 
> 2.12.3

I see what you're doing and it's ok to push.

I just don't quite understand.  Is sysconf(_SC_CLK_TCK) different
from CLOCKS_PER_SEC on RTEMS?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20170906/cee0a9db/attachment.sig>


More information about the Newlib mailing list