This file is indexed.

/usr/include/pike8.0/pike/pike_rusage.h is in pike8.0-dev 8.0.164-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
*/

#ifndef PIKE_RUSAGE_H
#define PIKE_RUSAGE_H

#include "global.h"

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif

#if defined (_POSIX_TIMERS)
#if _POSIX_TIMERS > 0

#ifdef _POSIX_THREAD_CPUTIME
#  if _POSIX_THREAD_CPUTIME != -1
#    if _POSIX_THREAD_CPUTIME != 0
/*     Know it to be available at compile time. */
#      define HAVE_POSIX_THREAD_GCT
#    else
/*     Might be available at run time - have to check with sysconf(3). */
#    endif
#    define MIGHT_HAVE_POSIX_THREAD_GCT
#  endif
#endif

#ifdef _POSIX_CPUTIME
#  if _POSIX_CPUTIME != -1
#    if _POSIX_CPUTIME != 0
#      define HAVE_POSIX_PROCESS_GCT
#    endif
#    define MIGHT_HAVE_POSIX_PROCESS_GCT
#  endif
#endif

#ifdef _POSIX_MONOTONIC_CLOCK
#  if _POSIX_MONOTONIC_CLOCK != -1
#    if _POSIX_MONOTONIC_CLOCK != 0
#      define HAVE_POSIX_MONOTONIC_GRT
#    endif
#    define MIGHT_HAVE_POSIX_MONOTONIC_GRT
#  endif
#endif

/* The POSIX CLOCK_REALTIME clock is guaranteed to exist if
 * _POSIX_TIMERS exist. */
#define HAVE_POSIX_REALTIME_GRT
#define MIGHT_HAVE_POSIX_REALTIME_GRT

#endif	/* _POSIX_TIMERS > 0 */
#endif	/* _POSIX_TIMERS */

#ifdef CONFIGURE_TEST_FALLBACK_GCT
/* In the configure test that tries to figure out whether the fallback
 * get_cpu_time is thread local or not. */
#  define cpu_time_is_thread_local -1
#  define fallback_gct_impl get_cpu_time_impl
#  define fallback_gct get_cpu_time
#  define fallback_gct_res get_cpu_time_res
#  define GCT_IS_FALLBACK
#else

/* Choose get_cpu_time implementation. Prefer one with thread local time. */
#  ifdef HAVE_POSIX_THREAD_GCT
#    define cpu_time_is_thread_local 1
#    define posix_thread_gct_impl get_cpu_time_impl
#    define posix_thread_gct get_cpu_time
#    define posix_thread_gct_res get_cpu_time_res
#    define GCT_IS_POSIX_THREAD
#  elif defined (MIGHT_HAVE_POSIX_THREAD_GCT)
#    define GCT_RUNTIME_CHOICE
#  elif FB_CPU_TIME_IS_THREAD_LOCAL == PIKE_YES
#    define cpu_time_is_thread_local 1
#    define fallback_gct_impl get_cpu_time_impl
#    define fallback_gct get_cpu_time
#    define fallback_gct_res get_cpu_time_res
#    define GCT_IS_FALLBACK
#  elif defined (HAVE_POSIX_PROCESS_GCT)
#    define cpu_time_is_thread_local 0
#    define posix_process_gct_impl get_cpu_time_impl
#    define posix_process_gct get_cpu_time
#    define posix_process_gct_res get_cpu_time_res
#    define GCT_IS_POSIX_PROCESS
#  elif defined (MIGHT_HAVE_POSIX_PROCESS_GCT)
#    define GCT_RUNTIME_CHOICE
#  else
#    define cpu_time_is_thread_local 0
#    define fallback_gct_impl get_cpu_time_impl
#    define fallback_gct get_cpu_time
#    define fallback_gct_res get_cpu_time_res
#    define GCT_IS_FALLBACK
#  endif

#ifdef GCT_RUNTIME_CHOICE
#  define CPU_TIME_MIGHT_BE_THREAD_LOCAL
#  define CPU_TIME_MIGHT_NOT_BE_THREAD_LOCAL
#elif cpu_time_is_thread_local == 1
#  define CPU_TIME_MIGHT_BE_THREAD_LOCAL
#else
#  define CPU_TIME_MIGHT_NOT_BE_THREAD_LOCAL
#endif

/* Always consider cpu time as not thread local if we're compiling
 * without thread support. */
