Structure

OSSignpostID

An identifier you use to distinguish between signposts that have the same name and destination log.

Declaration

struct OSSignpostID

Overview

Multiple intervals with matching log objects and interval names can be in-flight simultaneously. In order for data-processing tools to correctly match the beginning and end of an interval, you need to identify each interval with a unique signpost identifier. Use the first strategy in the list below that matches your use case:

  • If you can guarantee that intervals with the same log and name can never overlap in time, specify exclusive as the signpost ID.

  • If you already have your own integer data that can uniquely identify each instance of the task being measured, instantiate the signpost ID using the init(_:) method. The value must not match one of the predefined signpost values.

  • If you have a pointer that can uniquely identify begin/end pairs (such as a pointer to a data object used by the code being measured), instantiate the signpost ID using the init(log:object:) method. Don't use this initializer for signposts that span process boundaries.

  • Otherwise, instantiate a signpost ID using the init(log:) method each time you create signposts for a discrete task you want to track.

Topics

Using Built-in Signpost Identifiers

static let exclusive: OSSignpostID

A signpost identifier that indicates no overlap among different signpost time intervals.

static let invalid: OSSignpostID

A signpost identifier that indicates an error.

static let null: OSSignpostID

A signpost identifier that represents a disabled signpost.

Creating Signpost Identifiers

init(log: OSLog)

Creates a signpost identifier that’s unique among signposts you want to log to specified log.

init(log: OSLog, object: AnyObject)

Creates a signpost identifier among signposts you want to log to specified log, and among signposts using the supplied object.

init(UInt64)

Creates a signpost from an arbitrary 64-bit integer value.

Inspecting Signpost Identifiers

let rawValue: os_signpost_id_t

An integer value that uniquely identifies the signpost.

Comparing Signpost Identifiers

static func == (OSSignpostID, OSSignpostID) -> Bool

Returns a Boolean value that indicates whether two values are equal.

static func != (OSSignpostID, OSSignpostID) -> Bool

Returns a Boolean value that indicates whether two values are not equal.

static func < (OSSignpostID, OSSignpostID) -> Bool

Returns a Boolean value that indicates whether the value of the first argument is less than that of the second argument.

static func <= (OSSignpostID, OSSignpostID) -> Bool

Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.

static func > (OSSignpostID, OSSignpostID) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.

static func >= (OSSignpostID, OSSignpostID) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.

Creating Signpost Identifier Ranges

static func ... (OSSignpostID) -> PartialRangeFrom<OSSignpostID>

Returns a partial range extending upward from a lower bound.

static func ... (OSSignpostID) -> PartialRangeThrough<OSSignpostID>

Returns a partial range up to, and including, its upper bound.

static func ... (OSSignpostID, OSSignpostID) -> ClosedRange<OSSignpostID>

Returns a closed range that contains both of its bounds.

static func ..< (OSSignpostID) -> PartialRangeUpTo<OSSignpostID>

Returns a partial range up to, but not including, its upper bound.

static func ..< (OSSignpostID, OSSignpostID) -> Range<OSSignpostID>

Returns a half-open range that contains its lower bound but not its upper bound.

Relationships

Conforms To

See Also

Logging Signpost Events

func os_signpost(OSSignpostType, dso: UnsafeRawPointer, log: OSLog, name: StaticString, signpostID: OSSignpostID)

Logs a point of interest in your code as a time interval or as an event for debugging performance in Instruments.

func os_signpost(OSSignpostType, dso: UnsafeRawPointer, log: OSLog, name: StaticString, signpostID: OSSignpostID, StaticString, CVarArg)

Logs a point of interest in your code as a time interval or as an event for debugging performance in Instruments, and includes a detailed message.

struct OSSignpostType

Options for different kinds of signposts.