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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
//$Id$
#include "Thread_Task.h"
#include "DT_Creator.h"
#include "Task_Stats.h"
#include "tao/ORB_Core.h"
#include "ace/High_Res_Timer.h"
#include "ace/Atomic_Op.h"
Thread_Task::Thread_Task (void)
: start_time_ (0),
load_ (0),
iter_ (0),
count_ (0),
importance_ (0),
dt_creator_ (0),
base_time_ (0),
dist_ (0),
job_name_ (0),
task_stats_ (0)
{
}
int
Thread_Task::svc (void)
{
try
{
if (TAO_debug_level > 0)
{
ACE_DEBUG ((LM_DEBUG,
"Thread_Task::svc %d\n",
importance_));
}
const char * name = 0;
CORBA::Policy_var implicit_sched_param = CORBA::Policy::_duplicate (sched_param_.in ());;
this->current_->begin_scheduling_segment (name,
sched_param_.in (),
implicit_sched_param.in ());
ACE_OS::memcpy (&count_,
this->current_->id ()->get_buffer (),
this->current_->id ()->length ());
char msg [BUFSIZ];
ACE_OS::sprintf (msg,
"Thread_Task::svc Imp=%d Guid="
ACE_SIZE_T_FORMAT_SPECIFIER
"\n",
importance_,
count_);
dt_creator_->log_msg (msg);
this->perform_task ();
this->current_->end_scheduling_segment (name);
dt_creator_->dt_ended () ;
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught exception:");
}
return 0;
}
int
Thread_Task::importance (void)
{
return this->importance_;
}
time_t
Thread_Task::start_time (void)
{
return this->start_time_;
}
int
Thread_Task::perform_task (void)
{
return 0;
}
const char*
Thread_Task::job (void)
{
return job_name_;
}
void
Thread_Task::job (Job_ptr job)
{
job_ = Job::_duplicate (job);
}
int
Thread_Task::dist (void)
{
return this->dist_;
}
void
Thread_Task::dump_stats (void)
{
char fname [BUFSIZ];
ACE_OS::sprintf (fname,
"DT_"
ACE_SIZE_T_FORMAT_SPECIFIER
".dat",count_);
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"File name %s\n",
fname));
char msg [BUFSIZ];
ACE_OS::sprintf (msg,
"#Schedule Output for DT "
ACE_SIZE_T_FORMAT_SPECIFIER,
count_);
task_stats_->dump_samples (fname,
msg,
ACE_High_Res_Timer::global_scale_factor ());
}
|