#include <IOKit/IOReportTypes.h>

IOKit/IOReportTypes.h Kernel.framework

includes: Kernel/stdint.h
74 macros · 19 typedefs · 11 structs · 4 enums

macroIOR_VALUES_PER_ELEMENT

#define IOR_VALUES_PER_ELEMENT 4

macrokIOReportInvalidIntValue

@const kIOReportInvalidValue @const kIOReportInvalidIntValue @abstract cardinal value used to indicate data errors @discussion kIOReportInvalidValue and kIOReportInvalidIntValue have the same bit pattern so that clients checking for one or the other don't have to worry about getting the signedness right.
#define kIOReportInvalidIntValue INT64_MIN

macrokIOReportInvalidValue

#define kIOReportInvalidValue (uint64_t)kIOReportInvalidIntValue

typedefIOReportCategories

@typedef IOReportCategories @abstract encapsulate important, multi-purpose "tags" for channels @discussion IOReportCategories is the type for the .categories field of IOReportChanelType. These categories are inteded to empower a limited number of clients to retrieve a broad range of channels without knowing much about them. They can be OR'd together as needed. Groups and subgroups are a more extensible mechanism for aggregating channels produced by different drivers.
typedef uint16_t IOReportCategories

macrokIOReportCategoryPower

#define kIOReportCategoryPower (1 << 1)
and energy

macrokIOReportCategoryTraffic

#define kIOReportCategoryTraffic (1 << 2)
I/O at any level

macrokIOReportCategoryPerformance

#define kIOReportCategoryPerformance (1 << 3)
e.g. cycles/byte

macrokIOReportCategoryPeripheral

#define kIOReportCategoryPeripheral (1 << 4)
not built-in

macrokIOReportCategoryField

#define kIOReportCategoryField (1 << 8)
consider logging

macrokIOReportCategoryDebug

future categories TBD
#define kIOReportCategoryDebug (1 << 15)

macrokIOReportInvalidCategory

#define kIOReportInvalidCategory UINT16_MAX

typedefIOReportFormat

IOReportChannelType.report_format
typedef uint8_t IOReportFormat

enum(anonymous)

underlying type unsigned int
kIOReportInvalidFormat0
kIOReportFormatSimple1
kIOReportFormatState2
kIOReportFormatHistogram3
kIOReportFormatSimpleArray4

structIOSimpleReportValues

simple report values
size 32, align 1 · packed
int64_tsimple_value
uint64_treserved1
uint64_treserved2
uint64_treserved3

typedefIOSimpleReportValues

typedef struct IOSimpleReportValues IOSimpleReportValues;

structIOSimpleArrayReportValues

simple value array
size 32, align 1 · packed
int64_t[4]simple_values

typedefIOSimpleArrayReportValues

typedef struct IOSimpleArrayReportValues IOSimpleArrayReportValues;

structIOStateReportValues

state report values
size 32, align 1 · packed
uint64_tstate_id0..N-1 or 8-char code (see MAKEID())
uint64_tintransitionsnumber of transitions into this state
uint64_tupticksticks spent in state (local timebase)
uint64_tlast_intransitionticks at last in-transition

typedefIOStateReportValues

typedef struct IOStateReportValues IOStateReportValues;

structIOHistogramReportValues

histogram report values
size 32, align 1 · packed
uint64_tbucket_hits
int64_tbucket_min
int64_tbucket_max
int64_tbucket_sum

typedefIOHistogramReportValues

typedef struct IOHistogramReportValues IOHistogramReportValues;

typedefIOReportConfigureAction

configuration actions generally change future behavior
typedef uint32_t IOReportConfigureAction

enum(anonymous)

underlying type unsigned int
kIOReportEnable1basics (in common operational order)
kIOReportGetDimensions2
kIOReportDisable0
kIOReportNotifyHubOnChange16Enable/disable modifiers triggered polling
kIOReportTraceOnChange32kdebug.h tracing

