From d675ff4684242402af02908e431ed5e9fe045320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Thu, 17 Dec 2009 16:02:03 +0000 Subject: 2009-12-17 Rafael Avila de Espindola * Makefile.am (CCFILES): Add timer.cc. (HFILES): Add timer.h. * configure.ac: Check for sysconf and times. * main.cc: include timer.h. (main): Use Timer instead of get_run_time. * timer.cc: New. * timer.h: New. * workqueue.cc: include timer.h. (Workqueue::find_and_run_task): Report user, sys and wall time. * Makefile.in: Regenerate. * config.in: Regenerate. * configure: Regenerate. --- gold/main.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'gold/main.cc') diff --git a/gold/main.cc b/gold/main.cc index 66e8b24..c9d0d79 100644 --- a/gold/main.cc +++ b/gold/main.cc @@ -46,6 +46,7 @@ #include "gc.h" #include "icf.h" #include "incremental.h" +#include "timer.h" using namespace gold; @@ -161,9 +162,9 @@ main(int argc, char** argv) Command_line command_line; command_line.process(argc - 1, const_cast(argv + 1)); - long start_time = 0; + Timer timer; if (command_line.options().stats()) - start_time = get_run_time(); + timer.start(); // Store some options in the globally accessible parameters. set_parameters_options(&command_line.options()); @@ -247,9 +248,15 @@ main(int argc, char** argv) if (command_line.options().stats()) { - long run_time = get_run_time() - start_time; - fprintf(stderr, _("%s: total run time: %ld.%06ld seconds\n"), - program_name, run_time / 1000000, run_time % 1000000); + Timer::TimeStats elapsed = timer.get_elapsed_time(); + fprintf(stderr, + _("%s: total run time: " \ + "(user: %ld.%06ld sys: %ld.%06ld wall: %ld.%06ld)\n"), + program_name, + elapsed.user / 1000, (elapsed.user % 1000) * 1000, + elapsed.sys / 1000, (elapsed.user % 1000) * 1000, + elapsed.wall / 1000, (elapsed.wall % 1000) * 1000); + #ifdef HAVE_MALLINFO struct mallinfo m = mallinfo(); fprintf(stderr, _("%s: total space allocated by malloc: %d bytes\n"), -- cgit v1.1