本文整理汇总了C++中cosnotification::NotificationServiceMonitorControl_var::get_statistic_names方法的典型用法代码示例。如果您正苦于以下问题:C++ NotificationServiceMonitorControl_var::get_statistic_names方法的具体用法?C++ NotificationServiceMonitorControl_var::get_statistic_names怎么用?C++ NotificationServiceMonitorControl_var::get_statistic_names使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cosnotification::NotificationServiceMonitorControl_var
的用法示例。
在下文中一共展示了NotificationServiceMonitorControl_var::get_statistic_names方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void
MonitorTestInterface_i::brain_dump(const char * /*context*/)
{
#if 0 // verbose output should be controlled via a command line option
ACE_DEBUG ((LM_DEBUG, "\nStatistics as of: %s\n", context));
// Temporary::Dale: Dump known names
CosNotification::NotificationServiceMonitorControl::NameList_var names =
nsm_->get_statistic_names ();
CORBA::ULong length = names->length ();
ACE_DEBUG ((LM_DEBUG, "Statistic names [%d]\n", (int)length));
// It's much easier to read once it's sorted
const char** narray = 0;
ACE_NEW_THROW_EX (narray,
const char* [length],
CORBA::NO_MEMORY ());
for(CORBA::ULong i = 0; i < length; i++)
narray[i] = names[i].in ();
ACE_OS::qsort (narray, length,
sizeof (const char*), sorter);
for(CORBA::ULong i = 0; i < length; i++)
{
stat_dump(narray[i]);
}
delete [] narray;
#endif // verbose option
}
示例2: 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"
));
}
}