1 #include "Thread_Task.h"
2 #include "DT_Creator.h"
3 #include "Task_Stats.h"
5 #include "tao/ORB_Core.h"
7 #include "ace/High_Res_Timer.h"
8 #include "ace/Atomic_Op.h"
10 Thread_Task::Thread_Task (void)
25 Thread_Task::svc (void)
29 if (TAO_debug_level
> 0)
32 "Thread_Task::svc %d\n",
36 const char * name
= 0;
37 CORBA::Policy_var implicit_sched_param
= CORBA::Policy::_duplicate (sched_param_
.in ());;
38 this->current_
->begin_scheduling_segment (name
,
40 implicit_sched_param
.in ());
42 RTScheduling::Current::IdType_var guid
= this->current_
->id ();
43 ACE_OS::memcpy (&count_
,
47 ACE_TCHAR msg
[BUFSIZ
];
49 ACE_TEXT("Thread_Task::svc Imp=%d Guid=")
50 ACE_SIZE_T_FORMAT_SPECIFIER
55 dt_creator_
->log_msg (ACE_TEXT_ALWAYS_CHAR(msg
));
57 this->perform_task ();
59 this->current_
->end_scheduling_segment (name
);
61 dt_creator_
->dt_ended () ;
63 catch (const CORBA::THREAD_CANCELLED
&)
65 // Threads can be cancelled.
67 catch (const CORBA::Exception
& ex
)
69 ex
._tao_print_exception ("Caught exception:");
75 Thread_Task::importance (void)
77 return this->importance_
;
81 Thread_Task::start_time (void)
83 return this->start_time_
;
87 Thread_Task::perform_task (void)
94 Thread_Task::job (void)
96 return job_name_
.in ();
100 Thread_Task::job (Job_ptr job
)
102 job_
= Job::_duplicate (job
);
106 Thread_Task::dist (void)
112 Thread_Task::dump_stats (void)
114 ACE_TCHAR fname
[BUFSIZ
];
115 ACE_OS::sprintf (fname
,
117 ACE_SIZE_T_FORMAT_SPECIFIER
121 if (TAO_debug_level
> 0)
122 ACE_DEBUG ((LM_DEBUG
,
126 ACE_TCHAR msg
[BUFSIZ
];
127 ACE_OS::sprintf (msg
,
128 ACE_TEXT("#Schedule Output for DT ")
129 ACE_SIZE_T_FORMAT_SPECIFIER
,
132 task_stats_
->dump_samples (fname
, msg
);