typedefIOReportUpdateAction

update actions should not have observable side effects
typedef uint32_t IOReportUpdateAction

enum(anonymous)

underlying type unsigned int
kIOReportCopyChannelData1
kIOReportTraceChannelData2

structIOReportChannelType

size 8, align 1 · packed
uint8_treport_formatHistogram, StateResidency, etc.
uint8_treservedmust be zero
uint16_tcategoriespower, traffic, etc (omnibus obs.)
uint16_tnelementsinternal size of channel
int16_telement_idxonly meaningful in the data pipeline 0..nelements-1

typedefIOReportChannelType

typedef struct IOReportChannelType IOReportChannelType;

macroIOREPORT_MAKEID

@define IOREPORT_MAKECHID @abstract convert up to 8 printable characters into a 64-bit channel ID @param <char0..char7> - printable chars to be packed into a channel ID @result a 64-bit channel ID with an implicit ASCII name @discussion A simple example: IOREPORT_MAKECHID('H', 'i', ' ', 'w', 'o', 'r', 'l', 'd'); will evaluate to 0x686920776f726c64. Any NUL bytes are ignored (by libIOReport) for naming purposes, but will appear in the channel ID. Using a non-NUL non-printable character will disable the implicit name. Putting NUL bytes first eliminates trailing zeros when the channel ID is printed as hex. For example: IORERPORT_MAKECHID('\0','\0','n','x','f','e','r','s'); To see the text, use xxd -r -p # not -rp; see 12976241
#define IOREPORT_MAKEID(A, B, C, D, E, F, G, H) (__IOR_lshiftchr(A, 7) | __IOR_lshiftchr(B, 6) | __IOR_lshiftchr(C, 5)
    | __IOR_lshiftchr(D, 4) | __IOR_lshiftchr(E, 3) | __IOR_lshiftchr(F, 2)
    | __IOR_lshiftchr(G, 1) | __IOR_lshiftchr(H, 0))

structIOReportChannel

size 16, align 8
uint64_tchannel_id
IOReportChannelTypechannel_type

typedefIOReportChannel

typedef struct IOReportChannel IOReportChannel;

structIOReportChannelList

size 8, align 8
uint32_tnchannels
IOReportChannel[]channels

typedefIOReportChannelList

typedef struct IOReportChannelList IOReportChannelList;

structIOReportInterest

size 24, align 8
uint64_tprovider_id
IOReportChannelchannel

typedefIOReportInterest

typedef struct IOReportInterest IOReportInterest;

structIOReportInterestList

size 8, align 8
uint32_tninterests
IOReportInterest[]interests

typedefIOReportInterestList

typedef struct IOReportInterestList IOReportInterestList;

structIOReportElementValues

size 32, align 1 · packed
uint64_t[4]v

typedefIOReportElementValues

typedef struct IOReportElementValues IOReportElementValues;

structIOReportElement

size 64, align 1 · packed
uint64_tprovider_id
uint64_tchannel_id
IOReportChannelTypechannel_type
uint64_ttimestampmach_absolute_time()
IOReportElementValuesvalues

typedefIOReportElement

typedef struct IOReportElement IOReportElement;

typedefIOReportUnit

typedef uint64_t IOReportUnit

typedefIOReportUnits

typedef uint64_t IOReportUnits
deprecated typo, please switch

macroIOREPORT_GETUNIT_QUANTITY

#define IOREPORT_GETUNIT_QUANTITY(unit) ((IOReportQuantity)((uint64_t)unit >> 56) & 0xff)

macroIOREPORT_GETUNIT_SCALE

#define IOREPORT_GETUNIT_SCALE(unit) ((IOReportScaleFactor)unit & 0x00ffffffffffffff)

typedefIOReportQuantity

8b quantity ID | 32b const val + 8b*2^10 + 8b*2^n | 8b cardinal | 8b unused
typedef uint8_t IOReportQuantity
SI "quantity" is what's measured

