summaryrefslogtreecommitdiffstats
path: root/gold/main.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-10-18 00:06:10 +0000
committerCary Coutant <ccoutant@google.com>2011-10-18 00:06:10 +0000
commitb490c0bbaf81fb741c6751eff30082883343e2ff (patch)
treefbfdd4a8a314245629467b77cc7fa4203fac6a23 /gold/main.cc
parent41835e6a39b581ab4f7fba25e02aba01e50a8521 (diff)
downloadppe42-binutils-b490c0bbaf81fb741c6751eff30082883343e2ff.tar.gz
ppe42-binutils-b490c0bbaf81fb741c6751eff30082883343e2ff.zip
* gold.cc: Include timer.h.
(queue_middle_tasks): Stamp time. (queue_final_tasks): Likewise. * main.cc (main): Store timer in parameters. Print timers for each pass. * parameters.cc (Parameters::Parameters): Initialize timer_. (Parameters::set_timer): New function. (set_parameters_timer): New function. * parameters.h (Parameters::set_timer): New function. (Parameters::timer): New function. (Parameters::timer_): New data member. (set_parameters_timer): New function. * timer.cc (Timer::stamp): New function. (Timer::get_pass_time): New function. * timer.h (Timer::stamp): New function. (Timer::get_pass_time): New function. (Timer::pass_times_): New data member.
Diffstat (limited to 'gold/main.cc')
-rw-r--r--gold/main.cc32
1 files changed, 30 insertions, 2 deletions
diff --git a/gold/main.cc b/gold/main.cc
index f6e7609eef..048454186f 100644
--- a/gold/main.cc
+++ b/gold/main.cc
@@ -165,7 +165,10 @@ main(int argc, char** argv)
Timer timer;
if (command_line.options().stats())
- timer.start();
+ {
+ timer.start();
+ set_parameters_timer(&timer);
+ }
// Store some options in the globally accessible parameters.
set_parameters_options(&command_line.options());
@@ -252,7 +255,32 @@ main(int argc, char** argv)
if (command_line.options().stats())
{
- Timer::TimeStats elapsed = timer.get_elapsed_time();
+ timer.stamp(2);
+ Timer::TimeStats elapsed = timer.get_pass_time(0);
+ fprintf(stderr,
+ _("%s: initial tasks 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.sys % 1000) * 1000,
+ elapsed.wall / 1000, (elapsed.wall % 1000) * 1000);
+ elapsed = timer.get_pass_time(1);
+ fprintf(stderr,
+ _("%s: middle tasks 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.sys % 1000) * 1000,
+ elapsed.wall / 1000, (elapsed.wall % 1000) * 1000);
+ elapsed = timer.get_pass_time(2);
+ fprintf(stderr,
+ _("%s: final tasks 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.sys % 1000) * 1000,
+ elapsed.wall / 1000, (elapsed.wall % 1000) * 1000);
+ elapsed = timer.get_elapsed_time();
fprintf(stderr,
_("%s: total run time: " \
"(user: %ld.%06ld sys: %ld.%06ld wall: %ld.%06ld)\n"),
OpenPOWER on IntegriCloud