Commit 1995e372 by Tom Tromey Committed by David Malcolm

timevar.h: Add an auto_timevar class

Patch authored by Tom Tromey; originally contributed by him to jit
branch on 2014-03-19.

gcc/ChangeLog:
	* timevar.h (class auto_timevar): New class.

From-SVN: r216288
parent 37cfabb0
2014-10-15 Tom Tromey <tromey@redhat.com>
* timevar.h (class auto_timevar): New class.
2014-10-15 Uros Bizjak <ubizjak@gmail.com>
PR go/59432
......@@ -110,6 +110,30 @@ timevar_pop (timevar_id_t tv)
timevar_pop_1 (tv);
}
// This is a simple timevar wrapper class that pushes a timevar in its
// constructor and pops the timevar in its destructor.
class auto_timevar
{
public:
auto_timevar (timevar_id_t tv)
: m_tv (tv)
{
timevar_push (m_tv);
}
~auto_timevar ()
{
timevar_pop (m_tv);
}
private:
// Private to disallow copies.
auto_timevar (const auto_timevar &);
timevar_id_t m_tv;
};
extern void print_time (const char *, long);
#endif /* ! GCC_TIMEVAR_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment