| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * pg_rusage.h |
| 4 | * header file for resource usage measurement support routines |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
| 8 | * Portions Copyright (c) 1994, Regents of the University of California |
| 9 | * |
| 10 | * src/include/utils/pg_rusage.h |
| 11 | * |
| 12 | *------------------------------------------------------------------------- |
| 13 | */ |
| 14 | #ifndef PG_RUSAGE_H |
| 15 | #define PG_RUSAGE_H |
| 16 | |
| 17 | #include <sys/time.h> |
| 18 | |
| 19 | #ifdef HAVE_SYS_RESOURCE_H |
| 20 | #include <sys/resource.h> |
| 21 | #else |
| 22 | #include "rusagestub.h" |
| 23 | #endif |
| 24 | |
| 25 | |
| 26 | /* State structure for pg_rusage_init/pg_rusage_show */ |
| 27 | typedef struct PGRUsage |
| 28 | { |
| 29 | struct timeval tv; |
| 30 | struct rusage ru; |
| 31 | } PGRUsage; |
| 32 | |
| 33 | |
| 34 | extern void pg_rusage_init(PGRUsage *ru0); |
| 35 | extern const char *pg_rusage_show(const PGRUsage *ru0); |
| 36 | |
| 37 | #endif /* PG_RUSAGE_H */ |
| 38 | |