[NTOSKRNL] Add the CcDataFlushes and CcDataPages counters

This commit is contained in:
Pierre Schweitzer 2018-02-24 14:02:33 +01:00
parent 0fbdf31709
commit 9ac2e9855a
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
4 changed files with 19 additions and 2 deletions

View file

@ -43,6 +43,13 @@ ULONG CcFastReadWait;
ULONG CcFastReadNoWait;
ULONG CcFastReadResourceMiss;
/* Counters:
* - Amount of pages flushed to the disk
* - Number of flush operations
*/
ULONG CcDataPages = 0;
ULONG CcDataFlushes = 0;
/* FUNCTIONS *****************************************************************/
VOID

View file

@ -709,8 +709,8 @@ QSI_DEF(SystemPerformanceInformation)
Spi->CcReadAheadIos = 0; /* FIXME */
Spi->CcLazyWriteIos = CcLazyWriteIos;
Spi->CcLazyWritePages = CcLazyWritePages;
Spi->CcDataFlushes = 0; /* FIXME */
Spi->CcDataPages = 0; /* FIXME */
Spi->CcDataFlushes = CcDataFlushes;
Spi->CcDataPages = CcDataPages;
Spi->ContextSwitches = 0; /* FIXME */
Spi->FirstLevelTbFills = 0; /* FIXME */
Spi->SecondLevelTbFills = 0; /* FIXME */

View file

@ -62,6 +62,8 @@ extern ULONG CcMapDataWait;
extern ULONG CcMapDataNoWait;
extern ULONG CcPinReadWait;
extern ULONG CcPinReadNoWait;
extern ULONG CcDataPages;
extern ULONG CcDataFlushes;
typedef struct _PF_SCENARIO_ID
{

View file

@ -1039,6 +1039,14 @@ IoSynchronousPageWrite(IN PFILE_OBJECT FileObject,
IOTRACE(IO_API_DEBUG, "FileObject: %p. Mdl: %p. Offset: %p \n",
FileObject, Mdl, Offset);
/* Is the write originating from Cc? */
if (FileObject->SectionObjectPointer != NULL &&
FileObject->SectionObjectPointer->SharedCacheMap != NULL)
{
++CcDataFlushes;
CcDataPages += BYTES_TO_PAGES(MmGetMdlByteCount(Mdl));
}
/* Get the Device Object */
DeviceObject = IoGetRelatedDeviceObject(FileObject);