blob: 6615908ada32920fe66f5f72cbbd42c1f6d3cec2 (
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
80
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
#ifndef ICE_GRID_PLATFORM_INFO_H
#define ICE_GRID_PLATFORM_INFO_H
#include <IceGrid/Internal.h>
#ifdef _WIN32
# include <pdh.h> // Performance data helper API
# include <deque>
#endif
namespace IceGrid
{
class TraceLevels;
NodeInfo toNodeInfo(const std::shared_ptr<InternalNodeInfo>&);
RegistryInfo toRegistryInfo(const std::shared_ptr<InternalReplicaInfo>&);
class PlatformInfo final
{
public:
PlatformInfo(const std::string&, const std::shared_ptr<Ice::Communicator>&, const std::shared_ptr<TraceLevels>&);
void start();
void stop();
std::shared_ptr<InternalNodeInfo> getInternalNodeInfo() const;
std::shared_ptr<InternalReplicaInfo> getInternalReplicaInfo() const;
NodeInfo getNodeInfo() const;
RegistryInfo getRegistryInfo() const;
LoadInfo getLoadInfo() const;
int getProcessorSocketCount() const;
std::string getHostname() const;
std::string getDataDir() const;
std::string getCwd() const;
#if defined(_WIN32)
void runUpdateLoadInfo();
#endif
private:
const std::shared_ptr<TraceLevels> _traceLevels;
std::string _name;
std::string _os;
std::string _hostname;
std::string _release;
std::string _version;
std::string _machine;
int _nProcessorThreads;
std::string _dataDir;
std::string _cwd;
std::string _endpoints;
int _nProcessorSockets;
#if defined(_WIN32)
std::deque<int> _usages1;
std::deque<int> _usages5;
std::deque<int> _usages15;
int _last1Total;
int _last5Total;
int _last15Total;
bool _terminated;
mutable std::mutex _utilizationMutex;
std::condition_variable _utilizationCondVar;
std::thread _updateUtilizationThread;
#endif
};
};
#endif
|