本文整理汇总了C++中ACE_Basic_Stats::samples_count方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Basic_Stats::samples_count方法的具体用法?C++ ACE_Basic_Stats::samples_count怎么用?C++ ACE_Basic_Stats::samples_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Basic_Stats
的用法示例。
在下文中一共展示了ACE_Basic_Stats::samples_count方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: history
void
test_octet_seq (const CORBA::Object_var object)
{
ACE_Sample_History history (niterations);
Test::octet_load ol (sz);
ol.length (sz);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (int i = 0; i < niterations; ++i)
{
ACE_hrtime_t start = ACE_OS::gethrtime ();
Test::Timestamp start_time = static_cast <Test::Timestamp> (start);
CORBA::Request_var request =
object->_request ("test_octet_method");
request->add_in_arg("octet_load") <<= ol;
request->add_in_arg("send_time") <<= start_time;
request->set_return_type (CORBA::_tc_ulonglong);
request->invoke ();
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "test finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
if (do_dump_history)
{
history.dump_samples (ACE_TEXT("HISTORY"), gsf);
}
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf,
test_end - test_start,
stats.samples_count ());
}
示例2: history
void
test_octet_seq (Test::Roundtrip_ptr roundtrip)
{
ACE_Sample_History history (niterations);
Test::octet_load ol (sz);
ol.length (sz);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (int i = 0; i < niterations; ++i)
{
ACE_hrtime_t start = ACE_OS::gethrtime ();
(void) roundtrip->test_octet_method (ol,
start);
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "Octet test finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
if (do_dump_history)
{
history.dump_samples (ACE_TEXT("HISTORY"), gsf);
}
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf,
test_end - test_start,
stats.samples_count ());
}
示例3: catch
int
Client_Task::run_test (void)
{
ACE_hrtime_t test_start = 0;
ACE_hrtime_t test_end = 0;
try
{
test_start = ACE_OS::gethrtime ();
this->roundtrip_->start_test ();
this->svc ();
this->roundtrip_->end_test ();
test_end = ACE_OS::gethrtime ();
}
catch (const CORBA::Exception&)
{
return 0;
}
// High resolution timer calibration
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_Basic_Stats totals;
this->accumulate_and_dump (totals, ACE_TEXT("Task"), gsf);
totals.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf,
test_end - test_start,
totals.samples_count ());
return 1;
}
示例4:
void
LogNotifyConsumer::evaluateTiming()
{
ACE_hrtime_t testEnd = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "Logging client test finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
//history_->dump_samples ("HISTORY", gsf);
ACE_Basic_Stats stats;
history_->collect_basic_stats (stats);
stats.dump_results ("Total", gsf);
ACE_Throughput_Stats::dump_throughput ("Logging client total", gsf,
testEnd - testStart_,
stats.samples_count ());
delete history_;
history_ = NULL;
}
示例5:
void
Continuous_Worker::print_stats (ACE_Sample_History &history,
ACE_hrtime_t test_end)
{
ACE_GUARD (TAO_SYNCH_MUTEX,
mon,
this->synchronizers_.worker_lock_);
if (individual_continuous_worker_stats)
{
ACE_DEBUG ((LM_DEBUG,
"\n************ Statistics for thread %t ************\n\n"));
ACE_DEBUG ((LM_DEBUG,
"Iterations = %d\n",
history.sample_count ()));
if (do_dump_history)
{
history.dump_samples (ACE_TEXT("HISTORY"), gsf);
}
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf,
test_end - test_start,
stats.samples_count ());
}
history.collect_basic_stats (this->collective_stats_);
ACE_hrtime_t elapsed_time_for_current_thread =
test_end - test_start;
if (elapsed_time_for_current_thread > this->time_for_test_)
this->time_for_test_ = elapsed_time_for_current_thread;
}
示例6: history
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
int priority =
(ACE_Sched_Params::priority_min (ACE_SCHED_FIFO)
+ ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2;
// Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
priority,
ACE_SCOPE_PROCESS)) != 0)
{
if (ACE_OS::last_error () == EPERM)
{
ACE_DEBUG ((LM_DEBUG,
"client (%P|%t): user is not superuser, "
"test runs in time-shared class\n"));
}
else
ACE_ERROR ((LM_ERROR,
"client (%P|%t): sched_params failed\n"));
}
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var object =
orb->string_to_object (ior);
Test::Roundtrip_var roundtrip =
Test::Roundtrip::_narrow (object.in ());
if (CORBA::is_nil (roundtrip.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Nil Test::Roundtrip reference <%s>\n",
ior),
1);
}
for (int j = 0; j < 100; ++j)
{
ACE_hrtime_t start = 0;
(void) roundtrip->test_method (start);
}
ACE_Sample_History history (niterations);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (int i = 0; i < niterations; ++i)
{
ACE_hrtime_t start = ACE_OS::gethrtime ();
(void) roundtrip->test_method (start);
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "test finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
if (do_dump_history)
{
history.dump_samples (ACE_TEXT("HISTORY"), gsf);
}
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf,
test_end - test_start,
stats.samples_count ());
if (do_shutdown)
{
roundtrip->shutdown ();
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例7: main
int main(int argc, char * argv[])
{
// Parameters to be passed to the services
Sparrow::Parameters * parameters = Sparrow::Parameters::instance();
// Config file processing
Miro::ConfigDocument * config = new Miro::ConfigDocument(argc, argv);
config->setSection("Sparrow99");
config->getParameters("sparrowBoard", *parameters);
delete config;
#ifdef DEBUG
cout << " sparrow paramters:" << endl << *parameters << endl;
#endif
// Initialize server daemon.
Service service;
cout << "initialized" << endl;
Miro::PositionIDL startPos, current;
service.reactorTask.open(NULL);
int ticks = 0;
int niterations = 10;
if (argc > 1)
niterations = ACE_OS::atoi(argv[1]);
cout << "start test" << endl;
try {
ACE_Sample_History history (niterations);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (int i = 0; i < niterations; ++i) {
service.connection.setPower(0, 0);
ACE_OS::sleep(ACE_Time_Value(1, (int)floor(rand1() * 100000.)));
startPos = service.odometryImpl->getPosition();
cout << "start position:" << startPos << endl;
ACE_hrtime_t start = ACE_OS::gethrtime ();
service.connection.setPower(10000, 10000);
do {
current = service.odometryImpl->getWaitPosition();
++ticks;
}
while (startPos.point.x == current.point.x &&
startPos.point.y == current.point.y &&
startPos.heading == current.heading);
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
service.connection.setPower(0, 0);
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "test finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
history.dump_samples ("HISTORY", gsf);
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results ("Total", gsf);
ACE_Throughput_Stats::dump_throughput ("Total", gsf,
test_end - test_start,
stats.samples_count ());
// data evaluation
cout << "ticks: " << ticks << endl;
cout << "end position: " << current << endl;
}
catch (const Miro::Exception & e) {
cerr << "Miro exception thrown:" << e << endl;
return 1;
}
service.reactorTask.cancel();
return 0;
}
示例8: catch
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
int priority =
(ACE_Sched_Params::priority_min (ACE_SCHED_FIFO)
+ ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2;
// Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
priority,
ACE_SCOPE_PROCESS)) != 0)
{
if (ACE_OS::last_error () == EPERM)
{
ACE_DEBUG ((LM_DEBUG,
"client (%P|%t): user is not superuser, "
"test runs in time-shared class\n"));
}
else
ACE_ERROR ((LM_ERROR,
"client (%P|%t): sched_params failed\n"));
}
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var object =
orb->string_to_object (ior);
Test::Roundtrip_var roundtrip =
Test::Roundtrip::_narrow (object.in ());
if (CORBA::is_nil (roundtrip.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Nil Test::Roundtrip reference <%s>\n",
ior),
1);
}
/// Begin the test
ACE_DEBUG ((LM_DEBUG, "Starting threads\n"));
Client_Task task0 (data_type, sz, roundtrip.in (), niterations);
Client_Task task1 (data_type, sz, roundtrip.in (), niterations);
Client_Task task2 (data_type, sz, roundtrip.in (), niterations);
Client_Task task3 (data_type, sz, roundtrip.in (), niterations);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
task0.activate (THR_NEW_LWP | THR_JOINABLE);
task1.activate (THR_NEW_LWP | THR_JOINABLE);
task2.activate (THR_NEW_LWP | THR_JOINABLE);
task3.activate (THR_NEW_LWP | THR_JOINABLE);
task0.thr_mgr()->wait ();
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "Threads finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
ACE_Basic_Stats totals;
task0.accumulate_and_dump (totals, ACE_TEXT("Task[0]"), gsf);
task1.accumulate_and_dump (totals, ACE_TEXT("Task[1]"), gsf);
task2.accumulate_and_dump (totals, ACE_TEXT("Task[2]"), gsf);
task3.accumulate_and_dump (totals, ACE_TEXT("Task[3]"), gsf);
totals.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf,
test_end - test_start,
totals.samples_count ());
if (do_shutdown)
{
roundtrip->shutdown ();
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例9: history
int
Latency_Query_Client::run (void)
{
// CORBA::DefinitionKind dk;
CORBA::AttributeMode am;
try
{
for (int j = 0; j < 100; ++j)
{
am = this->attr_->mode ();
if (am != CORBA::ATTR_NORMAL)
{
return -1;
}
}
ACE_Sample_History history (this->iterations_);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (CORBA::ULong i = 0; i < this->iterations_; ++i)
{
ACE_hrtime_t start = ACE_OS::gethrtime ();
am = this->attr_->mode ();
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
if (this->debug_)
{
ACE_DEBUG ((LM_DEBUG,
"test finished\n"));
ACE_DEBUG ((LM_DEBUG,
"High resolution timer calibration...."));
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG,
"done\n"));
if (this->do_dump_history_)
{
history.dump_samples (ACE_TEXT("HISTORY"), gsf);
}
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"),
gsf,
test_end - test_start,
stats.samples_count ());
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Latency_Query_Client::run:");
return -1;
}
return 0;
}
示例10: main
int main(int argc, char * argv[])
{
Server server(argc, argv);
SparrowMotion_var motion = server.resolveName<SparrowMotion>("Motion");
Odometry_var odometry = server.resolveName<Odometry>("Odometry");
PositionIDL startPos, current;
int ticks = 0;
int niterations = 10;
if (argc > 1)
niterations = ACE_OS::atoi(argv[1]);
cout << "start test" << endl;
try {
ACE_Sample_History history (niterations);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (int i = 0; i < niterations; ++i) {
motion->setLRPower(0, 0);
ACE_OS::sleep(ACE_Time_Value(1, (int)floor(rand1() * 100000.)));
startPos = odometry->getPosition();
cout << "start position:" << startPos << endl;
ACE_hrtime_t start = ACE_OS::gethrtime ();
motion->setLRPower(10000, 10000);
do {
current = odometry->getWaitPosition();
++ticks;
}
while (startPos.point.x == current.point.x &&
startPos.point.y == current.point.y &&
startPos.heading == current.heading);
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
motion->setLRPower(0, 0);
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "test finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
history.dump_samples ("HISTORY", gsf);
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results ("Total", gsf);
ACE_Throughput_Stats::dump_throughput ("Total", gsf,
test_end - test_start,
stats.samples_count ());
// data evaluation
cout << "ticks: " << ticks << endl;
cout << "end position: " << current << endl;
}
catch (const Miro::Exception & e) {
cerr << "Miro exception thrown:" << e << endl;
return 1;
}
return 0;
}
示例11: get_opt
//.........这里部分代码省略.........
case 'd':
TAO_debug_level++;
break;
case 'i':
insertion = 1;
break;
case 'e':
insertion = 0;
break;
case 'n':
n = ACE_OS::atoi (get_opt.opt_arg ());
break;
case '?':
default:
ACE_DEBUG ((LM_DEBUG,
"Usage: %s "
"-d debug"
"-n <num> "
"\n",
argv[0]));
return -1;
}
}
CORBA::Boolean result = 0;
int j;
{
CORBA::Object_var obj =
orb->string_to_object ("corbaloc:iiop:localhost:1234/Foo/Bar");
Param_Test_var param_test =
TAO::Narrow_Utils<Param_Test>::unchecked_narrow (obj.in ());
TAO_Stub *stub = param_test->_stubobj ();
stub->type_id = CORBA::string_dup ("IDL:Param_Test:1.0");
ACE_Sample_History history (n);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (j = 0; j != n; ++j)
{
CORBA::Any any;
if (insertion == 1)
{
ACE_hrtime_t start = ACE_OS::gethrtime ();
any <<= param_test.in ();
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
Param_Test_ptr o;
result = any >>= o;
}
else
{
any <<= param_test.in ();
Param_Test_ptr o;
ACE_hrtime_t start = ACE_OS::gethrtime ();
result = any >>= o;
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
}
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
if (insertion == 1)
{
ACE_DEBUG ((LM_DEBUG,
"Objref insertion test finished\n"));
}
else
{
ACE_DEBUG ((LM_DEBUG,
"Objref extraction test finished\n"));
}
ACE_DEBUG ((LM_DEBUG,
"High resolution timer calibration...."));
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG,
"done\n"));
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"),
gsf,
test_end - test_start,
stats.samples_count ());
}
示例12:
void
test_i::end_test (void)
{
// Record end time.
this->test_end_ =
ACE_OS::gethrtime ();
if (do_dump_history)
{
this->inter_arrival_times_->dump_samples (ACE_TEXT("Inter-arrival times"), gsf);
}
ACE_Basic_Stats stats;
this->inter_arrival_times_->collect_basic_stats (stats);
ACE_DEBUG ((LM_DEBUG,
"Max Latency = %6d ",
stats.max_ / gsf / 1000));
ACE_DEBUG ((LM_DEBUG,
"Invocations expected / received / missed / missed %% = %6d / %6d / %6d / %5.2f\n",
this->iterations_,
this->number_of_invocations_received_,
this->iterations_ - this->number_of_invocations_received_,
(this->iterations_ - this->number_of_invocations_received_) / (double) this->iterations_ * 100));
if (print_missed_invocations)
{
ACE_DEBUG ((LM_DEBUG, "\nFollowing invocations were never received:\n"));
for (CORBA::ULong i = 0;
i < this->iterations_;
++i)
{
if (this->invocations_received_[i] == 0)
{
ACE_DEBUG ((LM_DEBUG,
"%d ",
i));
}
}
ACE_DEBUG ((LM_DEBUG, "\n"));
}
if (TAO_debug_level > 0)
{
ACE_DEBUG ((LM_DEBUG,
"Session id ends %d\n",
this->session_id_));
stats.dump_results (ACE_TEXT("Inter-arrival times"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Inter-arrival times"),
gsf,
this->test_end_ - this->test_start_,
stats.samples_count ());
}
this->session_id_ = -1;
delete this->inter_arrival_times_;
}
示例13: history
void
MyImpl::RoundTripClient_exec_i::start ()
{
///////////// Start test /////////////////////////////////////////
// Let's try to start tests from here...
Benchmark::LatencyTest_var lt =
context_->get_connection_latency ();
ACE_DEBUG ((LM_INFO,
"MyImpl::RoundTripClient_exec::start obtain obj ref\n"));
CORBA::Long test_data = 0L;
//Warm up the system
int i = 0;
for (i=0; i < 100; i++)
lt->makeCall (test_data);
ACE_DEBUG ((LM_DEBUG, "MyImpl::start: warmed up the system\n"));
ACE_Sample_History history (niterations);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (i = 0; i < niterations; ++i)
{
ACE_hrtime_t start = ACE_OS::gethrtime ();
//Test value to be sent to the server
long test = 0;
(void) lt->makeCall (test);
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "test finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
ACE_Env_Value<int> envar (ACE_TEXT("CIAO_DUMP_SAMPLE_HISTORY"), 0);
if (envar != 0)
{
history.dump_samples (ACE_TEXT("HISTORY"), gsf);
}
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"),
gsf,
test_end - test_start,
stats.samples_count ());
}