summaryrefslogtreecommitdiff
path: root/tools/bench
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-05 07:58:46 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-05 07:58:46 +0000
commit4f804e9ae63866852f7e7524ded686f9747cbeb7 (patch)
tree4661da8bdb965247a138982f7fd39381f5491244 /tools/bench
parent0391c5a71fa548558a8f77c30d8323569daf11d2 (diff)
downloadmpfr-4f804e9ae63866852f7e7524ded686f9747cbeb7.tar.gz
mpfrbench: use clock() when getrusage() is not available
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9784 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tools/bench')
-rw-r--r--tools/bench/mpfrbench.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/bench/mpfrbench.c b/tools/bench/mpfrbench.c
index e1d07ca34..29e9bb58a 100644
--- a/tools/bench/mpfrbench.c
+++ b/tools/bench/mpfrbench.c
@@ -25,6 +25,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#ifdef HAVE_GETRUSAGE
#include <sys/time.h>
#include <sys/resource.h>
+#else
+#include <time.h>
#endif
#include "mpfr.h"
#include "benchtime.h"
@@ -115,9 +117,7 @@ get_cputime (void)
return ru.ru_utime.tv_sec * 1000000 + ru.ru_utime.tv_usec
+ ru.ru_stime.tv_sec * 1000000 + ru.ru_stime.tv_usec;
#else
- printf ("\nError, the function getrusage is not available\n");
- exit (1);
- return 0;
+ return (unsigned long) ((double) clock () / ((double) CLOCKS_PER_SEC / 1e6));
#endif
}