| 1 | /* Return time used so far, in microseconds.
|
|---|
| 2 | Copyright (C) 1994, 1999, 2002 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of the libiberty library.
|
|---|
| 5 | Libiberty is free software; you can redistribute it and/or
|
|---|
| 6 | modify it under the terms of the GNU Library General Public
|
|---|
| 7 | License as published by the Free Software Foundation; either
|
|---|
| 8 | version 2 of the License, or (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | Libiberty 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 | Library General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU Library General Public
|
|---|
| 16 | License along with libiberty; see the file COPYING.LIB. If
|
|---|
| 17 | not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|---|
| 18 | Boston, MA 02111-1307, USA. */
|
|---|
| 19 |
|
|---|
| 20 | #include "config.h"
|
|---|
| 21 |
|
|---|
| 22 | #include "ansidecl.h"
|
|---|
| 23 | #include "libiberty.h"
|
|---|
| 24 |
|
|---|
| 25 | /* On some systems (such as WindISS), you must include <sys/types.h>
|
|---|
| 26 | to get the definition of "time_t" before you include <time.h>. */
|
|---|
| 27 | #include <sys/types.h>
|
|---|
| 28 |
|
|---|
| 29 | /* There are several ways to get elapsed execution time; unfortunately no
|
|---|
| 30 | single way is available for all host systems, nor are there reliable
|
|---|
| 31 | ways to find out which way is correct for a given host. */
|
|---|
| 32 |
|
|---|
| 33 | #ifdef TIME_WITH_SYS_TIME
|
|---|
| 34 | # include <sys/time.h>
|
|---|
| 35 | # include <time.h>
|
|---|
| 36 | #else
|
|---|
| 37 | # if HAVE_SYS_TIME_H
|
|---|
| 38 | # include <sys/time.h>
|
|---|
| 39 | # else
|
|---|
| 40 | # ifdef HAVE_TIME_H
|
|---|
| 41 | # include <time.h>
|
|---|
| 42 | # endif
|
|---|
| 43 | # endif
|
|---|
| 44 | #endif
|
|---|
| 45 |
|
|---|
| 46 | #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
|
|---|
| 47 | #include <sys/resource.h>
|
|---|
| 48 | #endif
|
|---|
| 49 |
|
|---|
| 50 | #ifdef HAVE_TIMES
|
|---|
| 51 | #ifdef HAVE_SYS_PARAM_H
|
|---|
| 52 | #include <sys/param.h>
|
|---|
|
|---|