⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 metrics_localcache_t.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
📖 第 1 页 / 共 2 页
字号:


                    // Keep looking for the end of the interval
                    // after the resume event.
                     stop_or_suspend_evt_ndx = resume_evt_ndx;
                    break;
                 }
                  else if (is_event (this->timeprobes ()[resume_evt_ndx],
                                     ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_START) ||
                           is_event (this->timeprobes ()[resume_evt_ndx],
                                     ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_STOP) ||
                           is_event (this->timeprobes ()[resume_evt_ndx],
                                     ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_SUSPEND))
                 {
                    // Something went wrong during the current interval:
                    // just ignore the previous start time stamp.
                    good_interval = 0;
                    break;
                 }

                  resume_evt_ndx = (resume_evt_ndx + 1) % this ->max_size_; // Modulus increment: loops around at the end.

               } while (resume_evt_ndx != this->current_size_);
            }

            // If we got a start event, make sure that we don't see another start or resume
            // until we see a stop or suspend event
            else if (is_event (this->timeprobes ()[stop_or_suspend_evt_ndx],
                               ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_START) ||
                     is_event (this->timeprobes ()[stop_or_suspend_evt_ndx],
                               ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_RESUME))
           {
              // Something went wrong during the current interval:
              // just ignore the previous start time stamp.
              break;
           }

            stop_or_suspend_evt_ndx = (stop_or_suspend_evt_ndx + 1) % this ->max_size_; // Modulus increment: loops around at the end.

            } while (stop_or_suspend_evt_ndx != this->current_size_ && good_interval);

            // If we found the stop of
            start_evt_ndx = stop_or_suspend_evt_ndx;
        }

        start_evt_ndx = (start_evt_ndx + 1) % this ->max_size_; // Modulus increment: loops around at the end.

    } while (start_evt_ndx < this->current_size_);


    if (report_full_interval_times)
    {
       // Increase the length of the data set and record the full interval.
       ++data_set_length;
       data_set->length (data_set_length);
       (*(data_set))[data_set_length-1].is_full_interval = 1;
       (*(data_set))[data_set_length-1].probe_id = this->id_;
       (*(data_set))[data_set_length-1].is_operation = this->is_operation_;
       (*(data_set))[data_set_length-1].is_hrt = this->is_hrt_;
       (*(data_set))[data_set_length-1].cross_thread_probe = any_cross_thread_event;
       ORBSVCS_Time::Time_Value_to_TimeT
          ((*(data_set)) [data_set_length-1].start_event_time,
          this->timeprobes ()[start_evt_ndx].time_);
       ORBSVCS_Time::Time_Value_to_TimeT
          ((*(data_set)) [data_set_length-1].stop_event_time,
          this->timeprobes ()[stop_evt_ndx].time_);
       ORBSVCS_Time::Time_Value_to_TimeT(
          (*(data_set))[data_set_length-1].interval,
          full_stop_time - full_start_time);
    }
}


// Flush the TAO metrics local timeprobe into shared memory.

template <class ACE_LOCK, class ALLOCATOR>
void
TAO_Metrics_LocalTimeprobe<ACE_LOCK, ALLOCATOR>::flush_TAO_Metrics_LocalTimeprobe ()
{
// TBD - 1) replace VXWORKS with a nicer ACE/TAO #define
//       2) provide a general capability to apply an arbitrary
//          functor to the whole data structure framework (e.g., flush).

#if defined VXWORKS
  // TBD - implement this
#endif
}


//////////////////////////////////
// Class TAO_Metrics_LocalCache //
//////////////////////////////////


