Nymph  v1.5.2
Flow-Based Data Processing Framework
TestThroughputProfiler.cc
Go to the documentation of this file.
1 /*
2  * TestThroughputProfiler.cc
3  *
4  * Created on: Dec 2, 2012
5  * Author: nsoblath
6  */
7 
8 #include "KTLogger.hh"
10 
11 using namespace Nymph;
12 
13 KTLOGGER(testlog, "TestThroughputProfiler");
14 
15 int main()
16 {
18 
19  unsigned nIterations = 1000000;
20  unsigned sum = 0;
21  KTINFO(testlog, "Test 1: " << nIterations << " iterations");
22  prof.Start();
23  for (unsigned i=0; i<nIterations; i++)
24  {
25  sum++;
26  }
27  prof.Stop();
28  timespec diff = prof.Elapsed();
29  KTINFO(testlog, "Elapsed time: " << diff.tv_sec << " sec and " << diff.tv_nsec << " nsec");
30 
31  nIterations = 5000000;
32  sum = 0;
33  KTINFO(testlog, "Test 2: " << nIterations << " iterations");
34  prof.Start();
35  for (unsigned i=0; i<nIterations; i++)
36  {
37  sum++;
38  }
39  prof.Stop();
40  diff = prof.Elapsed();
41  KTINFO(testlog, "Elapsed time: " << diff.tv_sec << " sec and " << diff.tv_nsec << " nsec");
42 
43  return 0;
44 }
45 
int main()
#define KTINFO(...)
Definition: KTLogger.hh:344
Measures the speed of data processing.
KTLOGGER(applog, "KTApplication")
Contains the logger class and macros, based on Kasper&#39;s KLogger class.