#ifndef PIKE_THREADS
#  undef cpu_time_is_thread_local
#  define cpu_time_is_thread_local 0
#  undef CPU_TIME_MIGHT_BE_THREAD_LOCAL
#  ifndef CPU_TIME_MIGHT_NOT_BE_THREAD_LOCAL
#    define CPU_TIME_MIGHT_NOT_BE_THREAD_LOCAL
#  endif
#endif

#endif	/* !CONFIGURE_TEST_FALLBACK_GCT */

/* Choose get_real_time implementation. Prefer one that isn't affected
 * by wall clock adjustments. */
#ifdef HAVE_POSIX_MONOTONIC_GRT
#  define real_time_is_monotonic 1
#  define posix_monotonic_grt_impl get_real_time_impl
#  define posix_monotonic_grt get_real_time
#  define posix_monotonic_grt_res get_real_time_res
#  define GRT_IS_POSIX_MONOTONIC
#elif defined (MIGHT_HAVE_POSIX_MONOTONIC_GRT)
#  define GRT_RUNTIME_CHOICE
#elif defined (HAVE_HOST_GET_CLOCK_SERVICE)
/* Define this to avoid special cases in init_rusage. */
#  define GRT_RUNTIME_CHOICE
#elif defined (HAVE_POSIX_REALTIME_GRT)
#  define real_time_is_monotonic 0
#  define posix_realtime_grt_impl get_real_time_impl
#  define posix_realtime_grt get_real_time
#  define posix_realtime_grt_res get_real_time_res
#  define GRT_IS_POSIX_REALTIME
#else
#  define fallback_grt_is_monotonic real_time_is_monotonic
#  define fallback_grt_impl get_real_time_impl
#  define fallback_grt get_real_time
#  define fallback_grt_res get_real_time_res
#  define GRT_IS_FALLBACK
#endif

#ifdef HAVE_TIMES
extern long pike_clk_tck;
#endif

/* Prototypes begin here */
typedef long pike_rusage_t[29];
PMOD_EXPORT int pike_get_rusage(pike_rusage_t rusage_values);
long *low_rusage(void);

/* get_cpu_time returns the consumed cpu time (both in kernel and user
 * space, if applicable), or -1 if it couldn't be read. Note that many
 * systems have fairly poor resolution. gettimeofday can therefore be
 * a better choice to measure small time intervals. */
#ifdef INT64
/* The time is returned in nanoseconds. */
typedef INT64 cpu_time_t;
#define LONG_CPU_TIME
#define CPU_TIME_TICKS_LOW /* per second */ (1000000000L)
#define CPU_TIME_UNIT "ns"
#define PRINT_CPU_TIME PRINTINT64 "d"
#else
/* The time is returned in milliseconds. (Note that the value will
 * wrap after about 49 days.) */
typedef unsigned long cpu_time_t;
#define CPU_TIME_TICKS_LOW /* per second */ 1000
#define CPU_TIME_UNIT "ms"
#define PRINT_CPU_TIME "lu"
#endif
#define CPU_TIME_TICKS /* per second */ ((cpu_time_t)CPU_TIME_TICKS_LOW)

#ifdef GCT_RUNTIME_CHOICE
#ifndef cpu_time_is_thread_local
PMOD_EXPORT extern int cpu_time_is_thread_local;
#endif
PMOD_EXPORT extern const char *get_cpu_time_impl;
PMOD_EXPORT extern cpu_time_t (*get_cpu_time) (void);
PMOD_EXPORT extern cpu_time_t (*get_cpu_time_res) (void);
#else
PMOD_EXPORT extern const char get_cpu_time_impl[];
PMOD_EXPORT cpu_time_t get_cpu_time (void);
PMOD_EXPORT cpu_time_t get_cpu_time_res (void);
#endif

#ifdef GRT_RUNTIME_CHOICE
PMOD_EXPORT extern int real_time_is_monotonic;
PMOD_EXPORT extern const char *get_real_time_impl;
PMOD_EXPORT extern cpu_time_t (*get_real_time) (void);
PMOD_EXPORT extern cpu_time_t (*get_real_time_res) (void);
#else
#ifdef GRT_IS_FALLBACK
PMOD_EXPORT extern int real_time_is_monotonic;
#endif
PMOD_EXPORT extern const char get_real_time_impl[];
PMOD_EXPORT cpu_time_t get_real_time(void);
PMOD_EXPORT cpu_time_t get_real_time_res (void);
#endif

INT32 internal_rusage(void);	/* For compatibility. */

#if defined(PIKE_DEBUG) || defined(INTERNAL_PROFILING)
void debug_print_rusage(FILE *out);
#endif

void init_rusage (void);
/* Prototypes end here */

#endif /* !PIKE_RUSAGE_H */