mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: was added option to disable the top processes (0 - option in the number of processes)
This commit is contained in:
@@ -57,7 +57,8 @@ internal class Popup: NSView, Popup_p {
|
||||
}
|
||||
private var processesHeight: CGFloat {
|
||||
get {
|
||||
return (self.processHeight*CGFloat(self.numberOfProcesses))+Constants.Popup.separatorHeight
|
||||
let num = self.numberOfProcesses
|
||||
return (self.processHeight*CGFloat(num)) + (num == 0 ? 0 : Constants.Popup.separatorHeight)
|
||||
}
|
||||
}
|
||||
private var timeFormat: String {
|
||||
|
||||
@@ -229,6 +229,10 @@ public class ProcessReader: Reader<[TopProcess]> {
|
||||
}
|
||||
|
||||
public override func read() {
|
||||
if self.numberOfProcesses == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
let task = Process()
|
||||
task.launchPath = "/usr/bin/top"
|
||||
task.arguments = ["-l", "1", "-o", "power", "-n", "\(self.numberOfProcesses)", "-stats", "pid,command,power"]
|
||||
|
||||
@@ -51,7 +51,8 @@ internal class Popup: NSView, Popup_p {
|
||||
}
|
||||
private var processesHeight: CGFloat {
|
||||
get {
|
||||
return (self.processHeight*CGFloat(self.numberOfProcesses))+Constants.Popup.separatorHeight
|
||||
let num = self.numberOfProcesses
|
||||
return (self.processHeight*CGFloat(num)) + (num == 0 ? 0 : Constants.Popup.separatorHeight)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -174,6 +174,10 @@ public class ProcessReader: Reader<[TopProcess]> {
|
||||
}
|
||||
|
||||
public override func read() {
|
||||
if self.numberOfProcesses == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
let task = Process()
|
||||
task.launchPath = "/bin/ps"
|
||||
task.arguments = ["-Aceo pid,pcpu,comm", "-r"]
|
||||
|
||||
@@ -64,7 +64,8 @@ internal class Popup: NSView, Popup_p {
|
||||
}
|
||||
private var processesHeight: CGFloat {
|
||||
get {
|
||||
return (self.processHeight*CGFloat(self.numberOfProcesses))+Constants.Popup.separatorHeight
|
||||
let num = self.numberOfProcesses
|
||||
return (self.processHeight*CGFloat(num)) + (num == 0 ? 0 : Constants.Popup.separatorHeight)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -274,6 +274,10 @@ public class ProcessReader: Reader<[Network_Process]> {
|
||||
}
|
||||
|
||||
public override func read() {
|
||||
if self.numberOfProcesses == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
let task = Process()
|
||||
task.launchPath = "/usr/bin/nettop"
|
||||
task.arguments = ["-P", "-L", "1", "-k", "time,interface,state,rx_dupe,rx_ooo,re-tx,rtt_avg,rcvsize,tx_win,tc_class,tc_mgt,cc_algo,P,C,R,W,arch"]
|
||||
|
||||
@@ -48,7 +48,8 @@ internal class Popup: NSView, Popup_p {
|
||||
}
|
||||
private var processesHeight: CGFloat {
|
||||
get {
|
||||
return (self.processHeight*CGFloat(self.numberOfProcesses))+Constants.Popup.separatorHeight
|
||||
let num = self.numberOfProcesses
|
||||
return (self.processHeight*CGFloat(num)) + (num == 0 ? 0 : Constants.Popup.separatorHeight)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,10 @@ public class ProcessReader: Reader<[TopProcess]> {
|
||||
}
|
||||
|
||||
public override func read() {
|
||||
if self.numberOfProcesses == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
let task = Process()
|
||||
task.launchPath = "/usr/bin/top"
|
||||
task.arguments = ["-l", "1", "-o", "mem", "-n", "\(self.numberOfProcesses)", "-stats", "pid,command,mem"]
|
||||
|
||||
Reference in New Issue
Block a user