#include <Stats.h>
Inheritance diagram for ACE_Throughput_Stats:


Public Methods | |
| ACE_Throughput_Stats (void) | |
| Constructor. More... | |
| void | sample (ACE_UINT64 throughput, ACE_UINT64 latency) |
| Store one sample. More... | |
| void | accumulate (const ACE_Throughput_Stats &throughput) |
| Update the values to reflect the stats in throughput. More... | |
| void | dump_results (const ACE_TCHAR *msg, ACE_UINT32 scale_factor) |
| Print down the stats. More... | |
Static Public Methods | |
| void | dump_throughput (const ACE_TCHAR *msg, ACE_UINT32 scale_factor, ACE_UINT64 elapsed_time, ACE_UINT32 samples_count) |
| Dump the average throughput stats. More... | |
Private Attributes | |
| ACE_UINT64 | throughput_last_ |
| The last throughput measurement. More... | |
Keep the relevant information to perform throughput and latency analysis, including:
Definition at line 229 of file Stats.h.
|
|
Constructor.
Definition at line 425 of file Stats.cpp.
00426 : ACE_Basic_Stats () 00427 , throughput_last_ (0) 00428 #if 0 00429 // @@TODO: This is what I really wanted to compute, but it just 00430 // does not work. 00431 , throughput_sum_x_ (0) 00432 , throughput_sum_x2_ (0) 00433 , throughput_sum_y_ (0) 00434 , throughput_sum_y2_ (0) 00435 , throughput_sum_xy_ (0) 00436 #endif /* 0 */ 00437 { 00438 } |
|
|
Update the values to reflect the stats in throughput.
Definition at line 481 of file Stats.cpp. References ACE_Basic_Stats::accumulate, ACE_Basic_Stats::samples_count, and throughput_last_.
00482 {
00483 if (rhs.samples_count () == 0u)
00484 return;
00485
00486 this->ACE_Basic_Stats::accumulate (rhs);
00487
00488 if (this->samples_count () == 0u)
00489 {
00490 this->throughput_last_ = rhs.throughput_last_;
00491 #if 0
00492 // @@TODO: This is what I really wanted to compute, but it just
00493 // does not work.
00494 this->throughput_sum_x_ = rhs.throughput_sum_x_;
00495 this->throughput_sum_x2_ = rhs.throughput_sum_x2_;
00496 this->throughput_sum_y_ = rhs.throughput_sum_y_;
00497 this->throughput_sum_y2_ = rhs.throughput_sum_y2_;
00498 this->throughput_sum_xy_ = rhs.throughput_sum_xy_;
00499 #endif /* 0 */
00500
00501 return;
00502 }
00503
00504
00505 if (this->throughput_last_ < rhs.throughput_last_)
00506 this->throughput_last_ = rhs.throughput_last_;
00507
00508 #if 0
00509 // @@TODO: This is what I really wanted to compute, but it just
00510 // does not work.
00511 this->throughput_sum_x_ += rhs.throughput_sum_x_;
00512 this->throughput_sum_x2_ += rhs.throughput_sum_x2_;
00513 this->throughput_sum_y_ += rhs.throughput_sum_y_;
00514 this->throughput_sum_y2_ += rhs.throughput_sum_y2_;
00515 this->throughput_sum_xy_ += rhs.throughput_sum_xy_;
00516 #endif /* 0 */
00517 }
|
|
||||||||||||
|
Print down the stats.
Definition at line 520 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.
00522 {
00523 if (this->samples_count () == 0u)
00524 {
00525 ACE_DEBUG ((LM_DEBUG,
00526 ACE_LIB_TEXT ("%s : no data collected\n"), msg));
00527 return;
00528 }
00529
00530 this->ACE_Basic_Stats::dump_results (msg, sf);
00531
00532 ACE_Throughput_Stats::dump_throughput (msg, sf,
00533 this->throughput_last_,
00534 this->samples_count ());
00535
00536 #if 0
00537 // @@TODO: This is what I really wanted to generate, but it just
00538 // doesn't work.
00539 double t_sum_x =
00540 ACE_CU64_TO_CU32 (this->throughput_sum_x_);// / sf);
00541 //t_sum_x /= 1000000.0;
00542 double t_sum_y =
00543 ACE_CU64_TO_CU32 (this->throughput_sum_y_);
00544 double t_sum_x2 =
00545 ACE_CU64_TO_CU32 (this->throughput_sum_x2_);// / (sf*sf));
00546 //t_sum_x2 /= 1000000.0;
00547 //t_sum_x2 /= 1000000.0;
00548 double t_sum_y2 =
00549 ACE_CU64_TO_CU32 (this->throughput_sum_y2_);
00550 double t_sum_xy =
00551 ACE_CU64_TO_CU32 (this->throughput_sum_xy_);// / sf);
00552 //t_sum_xy /= 1000000.0;
00553 double t_avgx = t_sum_x / this->samples_count ();
00554 double t_avgy = t_sum_y / this->samples_count ();
00555
00556 double t_a =
00557 (this->samples_count () * t_sum_xy - t_sum_x * t_sum_y)
00558 / (this->samples_count () * t_sum_x2 - t_sum_x * t_sum_x);
00559 double t_b = (t_avgy - t_a * t_avgx);
00560
00561 t_a *= 1000000.0;
00562
00563 double d_r =
00564 (t_sum_xy - t_avgx * t_sum_y - t_avgy * t_sum_x
00565 + this->samples_count () * t_avgx * t_avgy);
00566 double n_r =
00567 (t_sum_x2
00568 - this->samples_count () * t_avgx * t_avgx)
00569 * (t_sum_y2
00570 - this->samples_count () * t_avgy * t_avgy);
00571 double t_r = d_r * d_r / n_r;
00572
00573 // ACE_DEBUG ((LM_DEBUG,
00574 // "%s throughput: %.2f/%.2f/%.2f/%.6f/%.2f (avg/a/b/r/elapsed)\n",
00575 // msg, t_avg, t_a, t_b, t_r, seconds));
00576 // ACE_DEBUG ((LM_DEBUG,
00577 // "%s data: %.2f/%.2f/%.2f/%.6f/%.2f (x/x2/y/y2/xy)\n",
00578 // msg, t_sum_x, t_sum_x2, t_sum_y, t_sum_y2, t_sum_xy));
00579 #endif
00580 }
|
|
||||||||||||||||||||
|
Dump the average throughput stats.
Definition at line 583 of file Stats.cpp. References ACE_DEBUG, ACE_HR_SCALE_CONVERSION, ACE_LIB_TEXT, ACE_TCHAR, ACE_UINT64, ACE_UINT64_DBLCAST_ADAPTER, LM_DEBUG, and ACE_Basic_Stats::samples_count. Referenced by dump_results.
00587 {
00588 double seconds =
00589 #if defined ACE_LACKS_LONGLONG_T
00590 elapsed_time / sf;
00591 #else /* ! ACE_LACKS_LONGLONG_T */
00592 ACE_static_cast (double,
00593 ACE_UINT64_DBLCAST_ADAPTER(elapsed_time / sf));
00594 #endif /* ! ACE_LACKS_LONGLONG_T */
00595 seconds /= ACE_HR_SCALE_CONVERSION;
00596 double t_avg = samples_count / seconds;
00597
00598 ACE_DEBUG ((LM_DEBUG,
00599 ACE_LIB_TEXT ("%s throughput: %.2f (events/second)\n"),
00600 msg, t_avg));
00601 }
|
|
||||||||||||
|
Store one sample.
Definition at line 441 of file Stats.cpp. References ACE_UINT64, ACE_Basic_Stats::sample, ACE_Basic_Stats::samples_count, and throughput_last_.
00443 {
00444 this->ACE_Basic_Stats::sample (latency);
00445
00446 if (this->samples_count () == 1u)
00447 {
00448
00449 this->throughput_last_ = throughput;
00450 #if 0
00451 // @@TODO: This is what I really wanted to compute, but it just
00452 // does not work.
00453 this->throughput_sum_y_ = this->samples_count_;
00454 this->throughput_sum_y2_ = this->samples_count_ * this->samples_count_;
00455 this->throughput_sum_x_ = throughput;
00456 this->throughput_sum_x2_ = throughput * throughput;
00457 this->throughput_sum_xy_ = throughput * this->samples_count_;
00458
00459 printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_);
00460 #endif /* 0 */
00461 }
00462 else
00463 {
00464 this->throughput_last_ = throughput;
00465
00466 #if 0
00467 // @@TODO: This is what I really wanted to compute, but it just
00468 // does not work.
00469 this->throughput_sum_y_ += this->samples_count_;
00470 this->throughput_sum_y2_ += this->samples_count_ * this->samples_count_;
00471 this->throughput_sum_x_ += throughput;
00472 this->throughput_sum_x2_ += throughput * throughput;
00473 this->throughput_sum_xy_ += throughput * this->samples_count_;
00474
00475 printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_);
00476 #endif /* 0 */
00477 }
00478 }
|
|
|
The last throughput measurement.
Definition at line 251 of file Stats.h. Referenced by accumulate, and sample. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002