public GitStatusCache(GVFSContext context, TimeSpan backoffTime) { this.context = context; this.backoffTime = backoffTime; this.serializedGitStatusFilePath = this.context.Enlistment.GitStatusCachePath; this.statistics = new StatusStatistics(); this.wakeUpThread = new AutoResetEvent(false); }
public virtual bool WriteTelemetryandReset(EventMetadata metadata) { bool wroteTelemetry = false; if (!this.isInitialized) { return(wroteTelemetry); } StatusStatistics statusStatistics = Interlocked.Exchange(ref this.statistics, new StatusStatistics()); if (statusStatistics.BackgroundStatusScanCount > 0) { wroteTelemetry = true; metadata.Add("GitStatusCache.StatusScanCount", statusStatistics.BackgroundStatusScanCount); } if (statusStatistics.BackgroundStatusScanErrorCount > 0) { wroteTelemetry = true; metadata.Add("GitStatusCache.StatusScanErrorCount", statusStatistics.BackgroundStatusScanErrorCount); } if (statusStatistics.CacheReadyCount > 0) { wroteTelemetry = true; metadata.Add("GitStatusCache.CacheReadyCount", statusStatistics.CacheReadyCount); } if (statusStatistics.CacheNotReadyCount > 0) { wroteTelemetry = true; metadata.Add("GitStatusCache.CacheNotReadyCount", statusStatistics.CacheNotReadyCount); } if (statusStatistics.BlockedRequestCount > 0) { wroteTelemetry = true; metadata.Add("GitStatusCache.BlockedRequestCount", statusStatistics.BlockedRequestCount); } return(wroteTelemetry); }