diff options
author | Rafael Ávila de Espíndola <respindola@mozilla.com> | 2009-12-17 16:02:03 +0000 |
---|---|---|
committer | Rafael Ávila de Espíndola <respindola@mozilla.com> | 2009-12-17 16:02:03 +0000 |
commit | d675ff4684242402af02908e431ed5e9fe045320 (patch) | |
tree | 45bfbe1903cf6096bd6e80327625852653480829 /gold/main.cc | |
parent | ff4a8d2b939133ea12e8994ff1f83d3a8e17baa2 (diff) | |
download | gdb-d675ff4684242402af02908e431ed5e9fe045320.zip gdb-d675ff4684242402af02908e431ed5e9fe045320.tar.gz gdb-d675ff4684242402af02908e431ed5e9fe045320.tar.bz2 |
2009-12-17 Rafael Avila de Espindola <espindola@google.com>
* 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.
Diffstat (limited to 'gold/main.cc')
-rw-r--r-- | gold/main.cc | 17 |
1 files changed, 12 insertions, 5 deletions
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<const char**>(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"), |