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
81
82
83
84
|
/* -*- C++ -*- */
// ============================================================================
// $Id$
//
// = FILENAME
// Machine_Properties.h
//
// = DESCRIPTION
// As a trading service dynamic property, retrieves machine
// statistics from the rstatd using Sun RPC.
//
// = AUTHORS
// Seth Widoff <sbw1@cs.wustl.edu>
//
// ============================================================================
#if (! defined TAO_MACHINE_PROPERTIES)
#define TAO_MACHINE_PROPERTIES
#include "orbsvcs/Trader/Dynamic_Property.h"
//RPC related includes
#include <rpc/rpc.h>
#include <rpcsvc/rstat.h>
class TAO_Machine_Properties : public TAO_DP_Evaluation_Handler
{
public:
enum PROP_TYPES
{
CPU,
DISK,
PAGES,
SWAPS,
PACKETS,
ERRORS,
CONTEXT_SWITCHES,
COLLISIONS,
INTERRUPTS,
LOAD
};
static const char* PROP_NAMES[];
static const CORBA::TypeCode_ptr PROP_TYPE;
TAO_Machine_Properties (void);
TAO_Machine_Properties (const ACE_Time_Value& timeout);
virtual CORBA::Any* evalDP(const CORBA::Any& extra_info,
CORBA::TypeCode_ptr returned_type,
CORBA::Environment& _env)
TAO_THROW_SPEC ((CosTradingDynamic::DPEvalFailure));
private:
void init (void);
int retrieve_stats (void);
void compute_cpu (CORBA::Any& value, int elapsed_time);
void compute_disk (CORBA::Any& value, int elapsed_time);
void compute_pages (CORBA::Any& value, int elapsed_time);
void compute_swaps (CORBA::Any& value, int elapsed_time);
void compute_packets (CORBA::Any& value, int elapsed_time);
void compute_errors (CORBA::Any& value, int elapsed_time);
void compute_context (CORBA::Any& value, int elapsed_time);
void compute_collisions (CORBA::Any& value, int elapsed_time);
void compute_interrupts (CORBA::Any& value, int elapsed_time);
void compute_load (CORBA::Any& value, int elapsed_time);
const ACE_Time_Value timeout_;
ACE_Time_Value timestamp_;
ACE_Time_Value sample_time_;
statstime stats_;
statstime old_stats_;
CLIENT* rstat_client_;
};
#endif /* TAO_MACHINE_PROPERTIES */
|