Ejemplo n.º 1
0
    public Worker(String diskname) {
      DISKINFO_FILE = IO_STAT_DISK_DIR + diskname + "/" + IO_STAT_DISKINFO_FILE;

      status = new ServernodeIOStatus(diskname);
      status.setMaxIORate(0);
      status.setMinIORate(100);
    }
Ejemplo n.º 2
0
    public void run() {
      monitoring_count = 0;
      init_io_rw_ticks = getIORWTicks();
      last_io_rw_ticks = init_io_rw_ticks;

      while (true) {
        try {
          Thread.sleep(IO_MONITOR_INTERVAL);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }

        cur_io_rw_ticks = getIORWTicks();
        monitoring_count++;

        double cur_rate = (cur_io_rw_ticks - last_io_rw_ticks) * 1.0 / IO_MONITOR_INTERVAL;
        status.setCurIORate(cur_rate);
        status.setAvgIORate(
            (cur_io_rw_ticks - init_io_rw_ticks) * 1.0 / (IO_MONITOR_INTERVAL * monitoring_count));
        if (cur_rate > status.getMaxIORate()) status.setMaxIORate(cur_rate);
        if (cur_rate < status.getMinIORate()) status.setMinIORate(cur_rate);

        last_io_rw_ticks = cur_io_rw_ticks;

        //				System.out.println("[INFO by xianyu]" + status.toString());
      }
    }