summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Callback/Callback.cpp
blob: be8d7d607e5360c4d923c7453b43b6dbba2d3805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "Callback.h"
#include "Implicit_Deactivator.h"
#include "ace/OS_NS_time.h"

Callback::Callback (int iterations,
                    PortableServer::POA_ptr poa)
  : sample_history_ (iterations)
  , poa_ (PortableServer::POA::_duplicate (poa))
{
}

ACE_Sample_History &
Callback::sample_history ()
{
  return this->sample_history_;
}

void
Callback::sample (Test::Timestamp the_timestamp)
{
  ACE_hrtime_t elapsed = ACE_OS::gethrtime () - the_timestamp;

  ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
  if (sample_history_.max_samples () == sample_history_.sample_count ())
    return;
  this->sample_history_.sample (elapsed);
}

PortableServer::POA_ptr
Callback::_default_POA ()
{
  return PortableServer::POA::_duplicate (this->poa_.in ());
}