private void AddBenchStats(StringBuilder log) { log.AppendLine("======CashedCoinView Bench======"); log.AppendLine("Cache entries".PadRight(20) + this.cacheEntryCount); CachePerformanceSnapshot snapShot = this.performanceCounter.Snapshot(); if (this.latestPerformanceSnapShot == null) log.AppendLine(snapShot.ToString()); else log.AppendLine((snapShot - this.latestPerformanceSnapShot).ToString()); this.latestPerformanceSnapShot = snapShot; }
private void AddBenchStats(StringBuilder log) { log.AppendLine("======CachedCoinView Bench======"); DateTime now = this.dateTimeProvider.GetUtcNow(); var lastFlush = (now - this.lastCacheFlushTime).TotalMinutes; log.AppendLine("Last flush ".PadRight(20) + Math.Round(lastFlush, 2) + " min ago (flush every " + TimeSpan.FromSeconds(this.CacheFlushTimeIntervalSeconds).TotalMinutes + " min)"); log.AppendLine("Coin cache tip ".PadRight(20) + this.blockHash.Height); log.AppendLine("Coin store tip ".PadRight(20) + this.innerBlockHash.Height); log.AppendLine("block store tip ".PadRight(20) + "tbd"); log.AppendLine(); log.AppendLine("Cache entries ".PadRight(20) + this.cacheCount + " items"); log.AppendLine("Dirty cache entries ".PadRight(20) + this.dirtyCacheCount + " items"); log.AppendLine("Rewind data entries ".PadRight(20) + this.rewindDataCount + " items"); var cache = this.cacheSizeBytes; var rewind = this.rewindDataSizeBytes; double filledPercentage = Math.Round(((cache + rewind) / (double)this.MaxCacheSizeBytes) * 100, 2); log.AppendLine("Cache size".PadRight(20) + cache.BytesToMegaBytes() + " MB"); log.AppendLine("Rewind data size".PadRight(20) + rewind.BytesToMegaBytes() + " MB"); log.AppendLine("Total cache size".PadRight(20) + (cache + rewind).BytesToMegaBytes() + " MB / " + this.consensusSettings.MaxCoindbCacheInMB + " MB (" + filledPercentage + "%)"); CachePerformanceSnapshot snapShot = this.performanceCounter.Snapshot(); if (this.latestPerformanceSnapShot == null) { log.AppendLine(snapShot.ToString()); } else { log.AppendLine((snapShot - this.latestPerformanceSnapShot).ToString()); } this.latestPerformanceSnapShot = snapShot; }