示例#1
0
        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);
        }
示例#2
0
        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);
        }