Example #1
0
		public TimerCounterContext CreateNewTimerContext (string counterName)
		{
			TimerCounter tc = GetCounterByIDOrName (counterName) as TimerCounter;
			if (tc == null) {
				throw new Exception ("Unknown timer counter " + counterName);
			}

			TimerCounterContext context = new TimerCounterContext {
				CounterName = counterName,
				TotalTime = tc.TotalTime
			};

			return context;
		}
Example #2
0
		public void WaitForTimerContext (TimerCounterContext context, int timeout = 20000, int pollStep = 200)
		{
			TimerCounter tc = GetCounterByIDOrName (context.CounterName) as TimerCounter;
			if (tc == null) {
				throw new Exception ("Unknown timer counter " + context.CounterName);
			}

			do {
				if (tc.TotalTime > context.TotalTime) {
					return;
				}

				timeout -= pollStep;
				Thread.Sleep (pollStep);
			} while (timeout > 0);

			throw new TimeoutException ("Timed out waiting for event");
		}
Example #3
0
		public void WaitForTimerContext (TimerCounterContext context, int timeout = 20000, int pollStep = 200)
		{
			TimerCounter tc = GetCounterByIDOrName (context.CounterName) as TimerCounter;
			if (tc == null) {
				throw new Exception ("Unknown timer counter " + context.CounterName);
			}

			do {
				if (tc.TotalTime > context.TotalTime) {
					return;
				}

				timeout -= pollStep;
				Thread.Sleep (pollStep);
			} while (timeout > 0);

			throw new TimeoutException ("Timed out waiting for event");
		}
Example #4
0
		public TimerCounterContext CreateNewTimerContext (string counterName)
		{
			TimerCounter tc = GetCounterByIDOrName (counterName) as TimerCounter;
			if (tc == null) {
				throw new Exception ("Unknown timer counter " + counterName);
			}

			TimerCounterContext context = new TimerCounterContext {
				CounterName = counterName,
				TotalTime = tc.TotalTime
			};

			return context;
		}