#include <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 233 of file Stats.h.
|
|
Constructor.
Definition at line 429 of file Stats.cpp.
00430 : ACE_Basic_Stats () 00431 , throughput_last_ (0) 00432 #if 0 00433 // @@TODO: This is what I really wanted to compute, but it just 00434 // does not work. 00435 , throughput_sum_x_ (0) 00436 , throughput_sum_x2_ (0) 00437 , throughput_sum_y_ (0) 00438 , throughput_sum_y2_ (0) 00439 , throughput_sum_xy_ (0) 00440 #endif /* 0 */ 00441 { 00442 } |
|
|
Update the values to reflect the stats in throughput.
Definition at line 485 of file Stats.cpp. References ACE_Basic_Stats::accumulate(), ACE_Basic_Stats::samples_count(), and throughput_last_.
00486 {
00487 if (rhs.samples_count () == 0u)
00488 return;
00489
00490 this->ACE_Basic_Stats::accumulate (rhs);
00491
00492 if (this->samples_count () == 0u)
00493 {
00494 this->throughput_last_ = rhs.throughput_last_;
00495 #if 0
00496 // @@TODO: This is what I really wanted to compute, but it just
00497 // does not work.
00498 this->throughput_sum_x_ = rhs.throughput_sum_x_;
00499 this->throughput_sum_x2_ = rhs.throughput_sum_x2_;
00500 this->throughput_sum_y_ = rhs.throughput_sum_y_;
00501 this->throughput_sum_y2_ = rhs.throughput_sum_y2_;
00502 this->throughput_sum_xy_ = rhs.throughput_sum_xy_;
00503 #endif /* 0 */
00504
00505 return;
00506 }
00507
00508
00509 if (this->throughput_last_ < rhs.throughput_last_)
00510 this->throughput_last_ = rhs.throughput_last_;
00511
00512 #if 0
00513 // @@TODO: This is what I really wanted to compute, but it just
00514 // does not work.
00515 this->throughput_sum_x_ += rhs.throughput_sum_x_;
00516 this->throughput_sum_x2_ += rhs.throughput_sum_x2_;
00517 this->throughput_sum_y_ += rhs.throughput_sum_y_;
00518 this->throughput_sum_y2_ += rhs.throughput_sum_y2_;
00519 this->throughput_sum_xy_ += rhs.throughput_sum_xy_;
00520 #endif /* 0 */
00521 }
|
|
||||||||||||
|
Print down the stats.
Definition at line 524 of file Stats.cpp. References ACE_CU64_TO_CU32, ACE_DEBUG, ACE_LIB_TEXT, ACE_TCHAR, ACE_Basic_Stats::dump_results(), dump_throughput(), LM_DEBUG, and ACE_Basic_Stats::samples_count().
00526 {
00527 if (this->samples_count () == 0u)
00528 {
00529 ACE_DEBUG ((LM_DEBUG,
00530 ACE_LIB_TEXT ("%s : no data collected\n"), msg));
00531 return;
00532 }
00533
00534 this->ACE_Basic_Stats::dump_results (msg, sf);
00535
00536 ACE_Throughput_Stats::dump_throughput (msg, sf,
00537 this->throughput_last_,
00538 this->samples_count ());
00539
00540 #if 0
00541 // @@TODO: This is what I really wanted to generate, but it just
00542 // doesn't work.
00543 double t_sum_x =
00544 ACE_CU64_TO_CU32 (this->throughput_sum_x_);// / sf);
00545 //t_sum_x /= 1000000.0;
00546 double t_sum_y =
00547 ACE_CU64_TO_CU32 (this->throughput_sum_y_);
00548 double t_sum_x2 =
00549 ACE_CU64_TO_CU32 (this->throughput_sum_x2_);// / (sf*sf));
00550 //t_sum_x2 /= 1000000.0;
00551 //t_sum_x2 /= 1000000.0;
00552 double t_sum_y2 =
00553 ACE_CU64_TO_CU32 (this->throughput_sum_y2_);
00554 double t_sum_xy =
00555 ACE_CU64_TO_CU32 (this->throughput_sum_xy_);// / sf);
00556 //t_sum_xy /= 1000000.0;
00557 double t_avgx = t_sum_x / this->samples_count ();
00558 double t_avgy = t_sum_y / this->samples_count ();
00559
00560 double t_a =
00561 (this->samples_count () * t_sum_xy - t_sum_x * t_sum_y)
00562 / (this->samples_count () * t_sum_x2 - t_sum_x * t_sum_x);
00563 double t_b = (t_avgy - t_a * t_avgx);
00564
00565 t_a *= 1000000.0;
00566
00567 double d_r =
00568 (t_sum_xy - t_avgx * t_sum_y - t_avgy * t_sum_x
00569 + this->samples_count () * t_avgx * t_avgy);
00570 double n_r =
00571 (t_sum_x2
00572 - this->samples_count () * t_avgx * t_avgx)
00573 * (t_sum_y2
00574 - this->samples_count () * t_avgy * t_avgy);
00575 double t_r = d_r * d_r / n_r;
00576
00577 // ACE_DEBUG ((LM_DEBUG,
00578 // "%s throughput: %.2f/%.2f/%.2f/%.6f/%.2f (avg/a/b/r/elapsed)\n",
00579 // msg, t_avg, t_a, t_b, t_r, seconds));
00580 // ACE_DEBUG ((LM_DEBUG,
00581 // "%s data: %.2f/%.2f/%.2f/%.6f/%.2f (x/x2/y/y2/xy)\n",
00582 // msg, t_sum_x, t_sum_x2, t_sum_y, t_sum_y2, t_sum_xy));
00583 #endif
00584 }
|
|
||||||||||||||||||||
|
Dump the average throughput stats.
Definition at line 587 of file Stats.cpp. References ACE_DEBUG, ACE_HR_SCALE_CONVERSION, ACE_LIB_TEXT, ACE_TCHAR, ACE_UINT64, ACE_UINT64_DBLCAST_ADAPTER, and LM_DEBUG. Referenced by dump_results().
00591 {
00592 #ifndef ACE_NLOGGING
00593 double seconds =
00594 # if defined ACE_LACKS_LONGLONG_T
00595 elapsed_time / sf;
00596 #elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
00597 static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (
00598 ACE_U_LongLong(elapsed_time / sf)));
00599 # else /* ! ACE_LACKS_LONGLONG_T */
00600 static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (elapsed_time / sf));
00601 # endif /* ! ACE_LACKS_LONGLONG_T */
00602 seconds /= ACE_HR_SCALE_CONVERSION;
00603
00604 const double t_avg = samples_count / seconds;
00605
00606 ACE_DEBUG ((LM_DEBUG,
00607 ACE_LIB_TEXT ("%s throughput: %.2f (events/second)\n"),
00608 msg, t_avg));
00609 #else
00610 ACE_UNUSED_ARG (msg);
00611 ACE_UNUSED_ARG (sf);
00612 ACE_UNUSED_ARG (elapsed_time);
00613 ACE_UNUSED_ARG (samples_count);
00614 #endif /* ACE_NLOGGING */
00615 }
|
|
||||||||||||
|
Store one sample.
Definition at line 445 of file Stats.cpp. References ACE_UINT64, ACE_Basic_Stats::sample(), ACE_Basic_Stats::samples_count(), and throughput_last_.
00447 {
00448 this->ACE_Basic_Stats::sample (latency);
00449
00450 if (this->samples_count () == 1u)
00451 {
00452
00453 this->throughput_last_ = throughput;
00454 #if 0
00455 // @@TODO: This is what I really wanted to compute, but it just
00456 // does not work.
00457 this->throughput_sum_y_ = this->samples_count_;
00458 this->throughput_sum_y2_ = this->samples_count_ * this->samples_count_;
00459 this->throughput_sum_x_ = throughput;
00460 this->throughput_sum_x2_ = throughput * throughput;
00461 this->throughput_sum_xy_ = throughput * this->samples_count_;
00462
00463 printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_);
00464 #endif /* 0 */
00465 }
00466 else
00467 {
00468 this->throughput_last_ = throughput;
00469
00470 #if 0
00471 // @@TODO: This is what I really wanted to compute, but it just
00472 // does not work.
00473 this->throughput_sum_y_ += this->samples_count_;
00474 this->throughput_sum_y2_ += this->samples_count_ * this->samples_count_;
00475 this->throughput_sum_x_ += throughput;
00476 this->throughput_sum_x2_ += throughput * throughput;
00477 this->throughput_sum_xy_ += throughput * this->samples_count_;
00478
00479 printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_);
00480 #endif /* 0 */
00481 }
00482 }
|
|
|
The last throughput measurement.
Definition at line 255 of file Stats.h. Referenced by accumulate(), and sample(). |
1.3.6