ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/tools/Machine.java
Revision: 419
Committed: Thu Nov 22 14:09:18 2007 UTC (16 years, 10 months ago) by duarte
Original Path: branches/aglappe-jung/tools/Machine.java
File size: 1406 byte(s)
Log Message:
Re-branching for JUNG2 development
Line User Rev File contents
1 duarte 7 package tools;
2    
3     import java.net.*;
4 stehr 350 import java.util.Properties;
5 duarte 7
6     public class Machine {
7    
8     public static String getClient() {
9 stehr 350 String client = "";
10 filippis 45 try {
11     client = InetAddress.getLocalHost().getHostName();
12     } catch (Exception e) {
13 stehr 350 System.err.println(e);
14     }
15 filippis 45 return client;
16 duarte 7 }
17     public static String getOSArch() {
18 filippis 45 return (System.getProperty("os.arch"));
19 duarte 7 }
20    
21     public static String getOSName() {
22 stehr 350 return (System.getProperty("os.name"));
23 duarte 7 }
24    
25     public static String getOSver() {
26 stehr 350 return (System.getProperty("os.version"));
27     }
28 duarte 7
29 stehr 350 public static String getUserName() {
30     return (System.getProperty("user.name"));
31 duarte 7 }
32 stehr 350
33     public static String getTempDir() {
34     return(System.getProperty("java.io.tmpdir"));
35     }
36    
37     public static Properties getAllProperties() {
38     return System.getProperties();
39     }
40    
41     public static long getTotalMemory() {
42     return Runtime.getRuntime().totalMemory();
43     }
44    
45     public static long getFreeMemory() {
46     return Runtime.getRuntime().freeMemory();
47     }
48    
49     public static void main(String[] args) {
50     System.out.println("Hi, I am " + getClient() + " and these are my properties:");
51     getAllProperties().list(System.out);
52     System.out.printf("Total memory: %,d bytes\n", getTotalMemory());
53     System.out.printf("Free memory : %,d bytes\n", getFreeMemory());
54     }
55 duarte 7 }
56    

Properties

Name Value
svn:executable *