6 #include "Teuchos_Array.hpp" 7 #include "Teuchos_RCP.hpp" 8 #include "Teuchos_ParameterList.hpp" 9 #include "Teuchos_Assert.hpp" 69 for (
int i = 0 ; i <
size_ ; ++i)
76 time_[timerID]->ResetStartTime();
80 inline int AddTime(
const std::string what,
int dataID,
const int timerID = 0)
86 return data_.size()-1;
90 TEUCHOS_TEST_FOR_EXCEPTION(
91 timerID >= (
int)(
data_.size()), std::logic_error,
92 "Amesos_Time::AddTime(...): Error, dataID="<<dataID
93 <<
" is >= data_.size()="<<
data_.size() <<
" for dataName=\""<<what<<
"\"!" 97 data_[dataID].timeVal_ +=
time_[timerID]->ElapsedTime();
102 inline double GetTime(
const std::string what)
const 104 int dataSize = (int)(
data_.size());
105 for (
int i=0; i<dataSize; ++i) {
106 if (
data_[i].timeName_ == what ) {
107 return data_[i].timeVal_;
117 if ( dataID < 0 || dataID >= (
int)(
data_.size()) ) {
120 return data_[dataID].timeVal_;
124 inline void GetTiming( Teuchos::ParameterList& list )
const 126 int dataSize = (int)(
data_.size());
127 for (
int i=0; i<dataSize; ++i) {
128 list.set(
data_[i].timeName_,
data_[i].timeVal_ );
double GetTime(const std::string what) const
Gets the cumulative time using the string.
double timeVal_
Current timing data.
std::string timeName_
Character string identifying this timing data.
Amesos_Time_Data(std::string timeName, double timeVal)
Constructor.
Array< Amesos_Time_Data > data_
Fast accessable container for timing data.
Amesos_Time_Data: Simple struct for storing associated data for Amesos_Time.
void CreateTimer(const Epetra_Comm &Comm, int size=1)
Initializes the Time object.
void GetTiming(Teuchos::ParameterList &list) const
Load up the current timing information into the parameter list.
virtual ~Amesos_Time()
Default destructor.
double GetTime(const int dataID) const
Gets the cumulative time using the dataID.
int size_
Number of Epetra_Time objects allocated in this object.
Amesos_Time: Container for timing information.
int AddTime(const std::string what, int dataID, const int timerID=0)
Adds to field what the time elapsed since last call to ResetTimer().
Amesos_Time()
Default constructor to create size timers.
virtual ~Amesos_Time_Data()
Destructor.
Array< RCP< Epetra_Time > > time_
Time object.
void ResetTimer(const int timerID=0)
Resets the internally stored time object.