e576bb | 2002-10-11 | Martin Nilsson | | |
e8adf5 | 2007-06-19 | Martin Stjernholm | | || $Id: pike_rusage.h,v 1.21 2007/06/19 18:22:50 mast Exp $
|
e576bb | 2002-10-11 | Martin Nilsson | | */
|
24ddc7 | 1998-03-28 | Henrik Grubbström (Grubba) | |
|
66bcf0 | 2002-12-07 | Henrik Grubbström (Grubba) | | #ifndef PIKE_RUSAGE_H
#define PIKE_RUSAGE_H
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | |
|
247f73 | 2007-06-10 | Martin Stjernholm | | #include "global.h"
#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
# define HAVE_POSIX_THREAD_GCT
# else
# 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
#define HAVE_POSIX_REALTIME_GRT
#define MIGHT_HAVE_POSIX_REALTIME_GRT
#endif /* _POSIX_TIMERS > 0 */
#endif /* _POSIX_TIMERS */
#ifdef CONFIGURE_TEST_FALLBACK_GCT
|
c994cd | 2007-06-11 | Martin Stjernholm | | # define cpu_time_is_thread_local -1
# define fallback_gct_impl get_cpu_time_impl
|
247f73 | 2007-06-10 | Martin Stjernholm | | # define fallback_gct get_cpu_time
|
c994cd | 2007-06-11 | Martin Stjernholm | | # define fallback_gct_res get_cpu_time_res
|
247f73 | 2007-06-10 | Martin Stjernholm | | # define GCT_IS_FALLBACK
#else
# 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 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 (MIGHT_HAVE_POSIX_THREAD_GCT)
# define GCT_RUNTIME_CHOICE
# 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
|
e8adf5 | 2007-06-19 | Martin Stjernholm | |
#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
|
247f73 | 2007-06-10 | Martin Stjernholm | | #endif /* !CONFIGURE_TEST_FALLBACK_GCT */
#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_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
|
fde6ed | 2003-11-27 | Martin Stjernholm | | #ifdef HAVE_TIMES
extern long pike_clk_tck;
#endif
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | |
|
5ef905 | 2003-01-13 | Martin Stjernholm | | typedef long pike_rusage_t[29];
|
247f73 | 2007-06-10 | Martin Stjernholm | | PMOD_EXPORT int pike_get_rusage(pike_rusage_t rusage_values);
|
5ef905 | 2003-01-13 | Martin Stjernholm | | long *low_rusage(void);
|
247f73 | 2007-06-10 | Martin Stjernholm | | * 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. */
|
5ef905 | 2003-01-13 | Martin Stjernholm | | #ifdef INT64
|
f70a53 | 2003-01-13 | Martin Stjernholm | |
|
616c2d | 2003-01-13 | Martin Stjernholm | | typedef INT64 cpu_time_t;
|
5ef905 | 2003-01-13 | Martin Stjernholm | | #define LONG_CPU_TIME
|
547880 | 2007-06-10 | Martin Stjernholm | | #define CPU_TIME_TICKS /* per second */ 1000000000LL
|
5ef905 | 2003-01-13 | Martin Stjernholm | | #define CPU_TIME_UNIT "ns"
|
50f449 | 2003-02-14 | Martin Stjernholm | | #define PRINT_CPU_TIME PRINTINT64 "d"
|
5ef905 | 2003-01-13 | Martin Stjernholm | | #else
typedef unsigned long cpu_time_t;
|
547880 | 2007-06-10 | Martin Stjernholm | | #define CPU_TIME_TICKS /* per second */ 1000
|
5ef905 | 2003-01-13 | Martin Stjernholm | | #define CPU_TIME_UNIT "ms"
|
50f449 | 2003-02-14 | Martin Stjernholm | | #define PRINT_CPU_TIME "lu"
|
5ef905 | 2003-01-13 | Martin Stjernholm | | #endif
|
247f73 | 2007-06-10 | Martin Stjernholm | |
#ifdef GCT_RUNTIME_CHOICE
|
e8adf5 | 2007-06-19 | Martin Stjernholm | | #ifndef cpu_time_is_thread_local
|
247f73 | 2007-06-10 | Martin Stjernholm | | PMOD_EXPORT extern int cpu_time_is_thread_local;
|
e8adf5 | 2007-06-19 | Martin Stjernholm | | #endif
|
247f73 | 2007-06-10 | Martin Stjernholm | | 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
|
5ef905 | 2003-01-13 | Martin Stjernholm | |
INT32 internal_rusage(void);
|
6a118c | 2002-09-13 | Martin Stjernholm | | #if defined(PIKE_DEBUG) || defined(INTERNAL_PROFILING)
void debug_print_rusage(FILE *out);
#endif
|
247f73 | 2007-06-10 | Martin Stjernholm | |
void init_rusage (void);
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | |
|
66bcf0 | 2002-12-07 | Henrik Grubbström (Grubba) | | #endif /* !PIKE_RUSAGE_H */
|