e576bb2002-10-11Martin Nilsson /* || 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.
ae7da02004-05-19Henrik Grubbström (Grubba) || $Id: pike_rusage.h,v 1.17 2004/05/19 20:57:04 grubba Exp $
e576bb2002-10-11Martin Nilsson */
24ddc71998-03-28Henrik Grubbström (Grubba) 
66bcf02002-12-07Henrik Grubbström (Grubba) #ifndef PIKE_RUSAGE_H #define PIKE_RUSAGE_H
5267b71995-08-09Fredrik Hübinette (Hubbe) 
fde6ed2003-11-27Martin Stjernholm #ifdef HAVE_TIMES extern long pike_clk_tck; #define init_rusage() (pike_clk_tck = sysconf (_SC_CLK_TCK)) #else #define init_rusage() #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) /* Prototypes begin here */
5ef9052003-01-13Martin Stjernholm typedef long pike_rusage_t[29];
6a118c2002-09-13Martin Stjernholm int pike_get_rusage(pike_rusage_t rusage_values);
5ef9052003-01-13Martin Stjernholm long *low_rusage(void); /* get_cpu_time returns the consumed cpu time (both in kernel and user
dd25062003-02-09Martin Stjernholm  * space, if applicable), or -1 if it couldn't be read. Note that
f70a532003-01-13Martin Stjernholm  * many systems have fairly poor resolution, e.g. on Linux x86 it's * only 0.01 second. gettimeofday can therefore be a better choice to * measure small time intervals. */
5ef9052003-01-13Martin Stjernholm #ifdef INT64
f70a532003-01-13Martin Stjernholm /* The time is returned in nanoseconds. */
616c2d2003-01-13Martin Stjernholm typedef INT64 cpu_time_t;
5ef9052003-01-13Martin Stjernholm #define LONG_CPU_TIME #define CPU_TIME_TICKS /* per second */ ((cpu_time_t) 1000000000) #define CPU_TIME_UNIT "ns"
50f4492003-02-14Martin Stjernholm #define PRINT_CPU_TIME PRINTINT64 "d"
5ef9052003-01-13Martin Stjernholm #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 /* per second */ ((cpu_time_t) 1000) #define CPU_TIME_UNIT "ms"
50f4492003-02-14Martin Stjernholm #define PRINT_CPU_TIME "lu"
5ef9052003-01-13Martin Stjernholm #endif cpu_time_t get_cpu_time (void);
ae7da02004-05-19Henrik Grubbström (Grubba) cpu_time_t get_real_time(void);
5ef9052003-01-13Martin Stjernholm  INT32 internal_rusage(void); /* For compatibility. */
6a118c2002-09-13Martin Stjernholm #if defined(PIKE_DEBUG) || defined(INTERNAL_PROFILING) void debug_print_rusage(FILE *out); #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) /* Prototypes end here */
66bcf02002-12-07Henrik Grubbström (Grubba) #endif /* !PIKE_RUSAGE_H */