Baconian is system information reporter framework in Swift.
The reporter(Reporter) provides the following information.
- OS Memory pressure
- OS CPU load
- OS Processors load
- App Memory pressure
- App CPU load
- App Thread Information
And you can also see the load graphically by the view.(ReporterCompactView)
Table of View's symbol meaning.
Symbol | Meaning |
---|---|
🍎 | OS load line |
🍏 | Process(App) load line |
🐏 | Memory usage. 🐏 is RAM(U+1F40F) |
🤖 | CPU usage(0 - 100%) |
- Platforms
- iOS 10.0+
- macOS 10.12+
- Swift 5.0
github "daisuke-t-jp/Baconian"
use_frameworks!
target 'target' do
pod 'Baconian'
end
import Baconian
class ViewController: ReporterDelegate {
let reporter = Reporter()
reporter.delegate = self
reporter.start()
func reporter(_ manager: Reporter, didUpdate data: Reporter.Data) {
print("# Report")
print("## OS")
print("### Memory")
print("- physicalSize: \(data.osMemory.physicalSize.memoryByteFormatString)")
print("- freeSize: \(data.osMemory.freeSize.memoryByteFormatString)")
print("- inactiveSize: \(data.osMemory.inactiveSize.memoryByteFormatString)")
print("- wireSize: \(data.osMemory.wireSize.memoryByteFormatString)")
print("- usedSize: \(data.osMemory.usedSize.memoryByteFormatString)")
print("- unusedSize: \(data.osMemory.unusedSize.memoryByteFormatString)")
print("")
print("### CPU")
print(String.init(format: "- userUsage: %.2f", data.osCPU.userUsage))
print(String.init(format: "- systemUsage: %.2f", data.osCPU.systemUsage))
print(String.init(format: "- idleUsage: %.2f", data.osCPU.idleUsage))
print(String.init(format: "- niceUsage: %.2f", data.osCPU.niceUsage))
print(String.init(format: "- usage: %.2f", data.osCPU.usage))
print("")
print("### Processors")
for i in 0..<data.osProcessors.count {
print("- Core No.\(i)")
print(String.init(format: " - userUsage: %.2f", data.osCPU.userUsage))
print(String.init(format: " - systemUsage: %.2f", data.osCPU.systemUsage))
print(String.init(format: " - idleUsage: %.2f", data.osCPU.idleUsage))
print(String.init(format: " - niceUsage: %.2f", data.osCPU.niceUsage))
print(String.init(format: " - usage: %.2f", data.osCPU.usage))
print("")
}
print("## Process")
print("### Memory")
print("- residentSize: \(data.processMemory.residentSize.memoryByteFormatString)")
print("")
print("### CPU")
print(String.init(format: "- usage: %.2f", data.processCPU.usage))
print(String.init(format: "- time: %.2f", data.processCPU.time))
print("")
print("### Thread")
print("- totalNum: \(data.processThread.totalNum)")
print("- busyNum: \(data.processThread.busyNum)")
print("- idleNum: \(data.processThread.idleNum)")
print("")
}
reporter.stop()
let reporterView = ReporterCompactView(frame: CrossPlatformRect(x: 0,
y: 0,
width: ReporterCompactView.xibWidth,
height: ReporterCompactView.xibHeight))
self.view.addSubview(reporterView)
Width is 260 and Height is 50.
There are demos.