Blowhole, RouteMap, and a Signpost Kit

Do you code, or are you interested in discovering what goes on in macOS? If yes to either, then you should find my new Signpost Kit of use.

Apple is pushing performance as its major theme for Mojave, and has been putting a lot of work into improving the performance of much of macOS. Although there are tools for measuring and monitoring performance, most impose their own significant performance overhead. It has been hard to measure the performance of your code without the instrument altering that performance.

Announced at WWDC 2018, and part of Mojave, is a new log system dubbed Signposts. Although primarily intended to help us assess the performance of our code, Signposts can be used for a great deal more. In Mojave in particular they are a relatively quiet feature in the cacophony that is the unified log, so they’re quick and simple to access, and an ideal way of recording information in the log.

Apple sees Signposts as being used by apps built in Xcode 10, using its Instruments feature to analyse them in quite specific ways. I beg to differ, and am in the process of developing more flexible tools which enable regular users to use Signposts from regular apps.

If you’re writing code in Swift or Objective-C, Xcode 10 provides quite good access to Signposts through the os_signpost() functions. I provide some example code for this in my Signpost test platform Whither.

If you’re scripting in AppleScript, shell scripts, or any other language or environment which doesn’t have direct access to os_signpost(), the only means of writing Signposts is my command tool Blowhole. There are some limitations, and because of a bug somewhere between Mojave ß6 and Xcode 10ß5, this doesn’t work as well as it used to or should, but it is easy to use.

I am now also releasing the second alpha version of my GUI app for harvesting and analysing Signposts, RouteMap. This doesn’t yet do any performance analysis, but does now display details of Signposts in usable ways.

But many of us will need to continue to run code in Sierra and High Sierra, for which there isn’t official support for Signposts. In fact, Apple has introduced some Signpost features into High Sierra’s log, although its interface remains private, and not accessible from third-party High Sierra code.

So, using Blowhole and RouteMap, and shown in Swift example code in Whither, I have come up with Pseudo-Signposts for Sierra and High Sierra: these are normal log entries whose eventMessage field starts with the keyword Signpost, then contains the following information separated by space characters:
type name ID content…
where type is the Signpost type (begin, end, or event), name is an arbitrary Signpost name which doesn’t contain any space characters, ID is an integer of your choice, and content is additional text content which will form the message associated with that Signpost (and can contain space characters).

These Pseudo-Signposts enable you to work with almost identical calls and features across Sierra, High Sierra, and Mojave, using the same tools (Blowhole and RouteMap).

Here’s the new version of RouteMap showing Pseudo-Signposts in Sierra:

signpost20

Although High Sierra does support Signposts, they are not accessible to third-party code, but Pseudo-Signposts look essentially the same:

signpost21

In Mojave, full Signpost features are readily accessible in Xcode 10ß, and are displayed in RouteMap thus:

signpost22

The best way to experience all this is with a simple and short tutorial, which I have put together in the Signpost Kit. It comes complete with RouteMap, Blowhole, Whither and its Swift source code, and full documentation. Please take a look at it, and see how useful Signposts and Pseudo-Signposts could be to you.

This new version of Blowhole (6) is available from here: blowhole7 – version 7 now works around this
RouteMap 1.0a2 is available from here: routemap10a2
They are both bundled in the Signpost Kit 1, which is available from here: signpostkit (version 1.1 with updated Blowhole)
and, of course, in Downloads above.