|
Packit Service |
562438 |
/* High precision, low overhead timing functions. i686 version.
|
|
Packit Service |
562438 |
Copyright (C) 1998-2018 Free Software Foundation, Inc.
|
|
Packit Service |
562438 |
This file is part of the GNU C Library.
|
|
Packit Service |
562438 |
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
562438 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
562438 |
License as published by the Free Software Foundation; either
|
|
Packit Service |
562438 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
562438 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
562438 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
562438 |
Lesser General Public License for more details.
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
562438 |
License along with the GNU C Library; if not, see
|
|
Packit Service |
562438 |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
#ifndef _HP_TIMING_H
|
|
Packit Service |
562438 |
#define _HP_TIMING_H 1
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
/* We always assume having the timestamp register. */
|
|
Packit Service |
562438 |
#define HP_TIMING_AVAIL (1)
|
|
Packit Service |
562438 |
#define HP_SMALL_TIMING_AVAIL (1)
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
/* We indeed have inlined functions. */
|
|
Packit Service |
562438 |
#define HP_TIMING_INLINE (1)
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
/* We use 64bit values for the times. */
|
|
Packit Service |
562438 |
typedef unsigned long long int hp_timing_t;
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
/* That's quite simple. Use the `rdtsc' instruction. Note that the value
|
|
Packit Service |
562438 |
might not be 100% accurate since there might be some more instructions
|
|
Packit Service |
562438 |
running in this moment. This could be changed by using a barrier like
|
|
Packit Service |
562438 |
'cpuid' right before the `rdtsc' instruciton. But we are not interested
|
|
Packit Service |
562438 |
in accurate clock cycles here so we don't do this. */
|
|
Packit Service |
562438 |
#define HP_TIMING_NOW(Var) __asm__ __volatile__ ("rdtsc" : "=A" (Var))
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
#include <hp-timing-common.h>
|
|
Packit Service |
562438 |
|
|
Packit Service |
562438 |
#endif /* hp-timing.h */
|