#include <Throughput_Stats.h>
Inheritance diagram for ACE_Throughput_Stats:
Public Member Functions | |
ACE_Throughput_Stats (void) | |
Constructor. | |
void | sample (ACE_UINT64 throughput, ACE_UINT64 latency) |
Store one sample. | |
void | accumulate (const ACE_Throughput_Stats &throughput) |
Update the values to reflect the stats in throughput. | |
void | dump_results (const ACE_TCHAR *msg, ACE_UINT32 scale_factor) |
Print down the stats. | |
Static Public Member Functions | |
void | dump_throughput (const ACE_TCHAR *msg, ACE_UINT32 scale_factor, ACE_UINT64 elapsed_time, ACE_UINT32 samples_count) |
Dump the average throughput stats. | |
Private Attributes | |
ACE_UINT64 | throughput_last_ |
The last throughput measurement. |
Keep the relevant information to perform throughput and latency analysis, including:
Definition at line 45 of file Throughput_Stats.h.
|
Constructor.
Definition at line 14 of file Throughput_Stats.cpp.
00015 : ACE_Basic_Stats () 00016 , throughput_last_ (0) 00017 #if 0 00018 // @@TODO: This is what I really wanted to compute, but it just 00019 // does not work. 00020 , throughput_sum_x_ (0) 00021 , throughput_sum_x2_ (0) 00022 , throughput_sum_y_ (0) 00023 , throughput_sum_y2_ (0) 00024 , throughput_sum_xy_ (0) 00025 #endif /* 0 */ 00026 { 00027 } |
|
Update the values to reflect the stats in throughput.
Definition at line 70 of file Throughput_Stats.cpp. References ACE_Basic_Stats::accumulate(), ACE_Basic_Stats::samples_count(), and throughput_last_.
00071 { 00072 if (rhs.samples_count () == 0u) 00073 return; 00074 00075 this->ACE_Basic_Stats::accumulate (rhs); 00076 00077 if (this->samples_count () == 0u) 00078 { 00079 this->throughput_last_ = rhs.throughput_last_; 00080 #if 0 00081 // @@TODO: This is what I really wanted to compute, but it just 00082 // does not work. 00083 this->throughput_sum_x_ = rhs.throughput_sum_x_; 00084 this->throughput_sum_x2_ = rhs.throughput_sum_x2_; 00085 this->throughput_sum_y_ = rhs.throughput_sum_y_; 00086 this->throughput_sum_y2_ = rhs.throughput_sum_y2_; 00087 this->throughput_sum_xy_ = rhs.throughput_sum_xy_; 00088 #endif /* 0 */ 00089 00090 return; 00091 } 00092 00093 00094 if (this->throughput_last_ < rhs.throughput_last_) 00095 this->throughput_last_ = rhs.throughput_last_; 00096 00097 #if 0 00098 // @@TODO: This is what I really wanted to compute, but it just 00099 // does not work. 00100 this->throughput_sum_x_ += rhs.throughput_sum_x_; 00101 this->throughput_sum_x2_ += rhs.throughput_sum_x2_; 00102 this->throughput_sum_y_ += rhs.throughput_sum_y_; 00103 this->throughput_sum_y2_ += rhs.throughput_sum_y2_; 00104 this->throughput_sum_xy_ += rhs.throughput_sum_xy_; 00105 #endif /* 0 */ 00106 } |
|
Print down the stats.
Definition at line 109 of file Throughput_Stats.cpp. References ACE_DEBUG, ACE_TCHAR, ACE_TEXT, ACE_Basic_Stats::dump_results(), dump_throughput(), LM_DEBUG, and ACE_Basic_Stats::samples_count().
00111 { 00112 if (this->samples_count () == 0u) 00113 { 00114 ACE_DEBUG ((LM_DEBUG, 00115 ACE_TEXT ("%s : no data collected\n"), msg)); 00116 return; 00117 } 00118 00119 this->ACE_Basic_Stats::dump_results (msg, sf); 00120 00121 ACE_Throughput_Stats::dump_throughput (msg, sf, 00122 this->throughput_last_, 00123 this->samples_count ()); 00124 00125 #if 0 00126 // @@TODO: This is what I really wanted to generate, but it just 00127 // doesn't work. 00128 double t_sum_x = 00129 ACE_CU64_TO_CU32 (this->throughput_sum_x_);// / sf); 00130 //t_sum_x /= 1000000.0; 00131 double t_sum_y = 00132 ACE_CU64_TO_CU32 (this->throughput_sum_y_); 00133 double t_sum_x2 = 00134 ACE_CU64_TO_CU32 (this->throughput_sum_x2_);// / (sf*sf)); 00135 //t_sum_x2 /= 1000000.0; 00136 //t_sum_x2 /= 1000000.0; 00137 double t_sum_y2 = 00138 ACE_CU64_TO_CU32 (this->throughput_sum_y2_); 00139 double t_sum_xy = 00140 ACE_CU64_TO_CU32 (this->throughput_sum_xy_);// / sf); 00141 //t_sum_xy /= 1000000.0; 00142 double t_avgx = t_sum_x / this->samples_count (); 00143 double t_avgy = t_sum_y / this->samples_count (); 00144 00145 double t_a = 00146 (this->samples_count () * t_sum_xy - t_sum_x * t_sum_y) 00147 / (this->samples_count () * t_sum_x2 - t_sum_x * t_sum_x); 00148 double t_b = (t_avgy - t_a * t_avgx); 00149 00150 t_a *= 1000000.0; 00151 00152 double d_r = 00153 (t_sum_xy - t_avgx * t_sum_y - t_avgy * t_sum_x 00154 + this->samples_count () * t_avgx * t_avgy); 00155 double n_r = 00156 (t_sum_x2 00157 - this->samples_count () * t_avgx * t_avgx) 00158 * (t_sum_y2 00159 - this->samples_count () * t_avgy * t_avgy); 00160 double t_r = d_r * d_r / n_r; 00161 00162 // ACE_DEBUG ((LM_DEBUG, 00163 // "%s throughput: %.2f/%.2f/%.2f/%.6f/%.2f (avg/a/b/r/elapsed)\n", 00164 // msg, t_avg, t_a, t_b, t_r, seconds)); 00165 // ACE_DEBUG ((LM_DEBUG, 00166 // "%s data: %.2f/%.2f/%.2f/%.6f/%.2f (x/x2/y/y2/xy)\n", 00167 // msg, t_sum_x, t_sum_x2, t_sum_y, t_sum_y2, t_sum_xy)); 00168 #endif 00169 } |
|
Dump the average throughput stats.
Definition at line 172 of file Throughput_Stats.cpp. References ACE_DEBUG, ACE_HR_SCALE_CONVERSION, ACE_TCHAR, ACE_TEXT, ACE_UINT64, ACE_UINT64_DBLCAST_ADAPTER, and LM_DEBUG. Referenced by dump_results().
00176 { 00177 #ifndef ACE_NLOGGING 00178 double seconds = 00179 # if defined ACE_LACKS_LONGLONG_T 00180 elapsed_time / sf; 00181 #elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T) 00182 static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER ( 00183 ACE_U_LongLong(elapsed_time / sf))); 00184 # else /* ! ACE_LACKS_LONGLONG_T */ 00185 static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (elapsed_time / sf)); 00186 # endif /* ! ACE_LACKS_LONGLONG_T */ 00187 seconds /= ACE_HR_SCALE_CONVERSION; 00188 00189 const double t_avg = samples_count / seconds; 00190 00191 ACE_DEBUG ((LM_DEBUG, 00192 ACE_TEXT ("%s throughput: %.2f (events/second)\n"), 00193 msg, t_avg)); 00194 #else 00195 ACE_UNUSED_ARG (msg); 00196 ACE_UNUSED_ARG (sf); 00197 ACE_UNUSED_ARG (elapsed_time); 00198 ACE_UNUSED_ARG (samples_count); 00199 #endif /* ACE_NLOGGING */ 00200 } |
|
Store one sample.
Definition at line 30 of file Throughput_Stats.cpp. References ACE_UINT64, ACE_OS::printf(), ACE_Basic_Stats::sample(), ACE_Basic_Stats::samples_count(), and throughput_last_.
00032 { 00033 this->ACE_Basic_Stats::sample (latency); 00034 00035 if (this->samples_count () == 1u) 00036 { 00037 00038 this->throughput_last_ = throughput; 00039 #if 0 00040 // @@TODO: This is what I really wanted to compute, but it just 00041 // does not work. 00042 this->throughput_sum_y_ = this->samples_count_; 00043 this->throughput_sum_y2_ = this->samples_count_ * this->samples_count_; 00044 this->throughput_sum_x_ = throughput; 00045 this->throughput_sum_x2_ = throughput * throughput; 00046 this->throughput_sum_xy_ = throughput * this->samples_count_; 00047 00048 ACE_OS::printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_); 00049 #endif /* 0 */ 00050 } 00051 else 00052 { 00053 this->throughput_last_ = throughput; 00054 00055 #if 0 00056 // @@TODO: This is what I really wanted to compute, but it just 00057 // does not work. 00058 this->throughput_sum_y_ += this->samples_count_; 00059 this->throughput_sum_y2_ += this->samples_count_ * this->samples_count_; 00060 this->throughput_sum_x_ += throughput; 00061 this->throughput_sum_x2_ += throughput * throughput; 00062 this->throughput_sum_xy_ += throughput * this->samples_count_; 00063 00064 ACE_OS::printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_); 00065 #endif /* 0 */ 00066 } 00067 } |
|
The last throughput measurement.
Definition at line 67 of file Throughput_Stats.h. Referenced by accumulate(), and sample(). |