@Override
    public OsStats osStats() {
        OsStats stats = new OsStats();
        stats.timestamp = System.currentTimeMillis();
        try {
            stats.loadAverage = sigar.getLoadAverage();
        } catch (SigarException e) {
          
        }

        try {
            stats.uptime = (long) sigar.getUptime().getUptime();
        } catch (SigarException e) {
            // ignore
        }

        try {
            CpuPerc cpuPerc = sigar.getCpuPerc();
            stats.cpu = new OsStats.Cpu();
           
            
            stats.cpu.sys = (short) (cpuPerc.getSys() * 100);
            stats.cpu.user = (short) (cpuPerc.getUser() * 100);
            stats.cpu.idle = (short) (cpuPerc.getIdle() * 100);
            stats.cpu.stolen = (short) (cpuPerc.getStolen() * 100);
        } catch (SigarException e) {
            // ignore
        }

        try {
            Mem mem = sigar.getMem();
            stats.mem = new OsStats.Mem();
            stats.mem.free = mem.getFree();
            stats.mem.freePercent = (short) mem.getFreePercent();
            stats.mem.used = mem.getUsed();
            stats.mem.usedPercent = (short) mem.getUsedPercent();
         
        
        } catch (SigarException e) {
            // ignore
        }

        try {
            Swap swap = sigar.getSwap();
            stats.swap = new OsStats.Swap();
            stats.swap.free = swap.getFree();
            stats.swap.used = swap.getUsed();
        
        } catch (SigarException e) {
           e.printStackTrace();
        }

        return stats;
    }