This is the mail archive of the
mailing list for the GCC project.
Re: Time of compiling (Gross hideous mess)
On Nov 12, 2006, at 4:57 AM, shart wrote:
thanks for your raply
I want that the compiler show the entire duration (in second) of
of any programm.
Thanks for you answer.
Can you show me an example with this syntaxt. thanks
std::cout << __TIME__ << '-' << __DATE__ << std::endl;
Are you wanting to do this inside the program? If not, then Raúl's
suggestion is what you want. "time gcc -c x.c" will spit out the
time that the gcc took. If you have lots of modules, put them in a
make file and just to "time make"
I thought you wanted to do it from inside the program. Like when it
first starts up, it would tell you how much time it took to compile.
__TIME__ returns a string (or it IS a string actually). You could
put one at the top of each file. Plus have an extra file that is
compiled at the end of the list of files that has another. e.g. In
each file do:
this_file_cpp_time = __DATE__ " " __TIME__;
(where "this_file" would be different for each file).
Put all of these in a table maybe. Then have a routine go through
the table of strings and convert them to time structures -- see
strptime et. al. for info.
From the time structures you can do your computations.
Hope this helps...
Ease Software, Inc.
Low cost SATA Products for IBMs p5, pSeries, and RS/6000 AIX systems