summaryrefslogtreecommitdiff
path: root/performance-tests/Synch-Benchmarks/Options.h
blob: fccec81e3bd298ac078af96394972b19ffabb201 (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
/* -*- C++ -*- */
// $Id$

// Option manager for performance tests.

#if !defined (_OPTIONS_H)
#define _OPTIONS_H

#include "ace/OS.h"
#include "ace/Profile_Timer.h"
#include "ace/Log_Msg.h"
#include "ace/Thread_Manager.h"

#if defined (ACE_HAS_THREADS)

class Options
{
public:
  Options (void);
  void   parse_args (int argc, char *argv[]);

  void   init (void);

  void   start_timer (void);
  void   stop_timer (void);
  
  void   thr_count (size_t count);
  size_t thr_count (void);

  void   pipe_addr (char pipe[]);
  char   *pipe_addr (void);

  void   mapped_file (char filename[]);
  char   *mapped_file (void);

  void   service_entry (char *service_entry);
  char   *service_entry (void);

  void   sleep_time (size_t count);
  size_t sleep_time (void);

  void   logical_connections (size_t count);
  size_t logical_connections (void);

  void   physical_connections (size_t count);
  size_t physical_connections (void);

  void   consecutive_ports (size_t count);
  size_t consecutive_ports (void);

  void   initial_queue_length (size_t length);
  size_t initial_queue_length (void);

  void   high_water_mark (size_t size);
  size_t high_water_mark (void);

  void   low_water_mark (size_t size);
  size_t low_water_mark (void);

  void   msg_size (size_t size);
  size_t msg_size (void);

  void   iterations (size_t n);
  size_t iterations (void);

  void   n_lwps (size_t n);
  size_t n_lwps (void);

  void   t_flags (long flag);
  long   t_flags (void);

  size_t count (void);

  int    debug (void);
  int    verbose (void);
  int    do_checksum (void);
  int    do_generate (void);
  int    do_ack (void);
  int    do_delete (void);
  int    do_eager_exit (void);
  int    do_print_summary (void);
  int    do_udp (void);
  int    do_xdr (void);
  int    do_zero_copy (void);
  void   print_results (void);

  ACE_Atomic_Op<ACE_Thread_Mutex, size_t> msg_count;        // Keep track of number of messages atomically.
  int *thr_work_count;  // Count activity per-thread.
  int thr_wc_size;	     // Max number of threads.

private:
  ACE_Profile_Timer _itimer;	        // Keep track of time.
  char		*_service_entry;        // Name of the shared object file and shared object.
  char		*_mapped_file;          // Name of the mapped file.
  char		*_pipe_addr;            // Name of the STREAM pipe.
  size_t	_sleep_time;            // Time to sleep.
  size_t	_n_lwps;                // Number of LWPs.
  size_t	_thr_count;             // Number of threads to spawn.
  long		_t_flags;               // Flags to thr_create().
  size_t	_high_water_mark;       // ACE_Queue high water mark.
  size_t	_low_water_mark;        // ACE_Queue low water mark.
  size_t	_msg_size;              // Size of a message.
  size_t	_initial_queue_length;  // Initial number of items in the queue.
  size_t	_logical_connections;   // Number of logical connections.
  size_t	_physical_connections;  // Number of physical connections.
  size_t	_iterations;            // Number of iterations to run the test program.
  int		_generate;              // Generate the data.
  int		_udp;                   // Use UDP format.
  int		_debugging;             // Extra debugging info.
  int		_verbosity;             // Extra verbose messages.
  int		_ack;                   // Do an acknowledgement.
  int		_checksum;              // Is checksumming enabled?.
  int		_xdr;                   // Is xdr conversion enabled?.
  int		_free_memory;           // Are we freeing up memory?.
  int		_zero_copy;             // Implement a zero-copy driver?.
  int		_print_summary;         // Print a summary of the results only.
  int		_consecutive_ports;     // Number of consecutive messages from same port.
  int		_eager_exit;            // Exit eagerly, without cleaning up.
};

// Make this available to any code that wants to see it!
extern Options options;

#include "Options.i"
#endif /* ACE_HAS_THREADS */
#endif /* _OPTIONS_H */