[PATCH] PowerPC - Add a faster way to read the Time Base register

Ryan S. Arnold ryan.arnold@gmail.com
Tue Feb 14 17:49:00 GMT 2012


On Tue, Feb 14, 2012 at 9:30 AM, Tulio Magno Quites Machado Filho
<tuliom@linux.vnet.ibm.com> wrote:
...
> diff --git a/sysdeps/unix/sysv/linux/powerpc/test-gettimebase.c b/sysdeps/unix/sysv/linux/powerpc/test-gettimebase.c
> new file mode 100644
> index 0000000..cb18aab
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/test-gettimebase.c
> @@ -0,0 +1,35 @@
> +/* Copyright (C) 2012 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +   Contributed by Tulio Magno Quites Machado <tuliom@linux.vnet.ibm.com>, 2012.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, write to the Free
> +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> +   02111-1307 USA.  */
> +
> +/* Test if __PPC_GETTIMEBASE() is compatible with the current processor */
> +
> +#include <stdio.h>
> +
> +#include <sys/user.h>
> +
> +static int
> +do_test(void)
> +{
> +  __ppc_timebase tb = __PPC_GETTIMEBASE();
> +  printf("Time Base = %llx\n", tb);
> +  return 0;
> +}
> +
> +#define TEST_FUNCTION do_test ()
> +#include "../test-skeleton.c"

Given a closer look:

You need a space between __PPC_GETTIMEBASE and the parenthesis.

Likewise, you need a space between printf and the parenthesis.

Ryan



More information about the Libc-alpha mailing list