Browse Source

Adding signposts.

pull/92/head
Abhishek 6 years ago
parent
commit
5207435a30
  1. 15
      Clocker/Overall App/Logger.swift
  2. 8
      Clocker/Panel/PanelController.swift

15
Clocker/Overall App/Logger.swift

@ -3,6 +3,7 @@
import Cocoa import Cocoa
import Crashlytics import Crashlytics
import os.log import os.log
import os.signpost
class Logger: NSObject { class Logger: NSObject {
@objc class func log(object: [String: Any], for key: NSString) { @objc class func log(object: [String: Any], for key: NSString) {
@ -10,3 +11,17 @@ class Logger: NSObject {
customAttributes: object) customAttributes: object)
} }
} }
@available(OSX 10.14, *)
class PerfLogger: NSObject {
static let openPanelLog = OSLog(subsystem: "com.abhishek.Clocker", category: "Open Panel")
static let signpostID = OSSignpostID(log: openPanelLog)
@objc class func signpostBegin() {
os_signpost(.begin, log: openPanelLog, name: "Open Panel", signpostID: signpostID)
}
@objc class func signpostEnd() {
os_signpost(.end, log: openPanelLog, name: "Open Panel", signpostID: signpostID)
}
}

8
Clocker/Panel/PanelController.swift

@ -61,6 +61,10 @@ class PanelController: ParentPanelController {
} }
func open() { func open() {
if #available(OSX 10.14, *) {
PerfLogger.signpostBegin()
}
guard isWindowLoaded == true else { guard isWindowLoaded == true else {
return return
} }
@ -94,6 +98,10 @@ class PanelController: ParentPanelController {
mainTableView.reloadData() mainTableView.reloadData()
log() log()
if #available(OSX 10.14, *) {
PerfLogger.signpostEnd()
}
} }
// New way to set the panel's frame. // New way to set the panel's frame.

Loading…
Cancel
Save