Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/ltm/ProcessesPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,23 +211,27 @@ private void refreshProcesses() {
tableModel.addRow(processInfo);
}

// Calculate CPU and Memory percentages
double cpuPercentage = calculateCpuPercentage(processData) * 100;
double memoryPercentage = calculateMemoryPercentage(processData) * 100;

// Update the CPU and Memory progress bars
cpuProgressBar.setValue((int) cpuPercentage);
cpuProgressBar.setString(String.format("CPU: %.0f%%", cpuPercentage));
memoryProgressBar.setValue((int) memoryPercentage);
memoryProgressBar.setString(String.format("Memory: %.0f%%", memoryPercentage));
try {
// Calculate CPU and Memory percentages
double cpuPercentage = calculateCpuPercentage(processData) * 100;
double memoryPercentage = calculateMemoryPercentage(processData) * 100;

// Update the CPU and Memory progress bars
cpuProgressBar.setValue((int) cpuPercentage);
cpuProgressBar.setString(String.format("CPU: %.0f%%", cpuPercentage));
memoryProgressBar.setValue((int) memoryPercentage);
memoryProgressBar.setString(String.format("Memory: %.0f%%", memoryPercentage));
} catch (Exception e) {
e.printStackTrace();
}

// Wait for the process to complete
int exitCode = process.waitFor();
if (exitCode != 0) {
// Handle any errors if necessary
System.err.println("Error executing script. Exit code: " + exitCode);
}
} catch (IOException | InterruptedException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
Expand Down