package net.hyperic.sigar.cmd;

import net.hyperic.sigar.CpuPerc;
import net.hyperic.sigar.SigarException;

public class CpuInfo extends SigarCommandBase {

    public CpuInfo(Shell shell) {
        super(shell);
    }

    public CpuInfo() {
        super();
    }

    public String getUsageShort() {
        return "Display cpu information";
    }

    public void output(String[] args) throws SigarException {
        net.hyperic.sigar.CpuInfo[] infos =
            this.sigar.getCpuInfoList();

        CpuPerc[] cpus = this.sigar.getCpuPercList();

        this.out.println(infos.length + " total CPUs..");

        for (int i=0; i<infos.length; i++) {
            net.hyperic.sigar.CpuInfo info = infos[i];
            CpuPerc cpu = cpus[i];
            this.out.println("Vendor........" + info.getVendor());
            this.out.println("Model........." + info.getModel());
            this.out.println("Mhz..........." + info.getMhz());
            this.out.println("Cache size...." + info.getCacheSize());
            this.out.println("User Time....." + CpuPerc.format(cpu.getUser()));
            this.out.println("Sys Time......" + CpuPerc.format(cpu.getSys()));
            this.out.println("Idle Time....." + CpuPerc.format(cpu.getIdle()));
            this.out.println();
        }
    }

    public static void main(String[] args) throws Exception {
        new CpuInfo().processCommand(args);
    }
}

@@ -552,33 +552,24 @@
 );%0A%0A        
-this.out.
 println(info
@@ -597,16 +597,16 @@
 Us..%22);%0A
+
 %0A       
@@ -741,33 +741,24 @@
             
-this.out.
 println(%22Ven
@@ -799,33 +799,24 @@
             
-this.out.
 println(%22Mod
@@ -856,33 +856,24 @@
             
-this.out.
 println(%22Mhz
@@ -911,33 +911,24 @@
             
-this.out.
 println(%22Cac
@@ -972,33 +972,24 @@
             
-this.out.
 println(%22Use
@@ -1043,33 +1043,24 @@
             
-this.out.
 println(%22Sys
@@ -1113,33 +1113,24 @@
             
-this.out.
 println(%22Idl
@@ -1192,25 +1192,16 @@
     
-this.out.
 println(
 );%0A 
@@ -1196,16 +1196,18 @@
 println(
+%22%22
 );%0A     

use super.println so redirection works