GetVersionPageSize() 공개 정적인 메소드

public static GetVersionPageSize ( ) : int
리턴 int
예제 #1
0
 public long GetDatabaseTransactionVersionSizeInBytes()
 {
     try
     {
         const string categoryName = "Database ==> Instances";
         if (PerformanceCounterCategory.Exists(categoryName) == false)
         {
             return(-1);
         }
         var          category      = new PerformanceCounterCategory(categoryName);
         var          instances     = category.GetInstanceNames();
         var          ravenInstance = instances.FirstOrDefault(x => x.StartsWith(uniqueRrefix));
         const string counterName   = "Version Buckets Allocated";
         if (ravenInstance == null || !category.CounterExists(counterName))
         {
             return(-2);
         }
         using (var counter = new PerformanceCounter(categoryName, counterName, ravenInstance, readOnly: true))
         {
             var value = counter.NextValue();
             return((long)(value * TransactionalStorageConfigurator.GetVersionPageSize()));
         }
     }
     catch (Exception e)
     {
         if (reportedGetDatabaseTransactionCacheSizeInBytesError == false)
         {
             reportedGetDatabaseTransactionCacheSizeInBytesError = true;
             log.WarnException("Failed to get Version Buckets Allocated value, this error will only be reported once.", e);
         }
         return(-3);
     }
 }