Customizing Spinlock Parameters

Applies To: Windows 8, Windows 8.1

By default, the system logs one spinlock event for every 1000 non-contended acquisitions, and one spinlock event for every contended acquisition. Spinlock data collection supports three parameters that enable you to customize data collection. To set spinlock collection parameters, use the following command.

xperf -setspinlocksample [spin_threshold] [acquire_sample_rate] [contention_sample_rate]

Parameters

  • spin_threshold
    The spinlock instrumentation provides a capability to trace heavily contended locks. This is achieved by setting a high spin threshold. If a lock spins less than this threshold, no spinlock event will be logged. For example, if this value is 1, one spinlock event is acquired for each attempt to acquire a lock. If this value is 10, one spinlock event is logged for each ten attempts to acquire a lock. The default value is 1.
  • acquire_sample_rate
    Sample rate at which spinlock events are logged during a trace. For example, if this value is 1000, one spinlock event is logged for each 1000 non-collision event acquisitions. The default value is 1000.
  • contention_sample_rate
    Rate at which spinlock events are logged when collisions occur. For example, if this value is 100, one spinlock event is logged for each 100 spinlock collisions. The default value is 1.

Remarks

Spinlock collection parameters return to the default values when the system reboots. To ensure valid data collection, always query or set spinlock parameters before starting event data collection.

Example

The following example shows how to query for the current values.

xperf -spinlock

The following example sets the spin threshold to 1, the acquire sample rate to 1000, and the spinlock contention sample rate to 100.

xperf -setspinlocksample 1 1000 100

This query returns the following result for the values set in the previous example.

Current Spinlock Spin Threshold = 1
Current Spinlock Acquire Sample Rate = 1000
Current Spinlock Contention Sample Rate = 100

See Also

Reference

spinlock