[ros-diffs] [fireball] 41358: - Implement a helper for updating IO transfer counters. Based on a patch by Dmitry Chapyshev.

fireball at svn.reactos.org fireball at svn.reactos.org
Tue Jun 9 18:17:35 CEST 2009


Author: fireball
Date: Tue Jun  9 20:17:34 2009
New Revision: 41358

URL: http://svn.reactos.org/svn/reactos?rev=41358&view=rev
Log:
- Implement a helper for updating IO transfer counters. Based on a patch by Dmitry Chapyshev.

Modified:
    trunk/reactos/ntoskrnl/include/internal/io_x.h

Modified: trunk/reactos/ntoskrnl/include/internal/io_x.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/io_x.h?rev=41358&r1=41357&r2=41358&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] Tue Jun  9 20:17:34 2009
@@ -91,6 +91,44 @@
 
 static
 __inline
+VOID
+IopUpdateTransferCount(IN IOP_TRANSFER_TYPE Type, IN ULONG TransferCount)
+{
+    PLARGE_INTEGER CountToChange;
+    PLARGE_INTEGER TransferToChange;
+
+    /* Make sure I/O operations are being counted */
+    if (IoCountOperations)
+    {
+        if (Type == IopReadTransfer)
+        {
+            /* Increase read count */
+            CountToChange = &PsGetCurrentProcess()->ReadTransferCount;
+            TransferToChange = &IoReadTransferCount;
+        }
+        else if (Type == IopWriteTransfer)
+        {
+            /* Increase write count */
+            CountToChange = &PsGetCurrentProcess()->WriteTransferCount;
+            TransferToChange = &IoWriteTransferCount;
+        }
+        else
+        {
+            /* Increase other count */
+            CountToChange = &PsGetCurrentProcess()->OtherTransferCount;
+            TransferToChange = &IoOtherTransferCount;
+        }
+
+        /* Increase the process-wide count */
+        ExInterlockedAddLargeStatistic(CountToChange, TransferCount);
+
+        /* Increase global count */
+        ExInterlockedAddLargeStatistic(TransferToChange, TransferCount);
+    }
+}
+
+static
+__inline
 BOOLEAN
 IopValidateOpenPacket(IN POPEN_PACKET OpenPacket)
 {



More information about the Ros-diffs mailing list