ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/java/SystemMonitor.java
Revision: 1.1
Committed: Mon Nov 27 19:44:32 2000 UTC (24 years ago) by ab11
Branch: MAIN
Log Message:
Initial Version - Outputs same data each time. No actual gathering of data

File Contents

# Content
1 class SystemMonitor {
2
3 public SystemMonitor( Config config ){
4 // create a new instace, get the info we need out of config
5 // like things to monitor
6
7 lastCheck = System.currentTimeMillis();
8 sequence = 0;
9
10
11 // why oh why wont ultra edit let me put Long in the next line? oh its trying to
12 // correct keywords =|
13 checkInterval = Long.parseLong(config.getProperty("UDPINTEVAL"));
14
15 }
16
17 public String getInfo(){
18 // called to retrieve the stored averages and output them as a XML string
19 XMLFormatter xml = new XMLFormatter("packet");
20
21 // just send some dummy info for now.
22 xml.addNest("packet_info");
23 String currentTime = Long.toString(System.currentTimeMillis());
24 xml.addElement("date_time", currentTime );
25 xml.addElement("sequence", Integer.toString(sequence));
26 xml.closeNest();
27 xml.addNest("core");
28 xml.addElement("cpu","100");
29 xml.addElement("memory","200");
30 xml.closeNest();
31 xml.addNest("additional");
32 xml.addElement("users","20");
33 xml.closeNest();
34
35 // MUST FIX THIS..!!!!
36 while ( System.currentTimeMillis() < ( lastCheck + checkInterval ) ){
37 // errm do nothing.. block or something.
38 }
39
40 // increment sequence.
41 sequence++;
42
43 // finally return a string
44 return xml.returnXML();
45 } // getinfo()
46
47 // last time the system data was returned.
48 private long lastCheck;
49 private int sequence;
50 private long checkInterval;
51
52 } // class