typedefIOReportScaleFactor

typedef uint64_t IOReportScaleFactor

enum(anonymous)

See <http://en.wikipedia.org/wiki/SI_base_unit> for a list of quantities and their symbols.
underlying type unsigned int
kIOReportQuantityUndefined0used by state reports, etc
kIOReportQuantityTime1Seconds
kIOReportQuantityPower2Watts
kIOReportQuantityEnergy3Joules
kIOReportQuantityCurrent4Amperes
kIOReportQuantityVoltage5Volts
kIOReportQuantityCapacitance6Farad
kIOReportQuantityInductance7Henry
kIOReportQuantityFrequency8Hertz
kIOReportQuantityData9bits/bytes (see scale)
kIOReportQuantityTemperature10Celsius (not Kelvin :)
kIOReportQuantityEventCount100
kIOReportQuantityPacketCount101
kIOReportQuantityCPUInstrs102

macrokIOReportScaleConstMask

A number of units end up with both IEC (2^n) and SI (10^n) scale factors. For example, the "MB" of a 1.44 MB floppy or a 1024MHz clock. We thus support separate 2^n and 10^n factors. The exponent encoding scheme is modeled loosely on single-precision IEEE 754.
#define kIOReportScaleConstMask 0x000000007fffffff
constant ("uint31")

macrokIOReportScaleOneOver

#define kIOReportScaleOneOver (1LL << 31)
1/constant

macrokIOReportExpBase

#define kIOReportExpBase (-127)
support base^(-n)

macrokIOReportExpZeroOffset

#define kIOReportExpZeroOffset -(kIOReportExpBase)
max exponent = 128

macrokIOReportScaleSIShift

#define kIOReportScaleSIShift 32
* 10^n

macrokIOReportScaleSIMask

#define kIOReportScaleSIMask 0x000000ff00000000

macrokIOReportScaleIECShift

#define kIOReportScaleIECShift 40
* 2^n

macrokIOReportScaleIECMask

#define kIOReportScaleIECMask 0x0000ff0000000000

macrokIOReportCardinalShift

#define kIOReportCardinalShift 48
placeholders

macrokIOReportCardinalMask

#define kIOReportCardinalMask 0x00ff000000000000

macrokIOReportScalePico

SI / decimal
#define kIOReportScalePico ((-12LL + kIOReportExpZeroOffset)
	                                << kIOReportScaleSIShift)

macrokIOReportScaleNano

#define kIOReportScaleNano ((-9LL + kIOReportExpZeroOffset)
	                                << kIOReportScaleSIShift)

macrokIOReportScaleMicro

#define kIOReportScaleMicro ((-6LL + kIOReportExpZeroOffset)
	                                << kIOReportScaleSIShift)

macrokIOReportScaleMilli

#define kIOReportScaleMilli ((-3LL + kIOReportExpZeroOffset)
	                                << kIOReportScaleSIShift)

macrokIOReportScaleUnity

#define kIOReportScaleUnity 0
10^0 = 2^0 = 1

macrokIOReportScaleKilo

unity = 0 is a special case for which we give up exp = -127
#define kIOReportScaleKilo ((3LL + kIOReportExpZeroOffset)
	                                << kIOReportScaleSIShift)

macrokIOReportScaleMega

#define kIOReportScaleMega ((6LL + kIOReportExpZeroOffset)
	                                << kIOReportScaleSIShift)

macrokIOReportScaleGiga

#define kIOReportScaleGiga ((9LL + kIOReportExpZeroOffset)
	                                << kIOReportScaleSIShift)

macrokIOReportScaleTera

#define kIOReportScaleTera ((12LL + kIOReportExpZeroOffset)
	                                << kIOReportScaleSIShift)

macrokIOReportScaleBits

