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

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

#ifndef WINDOWS_MULTI_INSTANCE_MONITOR_H
#define WINDOWS_MULTI_INSTANCE_MONITOR_H

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

#include "ace/Unbounded_Queue.h"

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

#include "ace/Monitor_Control/Windows_Monitor.h"

#if defined (ACE_HAS_WIN32_PDH)

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE
{
  namespace Monitor_Control
  {
    /**
     * @class Windows_Multi_Instance_Monitor
     *
     * @brief Mixin class for concrete monitors compiled on Windows machines
     *        where the Performance Data Helper object of interest has more
     *        than once instance, for example multiple CPUs or network cards.
     */
    class MONITOR_CONTROL_Export Windows_Multi_Instance_Monitor
    {
    protected:
      Windows_Multi_Instance_Monitor (const ACE_TCHAR *wildcard_path);
      virtual ~Windows_Multi_Instance_Monitor (void);

      /// Platform-specific implementation.
      void update_i (void);

      /// Platform-specific reset.
      void clear_impl (void);

    protected:
      double value_;

    private:
      typedef ACE_Unbounded_Queue<Windows_Monitor *>
        INSTANCES;
      typedef ACE_Unbounded_Queue_Const_Iterator<Windows_Monitor *>
        INSTANCES_ITERATOR;

      INSTANCES instances_;
      DWORD n_instances_;
      PDH_STATUS status_;
    };
  }
}

ACE_END_VERSIONED_NAMESPACE_DECL

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

#endif /* defined (ACE_HAS_WIN32_PDH) */

#endif // WINDOWS_MULTI_INSTANCE_MONITOR_H