Skip to content

Commit

Permalink
RUMM-1276 PR comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
buranmert committed Jun 10, 2021
1 parent 3410029 commit ba9465c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/Datadog/RUM/RUMVitals/VitalCPUReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import Foundation
import UIKit.UIApplication

/// A class reading the CPU ticks (_1 second = 600 ticks_) since the start of the process.
/// A class reading the CPU ticks of the processor.
internal class VitalCPUReader: VitalReader {
/// host_cpu_load_info_count is 4 (tested in iOS 14.4)
private static let host_cpu_load_info_count = MemoryLayout<host_cpu_load_info>.stride / MemoryLayout<integer_t>.stride
Expand Down Expand Up @@ -60,7 +60,13 @@ internal class VitalCPUReader: VitalReader {
}
}
if result != KERN_SUCCESS {
// TODO: RUMM-1276 use sdkLogger to log errors?
// in case of error, refer to `kern_return.h` (Objc)
// as its Swift interface doesn't have integer values
//
// NOTE: RUMM-1276 consider using sdkLogger.errorOnce(...) to avoid flooding
InternalMonitoringFeature.instance?.monitor.sdkLogger.error(
"CPU Vital cannot be read! Error code: \(result)"
)
return nil
}

Expand Down

0 comments on commit ba9465c

Please sign in to comment.