Package org.ngrinder.monitor.share.domain

Examples of org.ngrinder.monitor.share.domain.BandWidth


   */
  public synchronized SystemInfo execute() {
    SystemInfo systemInfo = new SystemInfo();
    systemInfo.setCollectTime(System.currentTimeMillis());
    try {
      BandWidth networkUsage = getNetworkUsage();
      BandWidth bandWidth = networkUsage.adjust(prev.getBandWidth());
      systemInfo.setBandWidth(bandWidth);
      systemInfo.setCPUUsedPercentage((float) sigar.getCpuPerc().getCombined() * 100);
      Cpu cpu = sigar.getCpu();
      systemInfo.setTotalCpuValue(cpu.getTotal());
      systemInfo.setIdleCpuValue(cpu.getIdle());
View Full Code Here


   *
   * @return BandWith
   * @throws SigarException thrown when the underlying lib is not linked
   */
  public BandWidth getNetworkUsage() throws SigarException {
    BandWidth bandWidth = new BandWidth(System.currentTimeMillis());
    for (String each : netInterfaces) {
      try {
        NetInterfaceStat netInterfaceStat = sigar.getNetInterfaceStat(each);
        bandWidth.setReceived(bandWidth.getReceived() + netInterfaceStat.getRxBytes());
        bandWidth.setSent(bandWidth.getSent() + netInterfaceStat.getTxBytes());
      } catch (Exception e) {
        NoOp.noOp();
      }
    }
    return bandWidth;
View Full Code Here

    this.system = String.valueOf(systemInfo.getSystem());
    this.collectTime = systemInfo.getCollectTime();
    this.freeMemory = systemInfo.getFreeMemory();
    this.totalMemory = systemInfo.getTotalMemory();
    this.cpuUsedPercentage = systemInfo.getCPUUsedPercentage();
    BandWidth bandWidth = systemInfo.getBandWidth();
    if (bandWidth != null) {
      this.receivedPerSec = bandWidth.getReceivedPerSec();
      this.sentPerSec = bandWidth.getSentPerSec();
    }
    this.customValues = systemInfo.getCustomValues();
    this.version = version;
  }
View Full Code Here

    boolean received = false;

    while (i++ < 3) {
      SystemInfo systemInfo = collector.execute();
      ThreadUtils.sleep(2000);
      BandWidth bandWidth = systemInfo.getBandWidth();
      if (bandWidth.getReceivedPerSec() != 0) {
        received = true;
      }
      if (bandWidth.getSentPerSec() != 0) {
        sent = true;
      }
      assertThat(systemInfo.getFreeMemory(), not(0l));
      assertThat(systemInfo.getTotalMemory(), not(0l));
    }
View Full Code Here

TOP

Related Classes of org.ngrinder.monitor.share.domain.BandWidth

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.