X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..bca245acd4c03fd752d1a45f011ad495e60fe53d:/iokit/Kernel/IOInterruptEventSource.cpp?ds=sidebyside diff --git a/iokit/Kernel/IOInterruptEventSource.cpp b/iokit/Kernel/IOInterruptEventSource.cpp index 19d5d597d..5decae5c6 100644 --- a/iokit/Kernel/IOInterruptEventSource.cpp +++ b/iokit/Kernel/IOInterruptEventSource.cpp @@ -218,7 +218,7 @@ IOInterruptEventSource::interruptEventSource(OSObject *inOwner, if (me && !me->init(inOwner, inAction, inProvider, inIntIndex)) { me->release(); - return 0; + return NULL; } return me; @@ -456,6 +456,9 @@ IOInterruptEventSource::normalInterruptOccurred } if (reserved->statistics) { + if (reserved->statistics->enablePrimaryTimestamp) { + reserved->statistics->primaryTimestamp = mach_absolute_time(); + } if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingFirstLevelCountIndex)) { IA_ADD_VALUE(&reserved->statistics->interruptStatistics[kInterruptAccountingFirstLevelCountIndex], 1); } @@ -484,6 +487,9 @@ IOInterruptEventSource::disableInterruptOccurred } if (reserved->statistics) { + if (reserved->statistics->enablePrimaryTimestamp) { + reserved->statistics->primaryTimestamp = mach_absolute_time(); + } if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingFirstLevelCountIndex)) { IA_ADD_VALUE(&reserved->statistics->interruptStatistics[kInterruptAccountingFirstLevelCountIndex], 1); } @@ -498,12 +504,12 @@ IOInterruptEventSource::disableInterruptOccurred void IOInterruptEventSource::interruptOccurred -(void *refcon, IOService *prov, int source) +(void *_refcon, IOService *prov, int source) { if (autoDisable && prov) { - disableInterruptOccurred(refcon, prov, source); + disableInterruptOccurred(_refcon, prov, source); } else { - normalInterruptOccurred(refcon, prov, source); + normalInterruptOccurred(_refcon, prov, source); } } @@ -513,3 +519,20 @@ IOInterruptEventSource::warmCPU { return ml_interrupt_prewarm(abstime); } + +void +IOInterruptEventSource::enablePrimaryInterruptTimestamp(bool enable) +{ + if (reserved->statistics) { + reserved->statistics->enablePrimaryTimestamp = enable; + } +} + +uint64_t +IOInterruptEventSource::getPimaryInterruptTimestamp() +{ + if (reserved->statistics && reserved->statistics->enablePrimaryTimestamp) { + return reserved->statistics->primaryTimestamp; + } + return -1ULL; +}