Mercurial > hg > CbC > CbC_gcc
comparison libiberty/getruntime.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | a06113de4d67 |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Return time used so far, in microseconds. | 1 /* Return time used so far, in microseconds. |
2 Copyright (C) 1994, 1999, 2002 Free Software Foundation, Inc. | 2 Copyright (C) 1994-2017 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of the libiberty library. | 4 This file is part of the libiberty library. |
5 Libiberty is free software; you can redistribute it and/or | 5 Libiberty is free software; you can redistribute it and/or |
6 modify it under the terms of the GNU Library General Public | 6 modify it under the terms of the GNU Library General Public |
7 License as published by the Free Software Foundation; either | 7 License as published by the Free Software Foundation; either |
63 | 63 |
64 #ifndef CLOCKS_PER_SEC | 64 #ifndef CLOCKS_PER_SEC |
65 #define CLOCKS_PER_SEC 1 | 65 #define CLOCKS_PER_SEC 1 |
66 #endif | 66 #endif |
67 | 67 |
68 #ifndef RUSAGE_SELF | |
69 #define RUSAGE_SELF 0 | |
70 #endif | |
71 | |
68 #ifdef _SC_CLK_TCK | 72 #ifdef _SC_CLK_TCK |
69 #define GNU_HZ sysconf(_SC_CLK_TCK) | 73 #define GNU_HZ sysconf(_SC_CLK_TCK) |
70 #else | 74 #else |
71 #ifdef HZ | 75 #ifdef HZ |
72 #define GNU_HZ HZ | 76 #define GNU_HZ HZ |
93 get_run_time (void) | 97 get_run_time (void) |
94 { | 98 { |
95 #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H) | 99 #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H) |
96 struct rusage rusage; | 100 struct rusage rusage; |
97 | 101 |
98 getrusage (0, &rusage); | 102 getrusage (RUSAGE_SELF, &rusage); |
99 return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec | 103 return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec |
100 + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec); | 104 + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec); |
101 #else /* ! HAVE_GETRUSAGE */ | 105 #else /* ! HAVE_GETRUSAGE */ |
102 #ifdef HAVE_TIMES | 106 #ifdef HAVE_TIMES |
103 struct tms tms; | 107 struct tms tms; |