61#pragma comment(lib, "Ws2_32.lib")
72 void func_time_monitor1()
78 void func_time_monitor2()
105 return fib (n-1) + fib (n-2);
115 slowLoop (
const size_t n)
117 const double inc = 1 /
static_cast<double> (n);
120 for (
size_t i = 0; i < n; ++i) {
121 for (
size_t j = 0; j < n; ++j) {
122 for (
size_t k = 0; k < n; ++k) {
141 using Teuchos::parameterList;
147 std::ostringstream
oss;
153 out <<
oss.str () << std::endl;
157 const size_t substr_i =
oss.str ().find (
"FUNC_TIME_MONITOR1");
163 std::ostringstream
oss;
173 out <<
oss.str () << std::endl;
176 const size_t substr_i =
oss.str ().find (
"FUNC_TIME_MONITOR1");
181 std::ostringstream
oss;
191 out <<
oss.str () << std::endl;
194 const size_t substr_i =
oss.str ().find (
"FUNC_TIME_MONITOR1");
210 using Teuchos::parameterList;
212 using Teuchos::rcpFromRef;
218 out <<
"Testing TimeMonitor's disableTimer() and enableTimer() methods"
220 OSTab (rcpFromRef (out));
222 out <<
"Creating timers" << endl;
227 std::ostringstream
os;
232 out <<
"Running all timers without disabling any" << endl;
248 out <<
"Disabling one timer and trying again" << endl;
262 out <<
"Reenabling the timer and trying again" << endl;
276 out <<
"Test that summarize() reports enabled and disabled timers" << endl;
282 std::ostringstream
oss;
288 out <<
oss.str () << std::endl;
292 const std::string name =
timers[
i]->name ();
312 using Teuchos::parameterList;
324 inputLabels.push_back (
"\"AlreadyQuotedNoQuotingNeeded\"");
325 inputLabels.push_back (
"\"Already quoted, no quoting needed\"");
326 inputLabels.push_back (
"\"Already quoted: quoting needed\"");
328 inputLabels.push_back (
"Not quoted: quoting needed");
330 inputLabels.push_back (
"Not quoted \" quoting needed");
331 inputLabels.push_back (
"Not quoted \" \" quoting needed");
332 inputLabels.push_back (
"\"Already quoted \" quoting needed\"");
333 inputLabels.push_back (
"\"Already quoted \" \" quoting needed\"");
337 inputLabels.push_back (
"Not quoted \\ quoting needed");
338 inputLabels.push_back (
"Not quoted \\\\ quoting needed");
339 inputLabels.push_back (
"Not quoted \\ \\ quoting needed");
340 inputLabels.push_back (
"\"Already quoted \\ quoting needed\"");
341 inputLabels.push_back (
"\"Already quoted \\\\ quoting needed\"");
342 inputLabels.push_back (
"\"Already quoted \\ \\ quoting needed\"");
346 outputLabels.push_back (
"\"AlreadyQuotedNoQuotingNeeded\"");
347 outputLabels.push_back (
"\"Already quoted, no quoting needed\"");
348 outputLabels.push_back (
"\"Already quoted: quoting needed\"");
350 outputLabels.push_back (
"\"Not quoted: quoting needed\"");
351 outputLabels.push_back (
"\"Not quoted \\\" quoting needed\"");
352 outputLabels.push_back (
"\"Not quoted \\\" \\\" quoting needed\"");
353 outputLabels.push_back (
"\"Already quoted \\\" quoting needed\"");
354 outputLabels.push_back (
"\"Already quoted \\\" \\\" quoting needed\"");
355 outputLabels.push_back (
"\"Not quoted \\\\ quoting needed\"");
356 outputLabels.push_back (
"\"Not quoted \\\\\\\\ quoting needed\"");
357 outputLabels.push_back (
"\"Not quoted \\\\ \\\\ quoting needed\"");
358 outputLabels.push_back (
"\"Already quoted \\\\ quoting needed\"");
359 outputLabels.push_back (
"\"Already quoted \\\\\\\\ quoting needed\"");
360 outputLabels.push_back (
"\"Already quoted \\\\ \\\\ quoting needed\"");
366 "The number of input labels is different than the number of output labels."
367 " Please ask a Teuchos developer to make sure that every test input "
368 "label has a corresponding output label.");
380 for (
int k = 0;
k < 3; ++
k) {
388 std::ostringstream
oss;
398 out <<
oss.str () << std::endl;
408 std::ostringstream
oss;
418 out <<
oss.str () << std::endl;
439 using Teuchos::parameterList;
452 labels.push_back (
"Foo: timer 1");
453 labels.push_back (
"Foo: timer 2");
454 labels.push_back (
"Foo: timer 3");
455 labels.push_back (
"Bar: timer 1");
456 labels.push_back (
"Bar: timer 2");
457 labels.push_back (
"Baz: timer 1");
458 labels.push_back (
"Xyzzy");
459 labels.push_back (
"This is not a pipe");
460 labels.push_back (
"You should not see this");
489 for (
int k = 0;
k < 3; ++
k) {
503 std::ostringstream
oss;
511 out <<
oss.str () << std::endl;
544 std::ostringstream
oss;
554 out <<
oss.str () << std::endl;
585 std::ostringstream
oss;
595 out <<
oss.str () << std::endl;
649 using Teuchos::parameterList;
655 std::ostringstream
oss;
661 out <<
oss.str() << std::endl;
664 const size_t substr_i =
oss.str().find (
"FUNC_TIME_MONITOR2");
672 std::ostringstream
oss;
682 out <<
oss.str () << std::endl;
684 const size_t substr_i =
oss.str().find (
"FUNC_TIME_MONITOR2");
691 std::ostringstream
oss;
701 out <<
oss.str () << std::endl;
703 const size_t substr_i =
oss.str().find (
"FUNC_TIME_MONITOR2");
740 std::ostringstream
oss;
761 for (
size_t k = 0;
k < 3; ++
k) {
779 out << std::endl <<
"Testing intersection of timers:" << std::endl
780 <<
oss.str() << std::endl;
801 out << std::endl <<
"Testing union of timers:" << std::endl
824 std::ostringstream
oss;
842 for (
size_t k = 0;
k < 3; ++
k) {
861 out <<
oss.str() << std::endl;
903 std::ostringstream
oss;
926 for (
int k = 0;
k < 3; ++
k) {
947 out <<
oss.str() << std::endl;
984 std::ostringstream
oss;
1031 out <<
oss.str() << std::endl;
1042 std::ostringstream
oss2;
1045 out <<
oss2.str() << std::endl;
1059 std::ostringstream
oss3;
1062 out <<
oss3.str() << std::endl;
1069 std::ostringstream
oss4;
1072 out <<
oss4.str() << std::endl;
A MPI utilities class, providing methods for initializing, finalizing, and querying the global MPI se...
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEST_NOTHROW(code)
Asserr that the statement 'code' does not thrown any excpetions.
#define TEST_INEQUALITY(v1, v2)
Assert the inequality of v1 and v2.
Scope guard for Teuchos::Time, with MPI collective timer reporting.
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
Defines a timer for a specific function.
#define TEUCHOS_FUNC_TIME_MONITOR_DIFF(FUNCNAME, DIFF)
Defines a timer for a specific function (with differentiator).
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes.
Ordinal size_type
The type of Array sizes and capacities.
int size(const Comm< Ordinal > &comm)
Get the number of processes in the communicator.
static Teuchos::RCP< const Comm< OrdinalType > > getDefaultSerialComm(const Teuchos::RCP< const Comm< OrdinalType > > &comm)
Return a serial Comm if the input Comm is null.
static Teuchos::RCP< const Comm< OrdinalType > > getComm()
Return the default global communicator.
static int getRank()
The rank of the calling process in MPI_COMM_WORLD.
A list of parameters of arbitrary type.
Smart reference counting pointer class for automatic garbage collection.
Concrete serial communicator subclass.
virtual int getSize() const
virtual int getRank() const
Scope guard for Time, that can compute MPI collective timer statistics.
static void enableTimer(const std::string &name)
Enable the timer with the given name.
static void report(Ptr< const Comm< int > > comm, std::ostream &out, const std::string &filter, const RCP< ParameterList > ¶ms=null)
Report timer statistics to the given output stream.
static void summarize(Ptr< const Comm< int > > comm, std::ostream &out=std::cout, const bool alwaysWriteLocal=false, const bool writeGlobalStats=true, const bool writeZeroTimers=true, const ECounterSetOp setOp=Intersection, const std::string &filter="", const bool ignoreZeroTimers=false)
Print summary statistics for all timers on the given communicator.
static RCP< Time > getNewTimer(const std::string &name)
Return a new timer with the given name (class method).
static RCP< const ParameterList > getValidReportParameters()
Default parameters (with validators) for report().
static void disableTimer(const std::string &name)
Disable the timer with the given name.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
basic_OSTab< char > OSTab