Upgrade to Pro — share decks privately, control downloads, hide ads and more …

signpostsによるパフォーマンス計測

Shohei Yokoyama
June 20, 2018
420

 signpostsによるパフォーマンス計測

Shohei Yokoyama

June 20, 2018
Tweet

Transcript

  1. Measuring Intervals import os.signpost let log = OSLog(subsystem: "com.example.app", category:

    "SomeOperation") os_signpost(.begin, log: log, name: "doSomething") doSomething() os_signpost(.end, log: log, name: "doSomething")
  2. Measuring Asynchronous Intervals import os.signpost let log = OSLog(subsystem: "com.example.app",

    category: "SomeOperation") for element in elements { os_signpost(.begin, log: log, name: "doSomething") // Asynchronously doSomething(element) { // Measuring may fail ! os_signpost(.end, log: log, name: "doSomething") } }
  3. Measuring Asynchronous Intervals import os.signpost let log = OSLog(subsystem: "com.example.app",

    category: "SomeOperation") for element in elements { let signpostID = OSSignpostID(log: log) os_signpost(.begin, log: log, name: "doSomething", signpostID: signpostID) // Asynchronously doSomething(element) { os_signpost(.end, log: log, name: "doSomething", signpostID: signpostID) } }