IEC / computer / binary It's not clear we'll ever use 2^(-n), but 1..2^~120 should suffice.
#define kIOReportScaleBits kIOReportScaleUnity

macrokIOReportScaleBytes

#define kIOReportScaleBytes ((3LL + kIOReportExpZeroOffset)
	                                    << kIOReportScaleIECShift)

macrokIOReportScaleKibi

(bytes have to be added to the exponents up front, can't just OR in)
#define kIOReportScaleKibi ((10LL + kIOReportExpZeroOffset)
	                                    << kIOReportScaleIECShift)

macrokIOReportScaleKiBytes

#define kIOReportScaleKiBytes ((13LL + kIOReportExpZeroOffset)
	                                    << kIOReportScaleIECShift)

macrokIOReportScaleMebi

#define kIOReportScaleMebi ((20LL + kIOReportExpZeroOffset)
	                                    << kIOReportScaleIECShift)

macrokIOReportScaleMiBytes

#define kIOReportScaleMiBytes ((23LL + kIOReportExpZeroOffset)
	                                    << kIOReportScaleIECShift)

macrokIOReportScaleGibi

#define kIOReportScaleGibi ((30LL + kIOReportExpZeroOffset)
	                                    << kIOReportScaleIECShift)

macrokIOReportScaleGiBytes

#define kIOReportScaleGiBytes ((33LL + kIOReportExpZeroOffset)
	                                    << kIOReportScaleIECShift)

macrokIOReportScaleTebi

#define kIOReportScaleTebi ((40LL + kIOReportExpZeroOffset)
	                                    << kIOReportScaleIECShift)

macrokIOReportScaleTiBytes

#define kIOReportScaleTiBytes ((43LL + kIOReportExpZeroOffset)
	                                    << kIOReportScaleIECShift)

macrokIOReportScaleMachHWTicks

Cardinal values, to be filled in appropriately. Add values in increasing order.
#define kIOReportScaleMachHWTicks (1LL << kIOReportCardinalShift)

macrokIOReportScaleHWPageSize

#define kIOReportScaleHWPageSize (2LL << kIOReportCardinalShift)

macrokIOReportScale4KiB

page scales: 2 pages * 4ikB/page = 8096 bytes
#define kIOReportScale4KiB (4 | kIOReportScaleKiBytes)

macrokIOReportScale8KiB

#define kIOReportScale8KiB (8 | kIOReportScaleKiBytes)

macrokIOReportScale16KiB

#define kIOReportScale16KiB (16 | kIOReportScaleKiBytes)

macrokIOReportScale1GHz

Clock frequency scales (units add seconds). 1 GHz ticks are 1 ns: 1000 ticks * 1e-6 = 1e-3s This '1' is a no-op for scaling, but allows a custom label.
#define kIOReportScale1GHz (1 | kIOReportScaleNano)

macrokIOReportScale24MHz

24MHz ticks are 1/24 of a microsecond: (1/24 * kIOReportScaleMicro [1e-6])s So for example, 240 24Mticks * 1/24 * 1e-6 = .00001s [1e-5]s
#define kIOReportScale24MHz (kIOReportScaleOneOver|24 |kIOReportScaleMicro)

macrokIOReportUnitNone

2. Unit constants
#define kIOReportUnitNone __IOR_MAKEUNIT(kIOReportQuantityUndefined,
	                                          kIOReportScaleUnity)

macrokIOReportUnit_s

#define kIOReportUnit_s __IOR_MAKEUNIT(kIOReportQuantityTime,
	                                       kIOReportScaleUnity)

macrokIOReportUnit_ms

#define kIOReportUnit_ms __IOR_MAKEUNIT(kIOReportQuantityTime,
	                                       kIOReportScaleMilli)

macrokIOReportUnit_us

#define kIOReportUnit_us __IOR_MAKEUNIT(kIOReportQuantityTime,
	                                       kIOReportScaleMicro)

macrokIOReportUnit_ns

