Is there any way I can get system info, like processor/ram etc (preferably cross platform, in browser)?
I am looking to implement this in a website, so I need it in either flash or a java applet.
Is there any way I can get system info, like processor/ram etc (preferably cross platform, in browser)?
I am looking to implement this in a website, so I need it in either flash or a java applet.
You can use SIGAR. http://support.hyperic.com/display/SIGAR/Home
Note that it is licensed under GPL. It may not suit you unless you are using it for an internal application or for an open-source application.
Try this applet program.
import com.sun.servicetag.SystemEnvironment;
import java.lang.management.ManagementFactory;
public class Config extends java.applet.Applet{
public void paint(java.awt.Graphics g){
g.drawString("Hi.. This is Venkatesh..",50,10);
SystemEnvironment se = SystemEnvironment.getSystemEnvironment();
g.drawString("CpuManufacturer:"+se.getCpuManufacturer(),50,40);
g.drawString("HostID:"+se.getHostId(),50,60);
g.drawString("Host Name:"+se.getHostname(),50,80);
g.drawString("OS Architecture:"+se.getOsArchitecture(),50,100);
g.drawString("OS Name:"+se.getOsName(),50,120);
g.drawString("OS Verstion:"+se.getOsVersion(),50,140);
g.drawString("Serial no:"+se.getSerialNumber(),50,160);
g.drawString("System model:"+se.getSystemModel(),50,180);
g.drawString("System Manufacturer:"+se.getSystemManufacturer(),50,200);
com.sun.management.OperatingSystemMXBean mxbean = (com.sun.management.OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean();
g.drawString("Available Processors:"+mxbean.getAvailableProcessors(),50,220);
g.drawString("TotalRAM:"+mxbean.getTotalSwapSpaceSize()/(1024*1024*1024)+""+"GB",50,240);
g.drawString("RAM SIZE :" + (mxbean.getTotalPhysicalMemorySize()/(1024*1024*1024))+ " GB ",50,260);
}
}
<Applet Code="HelloWorld.class" width="150" height="150">
</Applet>
For RAM info take a look at this thread -> so use the java.lang.managament package or take a look at this or that answer.
To get some other RAM info do:
Runtime.getRuntime().availableProcessors()
Runtime.getRuntime().maxMemory();
Or to get info about OS etc try:
System.getProperties().list(System.out);
SIGAR seems to be the only out-of-the-box library for this task.
'Hi,
Java i think is the more restrictive option of the two, in terms of what you can pull from the client.
Flash will give you some information through the Capabilities class, it has somewhat looser security than Java so I think it's your best bet.
package {
import flash.display.Sprite;
import flash.system.Capabilities;
public class CapabilitiesExample extends Sprite {
public function CapabilitiesExample() {
showCapabilities();
}
private function showCapabilities():void {
trace("avHardwareDisable: " + Capabilities.avHardwareDisable);
trace("hasAccessibility: " + Capabilities.hasAccessibility);
trace("hasAudio: " + Capabilities.hasAudio);
trace("hasAudioEncoder: " + Capabilities.hasAudioEncoder);
trace("hasEmbeddedVideo: " + Capabilities.hasEmbeddedVideo);
trace("hasMP3: " + Capabilities.hasMP3);
trace("hasPrinting: " + Capabilities.hasPrinting);
trace("hasScreenBroadcast: " + Capabilities.hasScreenBroadcast);
trace("hasScreenPlayback: " + Capabilities.hasScreenPlayback);
trace("hasStreamingAudio: " + Capabilities.hasStreamingAudio);
trace("hasVideoEncoder: " + Capabilities.hasVideoEncoder);
trace("isDebugger: " + Capabilities.isDebugger);
trace("language: " + Capabilities.language);
trace("localFileReadDisable: " + Capabilities.localFileReadDisable);
trace("manufacturer: " + Capabilities.manufacturer);
trace("os: " + Capabilities.os);
trace("pixelAspectRatio: " + Capabilities.pixelAspectRatio);
trace("playerType: " + Capabilities.playerType);
trace("screenColor: " + Capabilities.screenColor);
trace("screenDPI: " + Capabilities.screenDPI);
trace("screenResolutionX: " + Capabilities.screenResolutionX);
trace("screenResolutionY: " + Capabilities.screenResolutionY);
trace("serverString: " + Capabilities.serverString);
trace("version: " + Capabilities.version);
}
}
}
Example from: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/
In order to detect speed you need to do benchmarking.
Tips: By monitoring for instance rendering/calculation time in javascript, flash or java you can dynamically alter the behaviour of your application based on real-world performance, instead of running a benchmark prior to launching the application (as I have seen others do). For instance: Thread 1: Monitor and alter data (for instance rotation degree in a rotating cube). Thread 2: Do the heavy calculation and rendering.
(This is easy in Java with threads, but in flash you need to chunk your processing and have the heavy code check with the monitor on how to proceed).
Tips 2: There are lot's of public benchmarks, so you could narrow down what kind of CPU people are running by running a benchmark and compare with a benchmark results-database.
Hope this helps !
Cheers