Skip to content

Commit

Permalink
CPU metrics fix for when system memory percent is 0 (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
schlingding authored and ianpartridge committed Apr 23, 2019
1 parent a939a8d commit c96b4c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Authors ordered by first contribution:
- Kye Maloy (https://github.com/kyemaloy97)
- Jonathan Spruce (https://github.com/jonathan-spruce)
- Shihab Mehboob (https://github.com/ShihabMehboob)
- Vernon Schierding (https://github.com/schlingding)
2 changes: 1 addition & 1 deletion Sources/SwiftMetrics/SwiftMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public class SwiftMonitor {
//cpu: startCPU@#1412609879696@#0.00499877@#0.137468
var values:[Substring] = []
for value in message.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).split(separator: "#") {
values.append(value.dropLast())
values.append(value.last == "@" ? value.dropLast() : value)
}
if let timeOfSample = Int(values[1]), let percentUsedByApplication = Float(values[2]),
let percentUsedBySystem = Float(values[3]) {
Expand Down

0 comments on commit c96b4c5

Please sign in to comment.