/*
- * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1998-2000, 2009-2010 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
OSMetaClassDefineReservedUnused(IOCommandGate, 6);
OSMetaClassDefineReservedUnused(IOCommandGate, 7);
-bool IOCommandGate::checkForWork() { return false; }
+#if IOKITSTATS
+
+#define IOStatisticsInitializeCounter() \
+do { \
+ IOStatistics::setCounterType(IOEventSource::reserved->counter, kIOStatisticsCommandGateCounter); \
+} while (0)
+
+#define IOStatisticsActionCall() \
+do { \
+ IOStatistics::countCommandGateActionCall(IOEventSource::reserved->counter); \
+} while (0)
+
+#else
+
+#define IOStatisticsInitializeCounter()
+#define IOStatisticsActionCall()
+
+#endif /* IOKITSTATS */
bool IOCommandGate::init(OSObject *inOwner, Action inAction)
{
- return super::init(inOwner, (IOEventSource::Action) inAction);
+ bool res = super::init(inOwner, (IOEventSource::Action) inAction);
+ if (res) {
+ IOStatisticsInitializeCounter();
+ }
+
+ return res;
}
IOCommandGate *
IOTimeStampStartConstant(IODBG_CMDQ(IOCMDQ_ACTION),
(uintptr_t) inAction, (uintptr_t) owner);
+ IOStatisticsActionCall();
+
// Must be gated and on the work loop or enabled
res = (*inAction)(owner, arg0, arg1, arg2, arg3);
(uintptr_t) inAction, (uintptr_t) owner);
openGate();
-
+
return res;
}
if (trace)
IOTimeStampStartConstant(IODBG_CMDQ(IOCMDQ_ACTION),
- (uintptr_t) inAction, (uintptr_t) owner);
-
- res = (*inAction)(owner, arg0, arg1, arg2, arg3);
+ (uintptr_t) inAction, (uintptr_t) owner);
+
+ IOStatisticsActionCall();
+
+ res = (*inAction)(owner, arg0, arg1, arg2, arg3);
if (trace)
IOTimeStampEndConstant(IODBG_CMDQ(IOCMDQ_ACTION),