12 level_(
std::numeric_limits<unsigned>::max()),name_(
"INVALID"),parent_(NULL)
23 for (
unsigned i=0; i<level_; ++i)
25 os << name_<<
":"<<
accumulatedTime()<<
" [" << count_started_<<
"] ("<< count_updates_ <<
")"<<std::endl;
27 for (
size_t i=0; i<sub_timers_.size(); ++i) {
28 t_total += sub_timers_[i].accumulatedTime();
29 sub_timers_[i].report(os);
31 if ( sub_timers_.size() == 0 )
33 for (
unsigned i=0; i<=level_; ++i)
42 if (get_full_name() == name) {
47 for (
unsigned i=0;i<sub_timers_.size(); ++i){
48 t = sub_timers_[i].findTimer(name,found);
90 hist_[i].resize(num_names);
106 for (
int i=0;i<num_names; ++i) {
111 used[i] = t.count==0? 0:1;
113 updates[i] = t.updates;
127 for (
int i=0;i<num_names; ++i) {
133 int bin=(time[i]-
min_[i])/dh;
134 bins[i] = std::max(std::min(bin,options.
num_histogram-1) , 0);
139 for (
int i=0;i<num_names; ++i) {
150 for (
int i=0;i<num_names; ++i)
157 std::pair<std::string, std::string>
getPrefix(
const std::string &name) {
158 for (std::size_t i=name.size()-1; i>0; --i)
159 if (name[i] ==
'@') {
160 return std::pair<std::string, std::string>(name.substr(0,i), name.substr(i+1, name.size()));
162 return std::pair<std::string, std::string>(std::string(
""), name);
168 double total_time = 0.0;
174 if ( (level != print_level) || (level >= options.
max_levels) )
177 if ( prefix != split_names.first)
181 for (
int l=0; l<level; ++l)
183 os << split_names.second <<
": ";
188 os <<
" - "<<
sum_[i]/
active_[i]/parent_time*100<<
"%";
196 os <<
" {min="<<
min_[i]<<
", max="<<
max_[i];
207 os <<
", "<<
hist_[h][i];
217 for (
int l=0; l<=level; ++l)
219 os <<
"Remainder: " <<
sum_[i]/
active_[i]- sub_time;
234 if (rank(*comm) == 0 ) {
236 os <<
"*** Teuchos::StackedTimer::report() - Remainder for a block will be ***" 237 <<
"\n*** incorrect if a timer in the block does not exist on every rank ***" 238 <<
"\n*** of the MPI Communicator. ***" 242 os <<
"Teuchos::StackedTimer::report() - max_levels set to " << options.
max_levels 243 <<
", to print more levels, increase value of OutputOptions::max_levels." << std::endl;
void addTimerNames(Array< std::string > &names, unsigned &pos)
void merge(Teuchos::RCP< const Teuchos::Comm< int > > comm)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
void reduce< int, double >(const double sendBuf[], double recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
T * getRawPtr()
Return a raw pointer to beginning of array or NULL if unsized.
BaseTimer::TimeInfo findTimer(const std::string &name, bool &found)
double printLevel(std::string prefix, int level, std::ostream &os, std::vector< bool > &printed, double parent_time, const OutputOptions &options)
double accumulatedTime(const std::string &name="")
void report(std::ostream &os)
Array< Array< int > > hist_
void collectRemoteData(Teuchos::RCP< const Teuchos::Comm< int > > comm, const OutputOptions &options)
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
Deprecated .
Array< unsigned long long > updates_
void mergeCounterNames(const Comm< int > &comm, const Array< std::string > &localNames, Array< std::string > &globalNames, const ECounterSetOp setOp)
Merge counter names over all processors.
void resize(size_type new_size, const value_type &x=value_type())
LevelTimer timer_
Base timer.
void error_out(const std::string &msg, const bool)
Error reporting function for stacked timer.
Abstract interface for distributed-memory communication.
Array< std::string > flat_names_
void report(std::ostream &os)
LevelTimer()
Default constructor, shouldn't be used but needed for std::vector.
Smart reference counting pointer class for automatic garbage collection.
Array< unsigned long > count_
bool output_total_updates
Struct for controlling output options like histograms.
std::pair< std::string, std::string > getPrefix(const std::string &name)