I have an application which samples events (in microseconds) and reports the
event index and time sample, it then displays the results in a graph. The
problem is that while the current thread is executing some unknow event
causes the time base to jump a few thousand microseconds, causing
discontiguity in the graph. I have implimentd
System.GC.WaitForPendingFinalizers() and the problem continues. Strange
thing is that the problem is more noticable for a graph of a function
executing in O(1), and not a graph executing in O(n log n). The application
is C# WPF, and uses System.Reflections to invoke the target method like so:

---invoke method code---
for (this._theCount = 1; this._theCount < _infinityPoint;
this._theCount++)
{
param[0] = this._theCount;

this._sw.Start();
this._entryPointMethod.Invoke(this._targetClass,
param);

this._sw.Stop();
System.GC.WaitForPendingFinalizers();
_markerPoints[(int)this._theCount] = MarkerPoint;
}
---code---

---Invoke Property Code---
object target =
this._asm.CreateInstance(this._targetClass.FullName);


for (this._theCount = 1; this._theCount <
_infinityPoint; this._theCount++)
{
this._sw.Start();
this._entryPointProperty.SetValue(target,
this._theCount, null);

this._sw.Stop();
System.GC.WaitForPendingFinalizers();
_markerPoints[(int)this._theCount] = MarkerPoint;
}
---code---

Here is the problem code:

---Reflected Property Invocation---
class fib
{
double n = 0;
int n2 = 0;
public double next
{
get { return n; }
set
{ //O(1)
n = Math.Floor(((Math.Pow(fib.golden(),
Convert.ToDouble(value))) - Math.Pow((1 - fib.golden()),
Convert.ToDouble(value))) / Math.Sqrt(5));
}
}

private static double golden()
{
return (1 + Math.Sqrt(5)) / 2;
}
}
---code---

Graphing this function is less problematic:

---Method Invoke Code---

//O(n log n)
public static double LinerFib(double n)
{
double previous = -1;
double result = 1;
double sum = 0;

for (double i = 0; i <= n; ++i)
{
sum = result + previous;
previous = result;
result = sum;
}
return result;
}
---code---

How do I isolate the problem? I am thinking that the current thread is
being intrupted by the OS, if so how can I trap the event stop the timer and
restart after the event completes.

Thanks in advance is you know the answer to this question

--
Alexander L. Wykel
AW Software Works