Ask a Question
Advertise on boostr.in
how many hardware details can a java applet discover using -'java,operating-system,benchmarking'
how many hardware details can a java applet discover ¬†using -'java,operating-system,benchmarking'
I'm writing a Java applet to run differently under different hardware. For instance if I know a computer has a large amount of RAM but a weak processor, I can alter the balance of some time-memory trade-offs. Being able to discover the exact make and model of the CPU on which the applet is running could be helpful. Having such information would allow me to benchmark my software against different systems and find bottlenecks.
Generally what I'm looking for is:
Number of cores and/or processors
32 bit vs 64 bit CPU
CPU Cache line size
Size of L1, L2, L3 cache
Set associativity of cache
Size of TLB
Exact Make/Model information on the CPU
Amount of RAM
Amount of swap/virtual memory
The JVM in which the applet is being run
Operating System running JVM
Number of used/unused Kernal threads
Bandwidth of internet connection
Graphics cards in use
If Operating System is being visualised
Network resource in use
Is any of this information baked into Java Applets. Are there libraries for finding any of this information? Applet benchmarking tools to discover/guess some of it? Any clever tricks you can think of?
Are their any aspects of computer hardware which are blocking. That is, could a Java applet detect that something is in use or unavailable by trying to access it and being denied (maybe a particular TCP port or graphics accelerator).
Disclaimer: I know that caring about the hardware goes against the Java ideology of not caring about the hardware. While comments point this out may be helpful for other readers that see this question, please note that such answers are not what I am looking for.
Added additional information:
java.lang.management provides all sorts of information on the system which the JVM is running on.
getAvailableProcessors() The number of available processors equivalent Runtime.availableProcessors()
getSystemLoadAverage() The average load on the system the system load average for the last minute.
getGarbageCollectorMXBeans() returns a list ofGarbageCollectorMXBeans. Each ¬†¬†GarbageCollectorMXBean can be queried for the following information:
getCollectionCount() number of gc which have occured using this
getCollectionTime() approximate accumulated time elapsed
between gc's in milliseconds. (Note:
The Java virtual machine
implementation may use a high
resolution timer to measure the
getName() the name of the memory manager.
getMemoryPoolNames() the memory pools that this gc manages.
getThreadMXBean() returns the ThreadMXBean which provides:
getCurrentThreadCpuTime() Returns the total CPU time for the current thread in nanoseconds. If the implementation distinguishes between user mode time and system mode time, the returned CPU time is the amount of time that the current thread has executed in user mode or system mode.
getRuntimeMXBean returns RuntimeMXBean
getUptime() uptime of the Java virtual machine in milliseconds.
getStartTime() start time of the Java virtual machine in milliseconds.
getInputArguments() Returns the input arguments passed to the Java virtual machine which does not include the arguments to the main method.
getCompilationMXBean returns the CompilationMXBean
getName() the name of the JIT
getTotalCompilationTime() time in milliseconds it took to compile your code.
Sep 7, 2015
to add a comment.
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please