Ejemplo n.º 1
0
 public CountTracker(ICountTrackerConfig config, ICountTrackerDiagnostics <TEntityType, TCountType> perfCounters, Trace tracer, Func <DateTime> timeProvider)
 {
     if (!typeof(TEntityType).IsEnum)
     {
         throw new ArgumentException("TEntityType must be an enum");
     }
     if (!typeof(TCountType).IsEnum)
     {
         throw new ArgumentException("TCountType must be an enum");
     }
     if (typeof(TEntityType).IsDefined(typeof(FlagsAttribute), false))
     {
         throw new ArgumentException("TEntityType cannot be a flags enum");
     }
     if (typeof(TCountType).IsDefined(typeof(FlagsAttribute), false))
     {
         throw new ArgumentException("TCountType cannot be a flags enum");
     }
     ArgumentValidator.ThrowIfNull("config", config);
     ArgumentValidator.ThrowIfNull("perfCounters", perfCounters);
     ArgumentValidator.ThrowIfNull("tracer", tracer);
     ArgumentValidator.ThrowIfNull("timeProvider", timeProvider);
     this.config       = config;
     this.perfCounters = perfCounters;
     this.tracer       = tracer;
     this.timeProvider = timeProvider;
     this.lastUnpromotedEmptiedTime = this.timeProvider();
     this.timer = new GuardedTimer(new TimerCallback(this.TimerCallback), null, TimeSpan.FromSeconds(5.0));
 }
Ejemplo n.º 2
0
 public EntityValue(ICountedEntity <TEntityType> entity, ICountTrackerDiagnostics <TEntityType, TCountType> perfCounters, Func <DateTime> timeProvider)
 {
     this.entity         = entity;
     this.perfCounters   = perfCounters;
     this.timeProvider   = timeProvider;
     this.measures       = new Count <TEntityType, TCountType> [CountTracker <TEntityType, TCountType> .EntityValue.countTypeToIndexMap.Count];
     this.lastAccessTime = this.timeProvider();
 }
Ejemplo n.º 3
0
 private EntityValue(ICountedEntity <TEntityType> entity, ICountTrackerDiagnostics <TEntityType, TCountType> perfCounters, Count <TEntityType, TCountType>[] measures, Func <DateTime> timeProvider) : this(entity, perfCounters, timeProvider)
 {
     this.measures = measures;
 }
Ejemplo n.º 4
0
 public CountTracker(ICountTrackerConfig config, ICountTrackerDiagnostics <TEntityType, TCountType> perfCounters, Trace tracer) : this(config, perfCounters, tracer, () => DateTime.UtcNow)
 {
 }