コード例 #1
0
  private void footerDiskAction() {
    long diskSpace;
    long diskUsed;
    try {
      diskSpace = usedFileStore.getTotalSpace();
      diskUsed = diskSpace - usedFileStore.getUnallocatedSpace();
    } catch (IOException e) {
      e.printStackTrace();
      throw new Error(e);
    }

    double diskFrac = ((double) diskUsed) / ((double) diskSpace);
    display.diskAvailLabel.setText(Utility.progressString(progressSize, diskFrac));
  }
コード例 #2
0
  private void setupFooter() {
    try {
      usedFileStore = Files.getFileStore(ToolSettings.NBITES_DIR_PATH);
    } catch (Exception e) {
      e.printStackTrace();
      ;
      throw new Error(e);
    }

    Debug.warn("Tool footer using fileStore: %s", usedFileStore.name());

    display.diskAvailLabel.setText(Utility.progressString(progressSize, 0.5));
    display.jvmAvailLabel.setText(Utility.progressString(progressSize, 0.5));

    footerJvmTimer =
        new Timer(
            1000, // ms
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                footerJvmAction();
              }
            });

    footerJvmTimer.start();

    footerDiskTimer =
        new Timer(
            1000,
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                footerDiskAction();
              }
            });
    footerDiskTimer.start();
  }
コード例 #3
0
  private void footerJvmAction() {
    long jvmUsed = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
    long jvmMax = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax();

    double jvmFrac = ((double) jvmUsed) / ((double) jvmMax);
    display.jvmAvailLabel.setText(Utility.progressString(progressSize, jvmFrac));
    //
    display.footerExtraLabel.setText(
        String.format(
            "   %d logs, %sused, %smax",
            AllGroups.getLogCount(),
            Utility.byteString(jvmUsed, true, true, false, false),
            Utility.byteString(jvmMax, true, true, false, false)));

    // Debug.print("jvm %d %s", jvmFrac,
    // String.format("%d logs, %s used memory, %s max",
    // AllGroups.getLogCount(), Utility.byteString(jvmUsed, true, true,
    // false, false),
    // Utility.byteString(jvmMax, true, true, false, false))
    // );
  }