Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - How do the current thread get thread notification of OS intruption

Reply
 
Old 07-10-2009   #1 (permalink)
Alexander Wykel


 
 

How do the current thread get thread notification of OS intruption

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


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
New thread old question Sound & Audio
Start a new thread from an existing thread, which was started from atimer .NET General
thread General Discussion
Where is my thread? Vista music pictures video


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46