Refactoring of timevar API
commit17c0b84b9f4c298f7f9f68900b4331d0f912bce2
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Aug 2015 20:14:21 +0000 (3 20:14 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Aug 2015 20:14:21 +0000 (3 20:14 +0000)
treeb90c7df0235fa14daf2c76f22203ee08c2c32bcb
parentcb96a11382d55dc271985781aadc6945bd4faed2
Refactoring of timevar API

gcc/ChangeLog:
* main.c (main): Pass in NULL for toplev's external_timer.
* timevar.c: Include coretypes.h.
(class timer::named_items): New.
(timer::named_items::named_items): New.
(timer::named_items::~named_items): New.
(timer::named_items::push): New.
(timer::named_items::pop): New.
(timer::named_items::print): New.
(timer::timer): Initialize field "m_jit_client_items".
(timer::~timer): New.
(timer::push): Move bulk of implementation to...
(timer::push_internal): ...here.  New function.
(timer::pop): Move bulk of implementation to...
(timer::pop_internal): ...here.  New function.
(timer::push_client_item): New.
(timer::pop_client_item): New.
(timer::print_row): New function, taken from timer::print.
(timer::print): Print "GCC items" header if we also have client
items.  Move row-printing to timer::print_row.  Print any client
items.
(timer::get_topmost_item_name): New method.
* timevar.def (TV_JIT_ACQUIRING_MUTEX): New.
(TV_JIT_CLIENT_CODE): New.
* timevar.h (timer::push_client_item): New declaration.
(timer::pop_client_item): New declaration.
(timer::get_topmost_item_name): New method.
(timer::push_internal): New declaration.
(timer::pop_internal): New declaration.
(timer::print_row): New declaration.
(timer::named_items): New declaration.
(timer::m_jit_client_items): New field.
(timer): Add friend class named_items.
(auto_timevar::auto_timevar): Add timer param.
(auto_timevar::~auto_timevar): Use field "m_timer".
(auto_timevar::m_timer): New field.
* toplev.c (initialize_rtl): Add g_timer as param when
constructing auto_timevar instance.
(toplev::toplev): Add "external_timer" param, and use it to
initialize the "g_timer" global if non-NULL.
(toplev::~toplev): If this created "g_timer", delete it.
* toplev.h (toplev::toplev): Replace "use_TV_TOTAL" bool param
with "external_timer" timer *.

gcc/jit/ChangeLog:
* docs/topics/compatibility.rst (LIBGCCJIT_ABI_4): New.
* docs/topics/contexts.rst (GCC_JIT_BOOL_OPTION_DUMP_SUMMARY):
We no longer show a profile.
* docs/topics/index.rst (Topic Reference): Add performance.rst.
* docs/topics/performance.rst: New file.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* jit-playback.c (gcc::jit::playback::context::compile): Add timer
param when constructing the "toplev" instance.
(gcc::jit::playback::context::acquire_mutex): Add timer param when
constructing auto_timevar instance.
(gcc::jit::playback::context::make_fake_args): If we have a timer,
add "-ftime-report".
(gcc::jit::playback::context::invoke_driver): Add timer param when
constructing auto_timevar instance.
(gcc::jit::playback::context::dlopen_built_dso): Likewise.
* jit-playback.h (gcc::jit::playback::context::get_timer): New accessor.
* jit-recording.c: Include timevar.h.
(gcc::jit::recording::context::context): Initialize field "m_timer".
* jit-recording.h: Add forward declaration of class timer.
(gcc::jit::recording::context::set_timer): New method.
(gcc::jit::recording::context::get_timer): New method.
(gcc::jit::recording::context::m_timer): New field.
* libgccjit++.h (gccjit::timer): New class.
(gccjit::auto_time): New class.
(gccjit::context::set_timer): New method.
(gccjit::context::get_timer): New.
(gccjit::timer::timer): New.
(gccjit::timer::push): New.
(gccjit::timer::pop): New.
(timer::print): New.
(timer::get_inner_timer): New.
(timer::release): New.
(auto_time::auto_time): New.
(auto_time::~auto_time): New.
* libgccjit.c: Include timevar.h.
(struct gcc_jit_timer): New.
(gcc_jit_timer_new): New function.
(gcc_jit_timer_release): New function.
(gcc_jit_context_set_timer): New function.
(gcc_jit_context_get_timer): New function.
(gcc_jit_timer_push): New function.
(gcc_jit_timer_pop): New function.
(gcc_jit_timer_print): New function.
* libgccjit.h (LIBGCCJIT_HAVE_TIMING_API): New macro.
(gcc_jit_timer): New typedef.
(gcc_jit_timer_new): New function.
(gcc_jit_timer_release): New function.
(gcc_jit_context_set_timer): New function.
(gcc_jit_context_get_timer): New function.
(gcc_jit_timer_push): New function.
(gcc_jit_timer_pop): New function.
(gcc_jit_timer_print): New function.
* libgccjit.map (LIBGCCJIT_ABI_4): New.
(gcc_jit_timer_new): New function.
(gcc_jit_timer_release): New function.
(gcc_jit_context_set_timer): New function.
(gcc_jit_context_get_timer): New function.
(gcc_jit_timer_push): New function.
(gcc_jit_timer_pop): New function.
(gcc_jit_timer_print): New function.

gcc/testsuite/ChangeLog:
* jit.dg/test-benchmark.c (test_jit): Add param "timer" and use
it to push/pop timing items.
(main): For each optimization level, create a gcc_jit_timer, and
time all of the iteration within that level cumulatively.
* jit.dg/test-error-gcc_jit_timer_pop-mismatch.c: New test case.
* jit.dg/test-error-gcc_jit_timer_pop-too-many.c: New test case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226530 138bc75d-0d04-0410-961f-82ee72b054a4
25 files changed:
gcc/ChangeLog
gcc/jit/ChangeLog
gcc/jit/docs/_build/texinfo/libgccjit.texi
gcc/jit/docs/topics/compatibility.rst
gcc/jit/docs/topics/contexts.rst
gcc/jit/docs/topics/index.rst
gcc/jit/docs/topics/performance.rst [new file with mode: 0644]
gcc/jit/jit-playback.c
gcc/jit/jit-playback.h
gcc/jit/jit-recording.c
gcc/jit/jit-recording.h
gcc/jit/libgccjit++.h
gcc/jit/libgccjit.c
gcc/jit/libgccjit.h
gcc/jit/libgccjit.map
gcc/main.c
gcc/testsuite/ChangeLog
gcc/testsuite/jit.dg/test-benchmark.c
gcc/testsuite/jit.dg/test-error-gcc_jit_timer_pop-mismatch.c [new file with mode: 0644]
gcc/testsuite/jit.dg/test-error-gcc_jit_timer_pop-too-many.c [new file with mode: 0644]
gcc/timevar.c
gcc/timevar.def
gcc/timevar.h
gcc/toplev.c
gcc/toplev.h