-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAboutYourSystem.java
More file actions
26 lines (21 loc) · 1.13 KB
/
Copy pathAboutYourSystem.java
File metadata and controls
26 lines (21 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Properties;
/**
* Created by jatin on 5/6/2017.
*/
public class AboutYourSystem {
public static void main(String[] args) {
System.out.println("Welcome to Java Interview Questions :)");
System.out.println("Java Version:" + System.getProperty("java.version"));
System.out.println("AvailableProcessors(NCPU):" + Runtime.getRuntime().availableProcessors());
System.out.printf("MaxMemory :%.3fGiB\n", +((double) Runtime.getRuntime().maxMemory() / (1024.0 * 1024.0 * 1024.0)));
System.out.printf("TotalMemory:%.3fGiB\n", +(Runtime.getRuntime().totalMemory() / (1024.0 * 1024.0 * 1024.0)));
System.out.printf("FreeMemory :%.3fGiB\n", +(Runtime.getRuntime().freeMemory() / (1024.0 * 1024.0 * 1024.0)));
System.out.printf("Used Memory:%.3fGiB\n", +((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024.0 * 1024.0 * 1024.0)));
Properties props = System.getProperties();
props.list(System.out);
//NCPU=No. of CPU
//UCPU=target cpu utilisation
//W/C =wait time to compute time
//Nthread=NCPU*UCPU(1+W/C)
}
}