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

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


#ifndef UTIL_THREAD_H
#define UTIL_THREAD_H

#include "Task_Client.h"

/**
 * @class Util_Thread
 *
 * @brief The thread that computes utilization.
 */
class Util_Thread : public ACE_Task<ACE_NULL_SYNCH>
{
public:
  /// Constructor.
  Util_Thread (Task_State *,
               ACE_Thread_Manager *thr_mgr);

  /// The thread entry point function.
  virtual int svc ();

  /// Gets the number of computations the thread was able to perform.
  u_long get_number_of_computations (void);

  /// this is the actual "computation" being performed.
  void computation (void);

  /// Indicates whether we're done.
  int done_;

private:
  /// Run the computations.
  int run_computations (void);

  /// This stores the number of computations performed
  /// by the Util_Thread so far
  u_long number_of_computations_;

  /// Pointer to the Task state. Stores the state
  /// common to the multiple client threads
  Task_State *ts_;
};

#endif /* !defined (UTIL_THREAD_H) */