X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fmaint.h;h=1f42b65b5db050d036068bc8325697aa8ad6f153;hb=7ed1acafa0b5d135342f9dcc0eb0387dff95005a;hp=52c3bd93f0bb68e5e160e5e74db8a12137058157;hpb=ecd75fc8eed3bde86036141228074a20e55dcfc9;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/maint.h b/gdb/maint.h index 52c3bd93f0..1f42b65b5d 100644 --- a/gdb/maint.h +++ b/gdb/maint.h @@ -1,5 +1,5 @@ /* Support for GDB maintenance commands. - Copyright (C) 2013-2014 Free Software Foundation, Inc. + Copyright (C) 2013-2017 Free Software Foundation, Inc. This file is part of GDB. @@ -19,13 +19,47 @@ #ifndef MAINT_H #define MAINT_H +#include "run-time-clock.h" +#include + extern void set_per_command_time (int); extern void set_per_command_space (int); -/* Note: There's no set_per_command_symtab on purpose. - Symtab stats aren't yet as useful for --statistics output. */ +/* Records a run time and space usage to be used as a base for + reporting elapsed time or change in space. */ + +class scoped_command_stats +{ + public: + + explicit scoped_command_stats (bool msg_type); + ~scoped_command_stats (); + + private: + + // No need for these. They are intentionally not defined anywhere. + scoped_command_stats &operator= (const scoped_command_stats &); + scoped_command_stats (const scoped_command_stats &); -extern struct cleanup *make_command_stats_cleanup (int); + /* Zero if the saved time is from the beginning of GDB execution. + One if from the beginning of an individual command execution. */ + bool m_msg_type; + /* Track whether the stat was enabled at the start of the command + so that we can avoid printing anything if it gets turned on by + the current command. */ + int m_time_enabled : 1; + int m_space_enabled : 1; + int m_symtab_enabled : 1; + run_time_clock::time_point m_start_cpu_time; + std::chrono::steady_clock::time_point m_start_wall_time; + long m_start_space; + /* Total number of symtabs (over all objfiles). */ + int m_start_nr_symtabs; + /* A count of the compunits. */ + int m_start_nr_compunit_symtabs; + /* Total number of blocks. */ + int m_start_nr_blocks; +}; #endif /* MAINT_H */