Пример #1
0
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
0
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"
                ));
    }
}