本文整理汇总了C++中cosnotification::NotificationServiceMonitorControl_var::get_statistic方法的典型用法代码示例。如果您正苦于以下问题:C++ NotificationServiceMonitorControl_var::get_statistic方法的具体用法?C++ NotificationServiceMonitorControl_var::get_statistic怎么用?C++ NotificationServiceMonitorControl_var::get_statistic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cosnotification::NotificationServiceMonitorControl_var
的用法示例。
在下文中一共展示了NotificationServiceMonitorControl_var::get_statistic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
void
MonitorTestInterface_i::consumer_stats_check()
{
bool foundConsumerStats = false;
Monitor::NameList_var names = nsm_->get_statistic_names ();
CORBA::ULong length = names->length ();
for(CORBA::ULong i = 0; i < length; i++)
{
const char * name = names[i].in ();
size_t slashcount = 0;
bool isConsumerQueueSize = false;
for (size_t nCh = 0; name[nCh] != 0 && slashcount < 3; ++nCh)
{
if (name[nCh] == '/')
{
slashcount += 1;
if(slashcount == 3)
{
isConsumerQueueSize = 0 == ACE_OS::strcmp(
&name[nCh + 1],
NotifyMonitoringExt::EventChannelQueueSize);
}
}
}
if (isConsumerQueueSize)
{
foundConsumerStats = true;
// We have a consumer queue
try
{
Monitor::Data_var queueSizeData =
nsm_->get_statistic(name);
Monitor::Numeric queueSizeNum = queueSizeData->data_union.num ();
ACE_DEBUG ((LM_DEBUG, "Monitor: %s: Average: %f, Maximum: %f, Most recent: %f\n",
name,
queueSizeNum.average, queueSizeNum.maximum, queueSizeNum.last));
if (queueSizeNum.average <= 0.0 || queueSizeNum.average > 2000.0)
ACE_ERROR ((LM_ERROR, "Monitor: ERROR: %s average queue size [%f] should be greater than zero and less than 2000.\n",
name,
queueSizeNum.average));
if (queueSizeNum.last > 2000.0)
ACE_ERROR ((LM_ERROR, "Monitor: ERROR: %s most recent queue size [%f] should not be greater than 2000.\n",
name,
queueSizeNum.last));
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception (name);
}
}
}
if(! foundConsumerStats)
{
ACE_ERROR ((LM_ERROR, "Monitor: ERROR: No consumer queue size statistics found.\n"
));
}
}
示例2: switch
void
MonitorTestInterface_i::stat_dump (const char * statName)
{
try
{
Monitor::Data_var data = nsm_->get_statistic(statName);
switch (data->data_union._d())
{
case Monitor::DATA_NUMERIC:
{
ACE_DEBUG ((LM_DEBUG, "Numeric: %s\n", statName));
Monitor::Numeric num = data->data_union.num();
ACE_DEBUG ((LM_DEBUG, " count: %d, average: %f; sumsq: %f, min: %f, max: %f: last %f\n",
(unsigned int)num.count, num.average, num.sum_of_squares, num.minimum, num.maximum, num.last));
break;
}
default:
{
Monitor::NameList list = data->data_union.list ();
size_t len = list.length ();
ACE_DEBUG ((LM_DEBUG, "Text[%d]: %s\n", (int)len, statName));
for (size_t i = 0; i < len; i++)
{
ACE_CString str = list[i].in ();
ACE_DEBUG ((LM_DEBUG, " %d: %s\n", (int)i, str.c_str()));
}
break;
}
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception (statName);
}
}