summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Cubit/TAO/MT_Cubit/Timer.h
blob: c467380dd64873b4d7f99b7261aaf8c7b2312617 (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
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Timer.h
 *
 *  @author Andy Gokhale
 *  @author Sumedh Mungee
 *  @author Sergio Flores-Gaitan and Nagarajan Surendran.
 */
//=============================================================================


#ifndef _MT_CUBIT_TIMER_H
#define _MT_CUBIT_TIMER_H

#include "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/High_Res_Timer.h"

/**
 * @class MT_Cubit_Timer
 *
 * @brief A class that encapsulates the ACE timer
 */
class MT_Cubit_Timer
{
public:
  MT_Cubit_Timer (u_int granularity);

  void start ();
  void stop ();

  ACE_timer_t get_elapsed ();

private:
  /// timer.
  ACE_High_Res_Timer timer_;

  /// Elapsed time in microseconds.
  ACE_Time_Value delta_;

  /**
   * This is the granularity of the timing of the CORBA requests. A
   * value of 5 represents that we will take time every 5 requests,
   * instead of the default of every request (1).
   */
  u_int granularity_;
};

#endif /* _MT_CUBIT_TIMER_H */