Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / performance-tests / RTEvent / lib / RT_Class.cpp
blob1ddb29e57e0f8cdefa9c16ff602e57f719677e31
1 /**
2 * @file RT_Class.cpp
4 * @author Carlos O'Ryan <coryan@uci.edu>
5 */
7 #include "RT_Class.h"
9 #include "ace/Log_Msg.h"
10 #include "ace/OS_NS_errno.h"
12 #if !defined(__ACE_INLINE__)
13 #include "RT_Class.inl"
14 #endif /* __ACE_INLINE__ */
16 RT_Class::RT_Class ()
17 : prc_sched_class_ (ACE_SCHED_FIFO)
18 , thr_sched_class_ (THR_SCHED_FIFO)
20 int priority =
21 (ACE_Sched_Params::priority_min (this->prc_sched_class_)
22 + ACE_Sched_Params::priority_max (this->prc_sched_class_)) / 2;
24 if (ACE_OS::sched_params (ACE_Sched_Params (this->prc_sched_class_,
25 priority,
26 ACE_SCOPE_PROCESS)) != 0)
28 if (ACE_OS::last_error () == EPERM)
30 ACE_DEBUG ((LM_DEBUG,
31 "WARNING (%P|%t) user does not have "
32 "permissions to run real-time tests.\n"
33 "The test will run in the time-shared "
34 "class, it may fail or produce unpredictable "
35 "results\n"));
36 this->prc_sched_class_ = ACE_SCHED_OTHER;
37 this->thr_sched_class_ = THR_SCHED_DEFAULT;
40 this->priority_low_ =
41 ACE_Sched_Params::priority_min (this->prc_sched_class_);
42 this->priority_high_ =
43 ACE_Sched_Params::priority_max (this->prc_sched_class_);
44 this->priority_process_ =
45 (this->priority_low_ + this->priority_high_) / 2;