summaryrefslogtreecommitdiff
path: root/TAO/tests/RTCORBA/Priority_Inversion_With_Bands/test_i.h
blob: 5f5d29c15d15922f41d36113dee07d3479aeabd4 (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
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
//=============================================================================
/**
 *  @file   test_i.h
 *
 *  $Id$
 *
 *  @author Irfan Pyarali
 */
// ===================================================================

#include "testS.h"
#include "tao/RTCORBA/RTCORBA.h"

class test_i :
  public POA_test,
  public PortableServer::RefCountServantBase
{
public:
  /// Constructor.
  test_i (CORBA::ORB_ptr orb,
          PortableServer::POA_ptr poa,
          RTCORBA::Priority low_priority,
          RTCORBA::Priority high_priority);

  /// Initialize the server.
  void initialize (CORBA::ULong total_iterations
                   ACE_ENV_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));

  /// Test method.
  void method (CORBA::ULong work,
               const char *iteration
               ACE_ENV_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));

  /// Our POA.
  PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL);

  /// Work (burn CPU).
  void work (CORBA::ULong work);

  /// Estimates work iterations performed per second.
  int estimate_iterations (void);

private:
  /// ORB.
  CORBA::ORB_var orb_;

  /// Our POA.
  PortableServer::POA_var poa_;

  /// Value for low priority.
  RTCORBA::Priority low_priority_;

  /// Value for high priority.
  RTCORBA::Priority high_priority_;

  // RTCORBA Current.
  RTCORBA::Current_var rt_current_;

  /// Number of work iterations that can be performed in one second.
  int work_iterations_in_one_sec_;

  /// Prime number used for burning CPU.
  CORBA::ULong prime_number_;

  /// Current iteration.
  CORBA::ULong current_iteration_;

  /// Total iterations for this test.
  CORBA::ULong total_iterations_;
};