internal static bool SetBudgetUsage(TimeSpan usage, string instance, IActivityScope activityScope = null)
 {
     return(WorkloadManagementLogger.DoIfStarted(activityScope, delegate(IActivityScope scope)
     {
         ActivityContext.AddOperation(scope, ActivityOperationType.BudgetUsed, instance, (float)usage.TotalMilliseconds, 1);
     }));
 }
 internal static bool SetResourceBlocked(string resourceInstance, IActivityScope activityScope = null)
 {
     return(WorkloadManagementLogger.DoIfStarted(activityScope, delegate(IActivityScope scope)
     {
         ActivityContext.AddOperation(scope, ActivityOperationType.ResourceBlocked, resourceInstance, 0f, 1);
     }));
 }
 internal static bool SetQueueTime(TimeSpan queueTime, IActivityScope activityScope = null)
 {
     return(WorkloadManagementLogger.DoIfStarted(activityScope, delegate(IActivityScope scope)
     {
         ActivityContext.AddOperation(scope, ActivityOperationType.QueueTime, null, (float)queueTime.TotalMilliseconds, 1);
     }));
 }
 internal static bool SetBudgetType(string budgetType, IActivityScope activityScope = null)
 {
     WorkloadManagementLogger.RegisterMetadataIfNecessary();
     return(WorkloadManagementLogger.DoIfStarted(activityScope, delegate(IActivityScope scope)
     {
         scope.SetProperty(WlmMetaData.BudgetType, budgetType);
     }));
 }
 internal static bool SetOverBudget(string policyPart, string policyValue, IActivityScope activityScope = null)
 {
     WorkloadManagementLogger.RegisterMetadataIfNecessary();
     return(WorkloadManagementLogger.DoIfStarted(activityScope, delegate(IActivityScope scope)
     {
         ActivityContext.AddOperation(scope, ActivityOperationType.OverBudget, null, 0f, 1);
         scope.SetProperty(WlmMetaData.OverBudgetPolicyPart, policyPart);
         scope.SetProperty(WlmMetaData.OverBudgetPolicyValue, policyValue);
     }));
 }
 internal static bool SetWorkloadMetadataValues(string workloadType, string workloadClassification, bool isServiceAccount, bool isInteractive, IActivityScope activityScope = null)
 {
     WorkloadManagementLogger.RegisterMetadataIfNecessary();
     return(WorkloadManagementLogger.DoIfStarted(activityScope, delegate(IActivityScope scope)
     {
         scope.SetProperty(WlmMetaData.WorkloadType, workloadType);
         scope.SetProperty(WlmMetaData.WorkloadClassification, workloadClassification);
         scope.SetProperty(WlmMetaData.IsServiceAccount, isServiceAccount.ToString());
         scope.SetProperty(WlmMetaData.IsInteractive, isInteractive.ToString());
     }));
 }
 internal static bool SetThrottlingValues(TimeSpan delay, bool user, string instance, IActivityScope activityScope = null)
 {
     return(WorkloadManagementLogger.DoIfStarted(activityScope, delegate(IActivityScope scope)
     {
         if (user)
         {
             ActivityContext.AddOperation(scope, ActivityOperationType.UserDelay, instance, (float)delay.TotalMilliseconds, 1);
             return;
         }
         ActivityContext.AddOperation(scope, ActivityOperationType.ResourceDelay, instance, (float)delay.TotalMilliseconds, 1);
     }));
 }