Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / powerpc / powerpc32 / hp-timing.h
blob9ff52eb1f08de1f44cb926cdb5109749cc265329
1 /* High precision, low overhead timing functions. Linux/PPC32 version.
2 Copyright (C) 2005-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _HP_TIMING_H
20 #define _HP_TIMING_H 1
23 /* There are no generic definitions for the times. We could write something
24 using the `gettimeofday' system call where available but the overhead of
25 the system call might be too high.
27 In case a platform supports timers in the hardware the following macros
28 and types must be defined:
30 - HP_TIMING_AVAIL: test for availability.
32 - HP_TIMING_INLINE: this macro is non-zero if the functionality is not
33 implemented using function calls but instead uses some inlined code
34 which might simply consist of a few assembler instructions. We have to
35 know this since we might want to use the macros here in places where we
36 cannot make function calls.
38 - hp_timing_t: This is the type for variables used to store the time
39 values.
41 - HP_TIMING_ZERO: clear `hp_timing_t' object.
43 - HP_TIMING_NOW: place timestamp for current time in variable given as
44 parameter.
46 - HP_TIMING_DIFF_INIT: do whatever is necessary to be able to use the
47 HP_TIMING_DIFF macro.
49 - HP_TIMING_DIFF: compute difference between two times and store it
50 in a third. Source and destination might overlap.
52 - HP_TIMING_ACCUM: add time difference to another variable. This might
53 be a bit more complicated to implement for some platforms as the
54 operation should be thread-safe and 64bit arithmetic on 32bit platforms
55 is not.
57 - HP_TIMING_ACCUM_NT: this is the variant for situations where we know
58 there are no threads involved.
60 - HP_TIMING_PRINT: write decimal representation of the timing value into
61 the given string. This operation need not be inline even though
62 HP_TIMING_INLINE is specified.
66 /* Provide dummy definitions. */
67 #define HP_TIMING_AVAIL (0)
68 #define HP_TIMING_INLINE (0)
69 typedef unsigned long long int hp_timing_t;
70 #define HP_TIMING_ZERO(Var)
71 #define HP_TIMING_NOW(var)
72 #define HP_TIMING_DIFF_INIT()
73 #define HP_TIMING_DIFF(Diff, Start, End)
74 #define HP_TIMING_ACCUM(Sum, Diff)
75 #define HP_TIMING_ACCUM_NT(Sum, Diff)
76 #define HP_TIMING_PRINT(Buf, Len, Val)
78 /* Since this implementation is not available we tell the user about it. */
79 #define HP_TIMING_NONAVAIL 1
81 #endif /* hp-timing.h */