public ResourceCounter fetchResourceCounter(string resourceName, int period) { Monitor.Enter(this); ResourceCounter result; try { if (!resourceCountersByName.ContainsKey(resourceName)) { resourceCountersByName[resourceName] = new ResourceCounter(resourceName, period, ResourceCounterCallback); if (canInvoke) { DebugThreadInterrupter.theInstance.AddThread("DiagnosticUI.CreateAllCountersInvokeThread", CreateAllCountersInvokeThread, ThreadPriority.Normal); } } result = resourceCountersByName[resourceName]; } finally { Monitor.Exit(this); } return(result); }
public DiskCache() { this.cacheDir = Path.Combine(Environment.GetEnvironmentVariable("TMP"), "mapcache\\"); this.stableFreshCountPathname = Path.Combine(this.cacheDir, "FreshCount.txt"); this.CreateCacheDirIfNeeded(); DebugThreadInterrupter.theInstance.AddThread("DiskCache.DeferredWriteThread", new ThreadStart(this.DeferredWriteThread), ThreadPriority.Normal); DebugThreadInterrupter.theInstance.AddThread("DiskCache.EvictThread", new ThreadStart(this.EvictThread), ThreadPriority.Normal); this.resourceCounter = DiagnosticUI.theDiagnostics.fetchResourceCounter("DiskCache", -1); }
private void ResourceCounterCallback(ResourceCounter resourceCounter) { if (canInvoke) { try { resourceCounterToGridRow[resourceCounter].Cells[1].Value = resourceCounter.Value; } catch (KeyNotFoundException) { } } }
private void CreateAllCounters() { foreach (string current in resourceCountersByName.Keys) { ResourceCounter resourceCounter = resourceCountersByName[current]; if (!resourceCounterToGridRow.ContainsKey(resourceCounter)) { int index = resourceCountersGridView.Rows.Add(); DataGridViewRow dataGridViewRow = resourceCountersGridView.Rows[index]; dataGridViewRow.Cells[0].Value = current; dataGridViewRow.Cells[1].Value = resourceCounter.Value; resourceCounterToGridRow.Add(resourceCounter, dataGridViewRow); } } }
public MemoryCache(string debugName) : base(debugName) { this.clockQueue = new LinkedList<CacheRecord>(); this.interestingStuffResourceCounter = DiagnosticUI.theDiagnostics.fetchResourceCounter("Cache:" + debugName + "-interestingStuff", -1); }
public ResourceCounter(string resourceName, int period, ResourceCounter.NotifyDelegate notifyDelegate) { this.resourceName = resourceName; this.period = period; this.notifyDelegate = notifyDelegate; }
private void ResourceCounterCallback(ResourceCounter resourceCounter) { if (this.canInvoke) { try { this.resourceCounterToGridRow[resourceCounter].Cells[1].Value = resourceCounter.Value; } catch (KeyNotFoundException) { } } }
public CacheBase(string hashName) { this.hashName = hashName; this.cache = new Dictionary<IFuture, CacheRecord>(); this.resourceCounter = DiagnosticUI.theDiagnostics.fetchResourceCounter("Cache:" + hashName, -1); }