- Remove perf code from Ob SD Cache implementation.

svn path=/trunk/; revision=33091
This commit is contained in:
Aleksey Bragin 2008-04-21 18:33:23 +00:00
parent 3c1b0a2a64
commit 901badd513

View file

@ -18,16 +18,6 @@
#define SD_CACHE_ENTRIES 0x100 #define SD_CACHE_ENTRIES 0x100
OB_SD_CACHE_LIST ObsSecurityDescriptorCache[SD_CACHE_ENTRIES]; OB_SD_CACHE_LIST ObsSecurityDescriptorCache[SD_CACHE_ENTRIES];
ULONGLONG Cycles;
ULONG TimeDelta;
#define ObpSdCacheBeginPerfCount() \
Cycles = __rdtsc();
#define ObpSdCacheEndPerfCount() \
TimeDelta += __rdtsc() - Cycles;
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
VOID VOID
@ -191,14 +181,12 @@ ObpReferenceSecurityDescriptor(IN POBJECT_HEADER ObjectHeader)
{ {
PSECURITY_DESCRIPTOR SecurityDescriptor; PSECURITY_DESCRIPTOR SecurityDescriptor;
PSECURITY_DESCRIPTOR_HEADER SdHeader; PSECURITY_DESCRIPTOR_HEADER SdHeader;
ObpSdCacheBeginPerfCount();
/* Get the SD */ /* Get the SD */
SecurityDescriptor = ObjectHeader->SecurityDescriptor; SecurityDescriptor = ObjectHeader->SecurityDescriptor;
if (!SecurityDescriptor) if (!SecurityDescriptor)
{ {
/* No SD, nothing to do */ /* No SD, nothing to do */
ObpSdCacheEndPerfCount();
return NULL; return NULL;
} }
@ -213,7 +201,6 @@ ObpReferenceSecurityDescriptor(IN POBJECT_HEADER ObjectHeader)
/* Release the lock and return */ /* Release the lock and return */
ObpReleaseObjectLock(ObjectHeader); ObpReleaseObjectLock(ObjectHeader);
ObpSdCacheEndPerfCount();
return SecurityDescriptor; return SecurityDescriptor;
} }
@ -242,14 +229,12 @@ ObReferenceSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
IN ULONG Count) IN ULONG Count)
{ {
PSECURITY_DESCRIPTOR_HEADER SdHeader; PSECURITY_DESCRIPTOR_HEADER SdHeader;
ObpSdCacheBeginPerfCount();
/* Get the header */ /* Get the header */
SdHeader = ObpGetHeaderForSd(SecurityDescriptor); SdHeader = ObpGetHeaderForSd(SecurityDescriptor);
/* Do the references */ /* Do the references */
InterlockedExchangeAdd((PLONG)&SdHeader->RefCount, Count); InterlockedExchangeAdd((PLONG)&SdHeader->RefCount, Count);
ObpSdCacheEndPerfCount();
} }
/*++ /*++
@ -278,7 +263,6 @@ ObDereferenceSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
LONG OldValue, NewValue; LONG OldValue, NewValue;
ULONG Index; ULONG Index;
POB_SD_CACHE_LIST CacheEntry; POB_SD_CACHE_LIST CacheEntry;
ObpSdCacheBeginPerfCount();
/* Get the header */ /* Get the header */
SdHeader = ObpGetHeaderForSd(SecurityDescriptor); SdHeader = ObpGetHeaderForSd(SecurityDescriptor);
@ -293,7 +277,7 @@ ObDereferenceSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
NewValue = InterlockedCompareExchange((PLONG)&SdHeader->RefCount, NewValue = InterlockedCompareExchange((PLONG)&SdHeader->RefCount,
OldValue - Count, OldValue - Count,
OldValue); OldValue);
if (NewValue == OldValue) ObpSdCacheEndPerfCount(); return; if (NewValue == OldValue) return;
/* Try again */ /* Try again */
OldValue = NewValue; OldValue = NewValue;
@ -325,7 +309,6 @@ ObDereferenceSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
ObpSdReleaseLock(CacheEntry); ObpSdReleaseLock(CacheEntry);
} }
ObpSdCacheEndPerfCount();
} }
/*++ /*++
@ -359,7 +342,6 @@ ObLogSecurityDescriptor(IN PSECURITY_DESCRIPTOR InputSecurityDescriptor,
POB_SD_CACHE_LIST CacheEntry; POB_SD_CACHE_LIST CacheEntry;
BOOLEAN Result; BOOLEAN Result;
PLIST_ENTRY NextEntry; PLIST_ENTRY NextEntry;
ObpSdCacheBeginPerfCount();
/* Get the length */ /* Get the length */
Length = RtlLengthSecurityDescriptor(InputSecurityDescriptor); Length = RtlLengthSecurityDescriptor(InputSecurityDescriptor);
@ -418,7 +400,6 @@ ObLogSecurityDescriptor(IN PSECURITY_DESCRIPTOR InputSecurityDescriptor,
/* Free anything that we may have had to create */ /* Free anything that we may have had to create */
if (NewHeader) ExFreePool(NewHeader); if (NewHeader) ExFreePool(NewHeader);
ObpSdCacheEndPerfCount();
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -453,7 +434,6 @@ ObLogSecurityDescriptor(IN PSECURITY_DESCRIPTOR InputSecurityDescriptor,
/* Return the SD*/ /* Return the SD*/
*OutputSecurityDescriptor = &NewHeader->SecurityDescriptor; *OutputSecurityDescriptor = &NewHeader->SecurityDescriptor;
ObpSdCacheEndPerfCount();
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }