add cpu usage chart

This commit is contained in:
rememberber 2021-12-18 23:15:23 +08:00
parent 58c0b0334a
commit 3ec51a9d05
3 changed files with 3 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 KiB

After

Width:  |  Height:  |  Size: 636 KiB

View File

@ -37,7 +37,7 @@
<border type="none"/>
<children>
<grid id="a9c92" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<margin top="8" left="0" bottom="0" right="0"/>
<constraints/>
<properties/>
<border type="none"/>

View File

@ -346,7 +346,7 @@ public class CpuForm {
*/
private static double cpuData(CentralProcessor proc) {
if (prevTicks == null) {
prevTicks = proc.getSystemCpuLoadTicks();
return 0;
}
double d = proc.getSystemCpuLoadBetweenTicks(prevTicks);
return d;
@ -380,7 +380,7 @@ public class CpuForm {
scrollPaneLeft = new JScrollPane();
panel2.add(scrollPaneLeft, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
panel3.setLayout(new GridLayoutManager(5, 1, new Insets(8, 0, 0, 0), -1, -1));
scrollPaneLeft.setViewportView(panel3);
scuPanel = new JPanel();
scuPanel.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));