/** @return kernel info */ private SimpleScalar getKernelInfo() { String result = ""; SimpleScalar output = ShellUtil.getSimpleScalar(getKernelInfoCommand()); String[] info = output.toString().split(" "); if (info.length > 3) result += info[0] + " " + info[1] + " " + info[2]; return new SimpleScalar(result); }
private SimpleScalar getDiskUsage() { String result = ""; SimpleScalar output = ShellUtil.getSimpleScalar(getDiskUsageCommand()); String[] diskinfo = output.toString().split("\n"); if (diskinfo.length > 1) { String[] usageinfo = diskinfo[1].trim().split(" "); result += "<table>"; if (usageinfo.length > 5) { result += "<tr><td class='quiet'>Total size</td><td>" + usageinfo[1] + "</td>"; result += "<td class='quiet'>Used</td><td>" + usageinfo[2] + "</td></tr>"; result += "<tr><td class='quiet'>Available</td><td>" + usageinfo[3] + "</td>"; result += "<td class='quiet'>Used %</td><td>" + usageinfo[4] + "</td></tr>"; } result += "</table>"; } // AK 2010-04-08 added battery life // JC, updated path for 2.0 result += "<br /><br />Battery life: " + Activator.getBatteryLife(getBatteryInfoPath()) + "%"; return new SimpleScalar(result); }
/** @return BUG SW version info */ private SimpleScalar getSoftwareInfo() { String result = ""; SimpleScalar output = ShellUtil.getSimpleScalar(getBuildInfoCommand()); String str_output = output.toString(); // TODO: would be more accurate to use regexp String[] buildinfo = str_output.split("\n"); if (str_output.indexOf("bug-image-production") > -1) { // check if it's older format result += buildinfo[2] + "<br />"; result += "<span class='quiet'>" + buildinfo[1] + "</span>"; } else { String[] line; for (int i = 0; i < buildinfo.length; i++) { line = buildinfo[i].split(":"); if (line[0].equals("Version")) { result += buildinfo[i] + "<br />"; } else if (line[0].equals("Build Time") || line[0].equals("Revision")) { result += "<span class='quiet'>" + buildinfo[i] + "</span><br />"; } } } return new SimpleScalar(result); }
private SimpleScalar getDeviceName() { String output = ShellUtil.getSimpleScalar(getHostName()).toString(); return new SimpleScalar(output.replace("\n", "")); }