Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Param_Test / results.cpp
blob9c2982619691b8244ee1abdabe2ef87113f4f7ff
2 //=============================================================================
3 /**
4 * @file results.cpp
6 * Printing the results
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
13 #include "results.h"
14 #include "tao/debug.h"
15 #include "ace/Log_Msg.h"
17 Results::Results ()
21 Results::~Results ()
23 delete [] this->elapsed_time_;
26 void
27 Results::print_stats ()
29 double
30 avg_real_time = 0,
31 avg_user_time = 0,
32 avg_system_time = 0,
33 cps; // calls per sec
35 CORBA::ULong i;
37 if (TAO_debug_level > 0 && this->error_count_ == 0)
39 //FUZZ: disable check_for_lack_ACE_OS
40 ACE_DEBUG ((LM_DEBUG,
41 "Iteration\tReal time (msec)\tUser time (msec)"
42 "\tSystem time (msec)\n\n"));
43 //FUZZ: enable check_for_lack_ACE_OS
45 for (i = 0; i < this->call_count_; i++)
47 this->elapsed_time_[i].real_time *= ACE_ONE_SECOND_IN_MSECS;
48 this->elapsed_time_[i].user_time *= ACE_ONE_SECOND_IN_MSECS;
49 this->elapsed_time_[i].system_time *= ACE_ONE_SECOND_IN_MSECS;
50 avg_real_time += this->elapsed_time_[i].real_time;
51 avg_user_time += this->elapsed_time_[i].user_time;
52 avg_system_time += this->elapsed_time_[i].system_time;
54 ACE_DEBUG ((LM_DEBUG,
55 "%u\t\t%0.06f\t\t%0.06f\t\t%0.06f\n",
57 (this->elapsed_time_[i].real_time < 0.0?
58 0.0:this->elapsed_time_[i].real_time),
59 (this->elapsed_time_[i].user_time < 0.0?
60 0.0:this->elapsed_time_[i].user_time),
61 (this->elapsed_time_[i].system_time < 0.0?
62 0.0:this->elapsed_time_[i].system_time)));
63 } // end of for loop
65 // compute average
66 avg_real_time /= this->call_count_;
67 avg_user_time /= this->call_count_;
68 avg_system_time /= this->call_count_;
69 cps = 1000 / (avg_real_time < 0.01 ? 0.01 : avg_real_time);
71 ACE_DEBUG ((LM_DEBUG,
72 "\n*=*=*=*=*= Average *=*=*=*=*=*=\n"
73 "\treal_time\t= %0.06f ms,\n"
74 "\tuser_time\t= %0.06f ms,\n"
75 "\tsystem_time\t= %0.06f ms\n"
76 "\t%0.00f calls/second\n"
77 "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n",
78 (avg_real_time < 0.0? 0.0:avg_real_time),
79 (avg_user_time < 0.0? 0.0:avg_user_time),
80 (avg_system_time < 0.0? 0.0:avg_system_time),
81 (cps < 0.0? 0.0 : cps)));
83 ACE_DEBUG ((LM_DEBUG,
84 "\t%d calls, %d errors\n"
85 "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n",
86 this->call_count_,
87 this->error_count_));
89 else if (this->error_count_ != 0)
91 ACE_DEBUG ((LM_DEBUG,
92 "\tERROR %d faults in %d calls\n"
93 "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n",
94 this->error_count_,
95 this->call_count_));
99 void
100 Results::print_exception (const char * /* call_name */)
102 //ACE_PRINT_EXCEPTION (call_name);
105 void
106 Results::start_timer ()
108 this->timer_.start ();
111 void
112 Results::stop_timer ()
114 this->timer_.stop ();
115 this->timer_.elapsed_time (this->elapsed_time_[this->call_count_-1]);
118 CORBA::ULong
119 Results::call_count ()
121 return this->call_count_;
124 void
125 Results::call_count (CORBA::ULong c)
127 this->call_count_ = c;
130 CORBA::ULong
131 Results::error_count ()
133 return this->error_count_;
136 void
137 Results::error_count (CORBA::ULong c)
139 this->error_count_ = c;
142 void
143 Results::iterations (CORBA::ULong iters)
145 this->elapsed_time_ = new ACE_Profile_Timer::ACE_Elapsed_Time [iters];