Skip to content

Commit a0ab4e7

Browse files
authored
Merge pull request #30 from YoshinoriN/issue/29
(refs #29) Fix cpu calculate command
2 parents e538f05 + 216f9cd commit a0ab4e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/scala/net/yoshinorin/gitbucket/monitoring/services/MachineResources.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ trait MachineResources {
1212
val cpuCore = Runtime.getRuntime().availableProcessors()
1313

1414
def getCpu: Try[Option[Cpu]] = Try {
15-
val resouces = (Process("top -b -n 1") #| Process("grep Cpu(s)")).!!.dropAndToArray(":", ",")
15+
val resouces = (Process("top -d 0.2 -b -n 5") #| Process("grep Cpu(s)") #| Process("tail -n 1")).!!.dropAndToArray(":", ",")
1616
Some(
1717
Cpu(
1818
resouces.filter(c => c.contains("us")).headOption.getOrElse("-").replace("us", ""),

0 commit comments

Comments
 (0)