X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=libiberty%2Fgetruntime.c;h=f9f7841a743909405dcc00aaa906f963f4e98cba;hb=7d458ea516b58c98214406859d57965879019215;hp=82f3d2e41858852e19ec3ab9215a55c66fa103ad;hpb=979c05d32447bf9388479ed6ef8e5665b40e5763;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/getruntime.c b/libiberty/getruntime.c index 82f3d2e418..f9f7841a74 100644 --- a/libiberty/getruntime.c +++ b/libiberty/getruntime.c @@ -1,5 +1,5 @@ /* Return time used so far, in microseconds. - Copyright (C) 1994, 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1994-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -65,6 +65,10 @@ Boston, MA 02110-1301, USA. */ #define CLOCKS_PER_SEC 1 #endif +#ifndef RUSAGE_SELF +#define RUSAGE_SELF 0 +#endif + #ifdef _SC_CLK_TCK #define GNU_HZ sysconf(_SC_CLK_TCK) #else @@ -95,7 +99,7 @@ get_run_time (void) #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H) struct rusage rusage; - getrusage (0, &rusage); + getrusage (RUSAGE_SELF, &rusage); return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec); #else /* ! HAVE_GETRUSAGE */