Skip to content

Commit

Permalink
Increased network top refresh interval for better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
gao-sun committed Oct 19, 2020
1 parent e9a3b3b commit f438af1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions eul/Store/NetworkTopStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ class NetworkTopStore: ObservableObject {
}
}

var interval: Int {
preferenceStore.networkRefreshRate
}

func update(shouldStart: Bool) {
guard shouldStart else {
task?.terminate()
Expand All @@ -69,7 +65,7 @@ class NetworkTopStore: ObservableObject {
lastOutBytes.removeAll()
lastTimestamp = Date().timeIntervalSince1970
processes = []
task = shellPipe("nettop -P -x -J bytes_in,bytes_out -L0 -s \(interval)") { [self] string in
task = shellPipe("nettop -P -x -J bytes_in,bytes_out -L0 -s 3") { [self] string in
let rows = string.split(separator: "\n").map { String($0) }
let headers = rows[0]
.split(separator: ",", omittingEmptySubsequences: false)
Expand Down Expand Up @@ -125,7 +121,7 @@ class NetworkTopStore: ObservableObject {
outSpeedInByte: lastOut.map { (outBytes - $0) / timeElapsed } ?? 0
)

guard speed.totalSpeedInByte > 0.1 else {
guard speed.totalSpeedInByte >= 100 else {
return nil
}

Expand Down

0 comments on commit f438af1

Please sign in to comment.