#define kIOReportUnit_ns __IOR_MAKEUNIT(kIOReportQuantityTime,
	                                       kIOReportScaleNano)

macrokIOReportUnit_J

#define kIOReportUnit_J __IOR_MAKEUNIT(kIOReportQuantityEnergy,
	                                       kIOReportScaleUnity)

macrokIOReportUnit_mJ

#define kIOReportUnit_mJ __IOR_MAKEUNIT(kIOReportQuantityEnergy,
	                                       kIOReportScaleMilli)

macrokIOReportUnit_uJ

#define kIOReportUnit_uJ __IOR_MAKEUNIT(kIOReportQuantityEnergy,
	                                       kIOReportScaleMicro)

macrokIOReportUnit_nJ

#define kIOReportUnit_nJ __IOR_MAKEUNIT(kIOReportQuantityEnergy,
	                                       kIOReportScaleNano)

macrokIOReportUnit_pJ

#define kIOReportUnit_pJ __IOR_MAKEUNIT(kIOReportQuantityEnergy,
	                                       kIOReportScalePico)

macrokIOReportUnitHWTicks

#define kIOReportUnitHWTicks __IOR_MAKEUNIT(kIOReportQuantityTime,
	                                       kIOReportScaleMachHWTicks)

macrokIOReportUnit24MHzTicks

#define kIOReportUnit24MHzTicks __IOR_MAKEUNIT(kIOReportQuantityTime,
	                                       kIOReportScale24MHz)

macrokIOReportUnit1GHzTicks

#define kIOReportUnit1GHzTicks __IOR_MAKEUNIT(kIOReportQuantityTime,
	                                       kIOReportScale1GHz)

macrokIOReportUnitBits

#define kIOReportUnitBits __IOR_MAKEUNIT(kIOReportQuantityData,
	                                        kIOReportScaleBits)

macrokIOReportUnitBytes

#define kIOReportUnitBytes __IOR_MAKEUNIT(kIOReportQuantityData,
	                                        kIOReportScaleBytes)

macrokIOReportUnit_KiB

#define kIOReportUnit_KiB __IOR_MAKEUNIT(kIOReportQuantityData,
	                                       kIOReportScaleKiBytes)

macrokIOReportUnit_MiB

#define kIOReportUnit_MiB __IOR_MAKEUNIT(kIOReportQuantityData,
	                                       kIOReportScaleMiBytes)

macrokIOReportUnit_GiB

#define kIOReportUnit_GiB __IOR_MAKEUNIT(kIOReportQuantityData,
	                                       kIOReportScaleGiBytes)

macrokIOReportUnit_TiB

#define kIOReportUnit_TiB __IOR_MAKEUNIT(kIOReportQuantityData,
	                                       kIOReportScaleTiBytes)

macrokIOReportUnitEvents

#define kIOReportUnitEvents __IOR_MAKEUNIT(kIOReportQuantityEventCount,
	                                       kIOReportScaleUnity)

macrokIOReportUnitPackets

#define kIOReportUnitPackets __IOR_MAKEUNIT(kIOReportQuantityPacketCount,
	                                       kIOReportScaleUnity)

macrokIOReportUnitInstrs

#define kIOReportUnitInstrs __IOR_MAKEUNIT(kIOReportQuantityCPUInstrs,
	                                       kIOReportScaleUnity)

macrokIOReportUnit_KI

#define kIOReportUnit_KI __IOR_MAKEUNIT(kIOReportQuantityCPUInstrs,
	                                       kIOReportScaleKilo)

macrokIOReportUnit_MI

#define kIOReportUnit_MI __IOR_MAKEUNIT(kIOReportQuantityCPUInstrs,
	                                       kIOReportScaleMega)

macrokIOReportUnit_GI

#define kIOReportUnit_GI __IOR_MAKEUNIT(kIOReportQuantityCPUInstrs,
	                                       kIOReportScaleGiga)