summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/POA/Demux/demux_test_client.h
blob: a736ea627c6bd18cf11f7fa91e1f520cf8f9982c (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
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
#ifndef TAO_DEMUX_TEST_CLIENT_H
#define TAO_DEMUX_TEST_CLIENT_H

//=============================================================================
/**
 *  @file    demux_test_client.h
 *
 *  $Id$
 *
 *  Definition of the client-side demux_test class
 *
 *  @author Aniruddha Gokhale
 */
//=============================================================================


// FUZZ: disable check_for_math_include

#include "ace/Get_Opt.h"
#include "ace/Vector_T.h"
#include "demux_testC.h"
#include "demux_test_macros.h"
#include "tao/Intrusive_Ref_Count_Handle_T.h"

class Demux_Test_Client
{
public:

  // Request invocation strategies
  enum INVOKE_STRATEGY
  {
    LINEAR,
    RANDOM,
    BEST,
    WORST
  };

  typedef void (*OP_PTR) (Demux_Test_ptr);

  struct Operation_DB_Entry
  {
    OP_PTR op_;
  };

  /// CTOR
  Demux_Test_Client (void);

  /// DTOR
  ~Demux_Test_Client (void);

  /// initialize the client test bed
  int init (int argc, ACE_TCHAR *argv []);

  /// run the tests
  int run (void);

private:

  /// parse command line arguments
  int parse_args (void);

  /// initialize the operation database
  int init_operation_db (void);

  /// run linear strategy
  int run_linear_test (void);

  /// run random strategy
  int run_random_test (void);

  /// run best strategy (w.r.t to linear)
  int run_best_test (void);

  /// run worst strategy (w.r.t to linear)
  int run_worst_test (void);

  /// print results
  int print_results (void);

  /// number of command line arguments
  int argc_;

  /// the actual command line arguments
  ACE_TCHAR **argv_;

  /// The underlying ORB
  CORBA::ORB_var orb_;

  /// invocation strategy (default linear)
  INVOKE_STRATEGY is_;

  /// number of POAs
  CORBA::ULong num_POAs_;

  /// number of objects
  CORBA::ULong num_objs_;

  /// number of operations
  CORBA::ULong num_ops_;

  /// object references to the Demux_Test objects
  typedef TAO_Intrusive_Ref_Count_Handle<Demux_Test> Demux_Test_Var;
  typedef ACE_Vector<Demux_Test_Var> Demux_Test_Container;
  Demux_Test_Container demux_test_;

  /// number of times to invoke the request
  CORBA::ULong loop_count_;

  /// IOR database
  FILE *ior_fp_;

  /// temporary results file
  FILE *result_fp_;

  /**
   * Step for the no. of objects to be skipped while making remote calls
   * on the given no. of objects.
   * If the step is 100, a call will be made to every 100th Object.
   */
  CORBA::ULong step_;

  /// database of operations
  Operation_DB_Entry op_db_[TAO_DEMUX_TEST_MAX_OPS];

};


#endif /* TAO_DEMUX_TEST_CLIENT_H */