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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/**
* @file Send_Task.cpp
*
* $Id$
*
* @author Carlos O'Ryan <coryan@uci.edu>
*/
#include "Send_Task.h"
#include "orbsvcs/Time_Utilities.h"
ACE_RCSID(EC_Colocated_Latency, Send_Task, "$Id$")
ECCL_Send_Task::ECCL_Send_Task (void)
: iterations_ (0)
, period_in_usecs_ (0)
, event_type_ (0)
, event_source_ (0)
, barrier_ (0)
{
}
void
ECCL_Send_Task::init (int iterations,
int period_in_usecs,
int event_type,
int event_source,
ECCL_Supplier *supplier,
ACE_Barrier *barrier)
{
this->iterations_ = iterations;
this->period_in_usecs_ = period_in_usecs;
this->event_type_ = event_type;
this->event_source_ = event_source;
this->supplier_ = Servant_var<ECCL_Supplier> (supplier);
this->barrier_ = barrier;
}
int
ECCL_Send_Task::svc (void)
{
if (this->barrier_ == 0)
return -1;
this->barrier_->wait ();
RtecEventComm::EventSet event (1);
event.length (1);
event[0].header.type = this->event_type_;
event[0].header.source = this->event_source_;
event[0].header.ttl = 1;
ACE_Time_Value period (0, this->period_in_usecs_);
for (int i = 0; i != this->iterations_; ++i)
{
ACE_OS::sleep (period);
ACE_hrtime_t creation = ACE_OS::gethrtime ();
ORBSVCS_Time::hrtime_to_TimeT (event[0].header.creation_time,
creation);
// push one event...
this->supplier_->push (event ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
return 0;
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
|