This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gold patch] Add timers for each pass


Cary Coutant <ccoutant@google.com> writes:

> 	* gold/gold.cc: Include timer.h.
> 	(queue_middle_tasks): Stamp time.
> 	(queue_final_tasks): Likewise.
> 	* gold/main.cc (main): Store timer in parameters.  Print timers
> 	for each pass.
> 	* gold/parameters.cc (Parameters::Parameters): Initialize timer_.
> 	(Parameters::set_timer): New function.
> 	(set_parameters_timer): New function.
> 	* gold/parameters.h (Parameters::set_timer): New function.
> 	(Parameters::timer): New function.
> 	(Parameters::timer_): New data member.
> 	(set_parameters_timer): New function.
> 	* gold/timer.cc (Timer::stamp): New function.
> 	(Timer::get_pass_time): New function.
> 	* gold/timer.h (Timer::stamp): New function.
> 	(Timer::get_pass_time): New function.
> 	(Timer::pass_times_): New data member.


> -      Timer::TimeStats elapsed = timer.get_elapsed_time();
> +      timer.stamp(2);
> +      Timer::TimeStats elapsed = timer.get_pass_time(0);
> +      fprintf(stderr,
> +             _("%s: pass 1 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: pass 2 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: pass 3 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();

I don't think we should call them pass 1, pass 2, and pass 3.  That
implies that the linker is making a pass over the files, which is true
for passes 1 and 3 but is not true for pass 3.  Suppose we just say
"initial tasks run time", "middle tasks run time" and "final tasks run
time" which corresponds to the names in the code.  Or if you want to
come up with more descriptive names that is also OK with me.

>  #ifndef GOLD_TIMER_H
>  #define GOLD_TIMER_H
>  
> +#include <vector>

No need to #include <vector> here.


This is OK with those changes.

Thanks.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]