template <class ACE_LOCK, class ALLOCATOR>
void
TAO_Metrics_LocalCache<ACE_LOCK, ALLOCATOR>::reset_statistics ()
{
  // Call the base class reset method first.
  this->reset_base_statistics ();

  // Iterate over consumer side base map,
  // resetting probes.
  METRICS_BASE_MONITOR_MAP_ITERATOR
    base_iter (this->base_monitor_maps_ [this->consumer_index_]);

  for (TAO_Metrics_Cache_Data_Base * data_base = 0;
       base_iter.done () == 0;
       ++base_iter)
    {
          // Modified by BRM.  This should also work for ACE_Based_Pointer since the conversion
          // operator should fire.
//          data_base = (*base_iter).int_id_.addr ();
          data_base = (*base_iter).int_id_;
      // Modified by BRM.  This should also work for ACE_Based_Pointer since the conversion
      // operator should fire.
//      if (data_base.addr ())
      if (data_base)
      {
         data_base->probe.reset ();
      }
    }


  // Iterate over consumer side monitor map,
  // resetting counts and probes.
  METRICS_MONITOR_MAP_ITERATOR data_iter (this->
                                            monitor_maps_ [this->
                                                             consumer_index_]);
  for (TAO_Metrics_Cache_Data * data = 0;
       data_iter.done () == 0;
       ++data_iter)
    {
          // Modified by BRM.  This should also work for ACE_Based_Pointer since the conversion
          // operator should fire.
//          data = (*data_iter).int_id_.addr ();
          data = (*data_iter).int_id_;
      if (data)
        {
          data->probe.reset ();
          data->missed_deadlines = 0;
          data->made_deadlines = 0;
          data->cancellations = 0;
        }
    }
}


// Flush the TAO local metrics cache into shared memory.

template <class ACE_LOCK, class ALLOCATOR>
void
TAO_Metrics_LocalCache<ACE_LOCK, ALLOCATOR>::
flush_TAO_Metrics_LocalCache ()
{
#if defined VXWORKS

  // TBD - fix this: is it complete?

  // TBD - add base metrics map flush

  // TBD - do probes need their own flush method?

  // flush the class
  // cacheFlush (
  //   DATA_CACHE,
  //   this,
  //   sizeof (TAO_Metrics_LocalCache<ACE_LOCK, ALLOCATOR>));

  // flush the monitor data map hash table
  // cacheFlush (DATA_CACHE,
  //             &monitor_maps_ [this->consumer_index_],
  //             sizeof (METRICS_MONITOR_MAP));

  // flush the nodes in the monitor data map hash table
  // and the data stored in the nodes.
  // METRICS_MONITOR_MAP_ITERATOR data_iter (this->
  //        monitor_maps_ [this->
  //                         consumer_index_]);
  // for (;
  //      data_iter.done () == 0;
  //      ++data_iter)
  //   {
  //     METRICS_MONITOR_MAP_ENTRY *entry;
  //     data_iter.next (entry);
  //     if (entry)
  //       {
  //         cacheFlush (DATA_CACHE,
  //         entry,
  //         sizeof (METRICS_MONITOR_MAP_ENTRY));
  //         if (entry->int_id_.addr ())
  //           {
  //           cacheFlush (DATA_CACHE,
  //                       entry->int_id_.addr (),
  //                       sizeof (TAO_Metrics_Cache_Data));
  //           }
  //       }
  //   }

  // flush the base class probe counts
  // cacheFlush (DATA_CACHE,
  //             this->
  //               enqueue_count_ [this->consumer_index_].addr (),
  //             this->probe_set_size_ * sizeof (u_long));

  // cacheFlush (DATA_CACHE,
  //             this->
  //               dequeue_count_ [this->consumer_index_].addr (),
  //             this->probe_set_size_ * sizeof (u_long));

  // flush the base class probe pointer arrays
  // cacheFlush (
  //   DATA_CACHE,
  //   this->enqueue_probes_ [this->consumer_index_],
  //   this->
  //     probe_set_size_
  //   * sizeof (ACE_Metrics_Timeprobe<ACE_LOCK,ALLOCATOR> *));
  // cacheFlush (
  //   DATA_CACHE,
  //   this->dequeue_probes_ [this->consumer_index_],
  //   this->probe_set_size_
  //   * sizeof (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> *));

  // flush the base class probes
  // for (u_int i = 0; i < this->probe_set_size_; ++i)
  //   {
  //    cacheFlush (
  //      DATA_CACHE,
  //      this->enqueue_probes_ [this->consumer_index_][i],
  //      sizeof (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>));
  //    cacheFlush (
  //      DATA_CACHE,
  //      this->dequeue_probes_ [this->consumer_index_][i],
  //      sizeof (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>));
  //   }
#endif
}

#if !defined (__ACE_INLINE__)
#include "Metrics_LocalCache_T.i"
#endif /* __ACE_INLINE__ */

#endif /* METRICS_LOCAL_CACHE_T_CPP */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -