예제 #1
0
        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);
        }
예제 #2
0
		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);
		}
예제 #3
0
 private void ResourceCounterCallback(ResourceCounter resourceCounter)
 {
     if (canInvoke)
     {
         try
         {
             resourceCounterToGridRow[resourceCounter].Cells[1].Value = resourceCounter.Value;
         }
         catch (KeyNotFoundException)
         {
         }
     }
 }
예제 #4
0
 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);
         }
     }
 }
예제 #5
0
		public MemoryCache(string debugName) : base(debugName)
		{
			this.clockQueue = new LinkedList<CacheRecord>();
			this.interestingStuffResourceCounter = DiagnosticUI.theDiagnostics.fetchResourceCounter("Cache:" + debugName + "-interestingStuff", -1);
		}
예제 #6
0
		public ResourceCounter(string resourceName, int period, ResourceCounter.NotifyDelegate notifyDelegate)
		{
			this.resourceName = resourceName;
			this.period = period;
			this.notifyDelegate = notifyDelegate;
		}
예제 #7
0
		private void ResourceCounterCallback(ResourceCounter resourceCounter)
		{
			if (this.canInvoke)
			{
				try
				{
					this.resourceCounterToGridRow[resourceCounter].Cells[1].Value = resourceCounter.Value;
				}
				catch (KeyNotFoundException)
				{
				}
			}
		}
예제 #8
0
		public CacheBase(string hashName)
		{
			this.hashName = hashName;
			this.cache = new Dictionary<IFuture, CacheRecord>();
			this.resourceCounter = DiagnosticUI.theDiagnostics.fetchResourceCounter("Cache:" + hashName, -1);
		}