Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. CcPerf.c
  5. Abstract:
  6. This module contains the perf trace routines in Cc Component
  7. Author:
  8. Stephen Hsiao (shsiao) 2-Feb-2001
  9. Revision History:
  10. --*/
  11. #include "cc.h"
  12. #ifdef ALLOC_PRAGMA
  13. #pragma alloc_text(PAGEWMI, CcPerfFileRunDown)
  14. #endif //ALLOC_PRAGMA
  15. VOID
  16. CcPerfFileRunDown(
  17. PPERFINFO_ENTRY_TABLE HashTable
  18. )
  19. /*++
  20. Routine Description:
  21. This routine walks the following lists:
  22. 1. CcDirtySharedCacheMapList
  23. 2. CcCleanSharedCacheMapList
  24. and returns a pointer to a pool allocation
  25. containing the referenced file object pointers.
  26. Arguments:
  27. None.
  28. Return Value:
  29. Returns a pointer to a NULL terminated pool allocation
  30. containing the file object pointers from the two lists,
  31. NULL if the memory could not be allocated.
  32. It is also the responsibility of the caller to dereference each
  33. file object in the list and then free the returned pool.
  34. Environment:
  35. PASSIVE_LEVEL, arbitrary thread context.
  36. --*/
  37. {
  38. KIRQL OldIrql;
  39. PSHARED_CACHE_MAP SharedCacheMap;
  40. ASSERT (KeGetCurrentIrql () == PASSIVE_LEVEL);
  41. CcAcquireMasterLock( &OldIrql );
  42. //
  43. // Walk through CcDirtySharedCacheMapList
  44. //
  45. SharedCacheMap = CONTAINING_RECORD( CcDirtySharedCacheMapList.SharedCacheMapLinks.Flink,
  46. SHARED_CACHE_MAP,
  47. SharedCacheMapLinks );
  48. while (&SharedCacheMap->SharedCacheMapLinks != &CcDirtySharedCacheMapList.SharedCacheMapLinks) {
  49. //
  50. // Skip over cursors
  51. //
  52. if (!FlagOn(SharedCacheMap->Flags, IS_CURSOR)) {
  53. PerfInfoAddToFileHash(HashTable, SharedCacheMap->FileObject);
  54. }
  55. SharedCacheMap = CONTAINING_RECORD( SharedCacheMap->SharedCacheMapLinks.Flink,
  56. SHARED_CACHE_MAP,
  57. SharedCacheMapLinks );
  58. }
  59. //
  60. // CcCleanSharedCacheMapList
  61. //
  62. SharedCacheMap = CONTAINING_RECORD( CcCleanSharedCacheMapList.Flink,
  63. SHARED_CACHE_MAP,
  64. SharedCacheMapLinks );
  65. while (&SharedCacheMap->SharedCacheMapLinks != &CcCleanSharedCacheMapList) {
  66. PerfInfoAddToFileHash(HashTable, SharedCacheMap->FileObject);
  67. SharedCacheMap = CONTAINING_RECORD( SharedCacheMap->SharedCacheMapLinks.Flink,
  68. SHARED_CACHE_MAP,
  69. SharedCacheMapLinks );
  70. }
  71. CcReleaseMasterLock( OldIrql );
  72. return;
  73. }