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
|
/**
* @file Client_Options.cpp
*
* $Id$
*
* @author Carlos O'Ryan <coryan@uci.edu>
*/
#include "Client_Options.h"
#include "ace/Arg_Shifter.h"
#include "ace/Log_Msg.h"
#include "ace/OS.h"
ACE_RCSID (TAO_PERF_RTEC,
Client_Options,
"$Id$")
Client_Options::Client_Options (int &argc, char *argv[])
: ior ("file://test.ior")
, iterations (1000)
, nthreads (0)
, high_priority_period (0)
, high_priority_workload (0)
, low_priority_period (0)
, low_priority_workload (0)
, low_priority_consumers (0)
, dump_history (0)
, use_rt_corba (0)
, global_low_priority_rate (0)
, unique_low_priority_event (0)
, funky_supplier_publication (0)
, high_priority_is_last (0)
{
ACE_TArg_Shifter<char> arg_shifter (argc, argv);
while (arg_shifter.is_anything_left ())
{
const char *arg = arg_shifter.get_current ();
if (ACE_OS::strcmp (arg, "-k") == 0)
{
arg_shifter.consume_arg ();
if (arg_shifter.is_parameter_next ())
{
this->ior = arg_shifter.get_current ();
arg_shifter.consume_arg ();
}
}
else if (option (arg_shifter, "-i", iterations)) {}
else if (option (arg_shifter, "-n", nthreads)) {}
else if (option (arg_shifter, "-h", high_priority_period)) {}
else if (option (arg_shifter, "-l", low_priority_period)) {}
else if (option (arg_shifter, "-w", low_priority_workload)) {}
else if (option (arg_shifter, "-v", high_priority_workload)) {}
else if (option (arg_shifter, "-c", low_priority_consumers)) {}
else if (boolean_option (arg_shifter, "-d", dump_history)) {}
else if (boolean_option (arg_shifter, "-r", use_rt_corba)) {}
else if (boolean_option (arg_shifter, "-g", global_low_priority_rate)) {}
else if (boolean_option (arg_shifter, "-u", unique_low_priority_event)) {}
else if (boolean_option (arg_shifter, "-f", funky_supplier_publication)) {}
else if (boolean_option (arg_shifter, "-x", high_priority_is_last)) {}
else
{
arg_shifter.ignore_arg ();
}
}
}
int
Client_Options::option (ACE_TArg_Shifter<char> &arg_shifter,
const char *option_name,
int &option_value)
{
if (ACE_OS::strcmp (arg_shifter.get_current (), option_name) != 0)
return 0;
arg_shifter.consume_arg ();
if (arg_shifter.is_parameter_next ())
{
option_value = ACE_OS::atoi (arg_shifter.get_current ());
arg_shifter.consume_arg ();
}
else
{
ACE_DEBUG ((LM_DEBUG,
"Missing value for option '%s'\n", option_name));
}
return 1;
}
int
Client_Options::boolean_option (ACE_TArg_Shifter<char> &arg_shifter,
const char *option_name,
int &option_value)
{
if (ACE_OS::strcmp (arg_shifter.get_current (), option_name) != 0)
return 0;
arg_shifter.consume_arg ();
option_value = 1;
return 1;
}
|