summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/EC_Throughput/ECT_Driver.h
blob: 0124a535ba13170aa78bfe0eaa6c3112e3f4c81e (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
/* -*- C++ -*- */
// $Id$
//
// ============================================================================
//
// = DESCRIPTION
//   Abstract base class for the test driver, this let us implement a
//   collocated and a non-collocated test.
//
// ============================================================================

#ifndef ECT_DRIVER_H
#define ECT_DRIVER_H

#include "tao/corba.h"

class ECT_Driver
{
  //
  // = TITLE
  //
  // = DESCRIPTION
  //
public:
  virtual ~ECT_Driver (void);

  virtual void shutdown_consumer (void* consumer_cookie,
                                  CORBA::Environment&) = 0;
  // Callback method for consumers, each consumer will call this
  // method once it receives all the shutdown events from the
  // suppliers.

  void end_to_end (ACE_hrtime_t sample);
  void supplier_to_ec (ACE_hrtime_t sample);
  void inside_ec (ACE_hrtime_t sample);
  void ec_to_consumer (ACE_hrtime_t sample);

  void dump_latency_results (const char* description);

  class Latency_Stats
  {
    // = TITLE
    //   Maintains latency statistics.
    //
    // = DESCRIPTION
    //   This class is used to keep latency statistics of the Event
    //   Channel, in the future we could keep a histogram, but at the
    //   moment we just keep track of minimum, maximum, average and
    //   variance.
    //   The data should be  collected using the High Resolution
    //   timers.
  public:
    Latency_Stats (void);

    void dump_results (const char* description,
                       const char* description2);

    void sample (ACE_hrtime_t sample);

  private:
    u_long n_;
    ACE_hrtime_t sum_;
    ACE_hrtime_t sum2_;
    ACE_hrtime_t min_;
    ACE_hrtime_t max_;
  };

private:
  Latency_Stats end_to_end_;
  Latency_Stats supplier_to_ec_;
  Latency_Stats inside_ec_;
  Latency_Stats ec_to_consumer_;
};

#if defined (__ACE_INLINE__)
#include "ECT_Driver.i"
#endif /* __ACE_INLINE__ */

#endif /* ECT_CONSUMER_H */