summaryrefslogtreecommitdiff
path: root/ACE/ace/Monitor_Control/Num_Threads_Monitor.h
blob: 7a20d2d0b78bb70cf3cec1b0e3c978ee18230740 (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
// -*- C++ -*-

//=============================================================================
/**
 * @file Num_Threads_Monitor.h
 *
 * @author Jeff Parsons <j.parsons@vanderbilt.edu>
 */
//=============================================================================

#ifndef NUM_THREADS_MONITOR_H
#define NUM_THREADS_MONITOR_H

#include /**/ "ace/pre.h"

#include "ace/Monitor_Base.h"

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

#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)

#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H)
#include "ace/Monitor_Control/Windows_Monitor.h"
#endif

#include "ace/Monitor_Control/Monitor_Control_export.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE
{
  namespace Monitor_Control
  {
    /**
     * @class Num_Threads_Monitor
     *
     * @brief Monitor total number of threads in the system.
     */
    class MONITOR_CONTROL_Export Num_Threads_Monitor
      : public Monitor_Base
#if defined (ACE_HAS_WIN32_PDH)
      , public Windows_Monitor
#endif
    {
    public:
      Num_Threads_Monitor (const char* name);

      /// Implementation of the pure virtual method.
      virtual void update ();

      /// Stores the default name, used if none is supplied by the user.
      static const char* default_name ();

    private:
      /// Overridden reset, calls platform-specific reset.
      virtual void clear_i ();

    private:
      static const char* default_name_;

#if defined (ACE_LINUX)
      FILE *file_ptr_;
      char buf_[1024];
      unsigned long nthreads_;
#endif
    };
  }
}

ACE_END_VERSIONED_NAMESPACE_DECL

#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */

#include /**/ "ace/post.h"

#endif // NUM_THREADS_MONITOR_H