Re: How to set scheduling in NSThread based application
Re: How to set scheduling in NSThread based application
- Subject: Re: How to set scheduling in NSThread based application
- From: "Shawn Erickson" <email@hidden>
- Date: Mon, 12 Feb 2007 08:50:13 -0800
On 2/12/07, Gilles Celli <email@hidden> wrote:
Hi,
I've written a data acquisition-program under Cocoa which detach 2
new NSThreads:
One which collects data every 0.5 seconds (full second and
millisecond 500 via gettimeofday()) from a multimeter via USB-to-
Serial Adapter,
and another one which displays the graph of the data in NSTableView
and with the Open-Source-Based
SM2DGraphView.
...snip...
Any suggestions are greatly appreciated.
500 milliseconds is 50 times larger then the current scheduling
quantum. I really don't think thread scheduling is an issue.... unless
you have to capture something in a relatively narrow time period (i.e.
500 ms +/- a few to 10s of milliseconds).
Are you sure you are not affected by clock skew introduced in the way
you are calculating times? Or by some contested lock you are using to
protect the data you are capturing and displaying?
I think you need to profile your application with Shark.app (use
system trace feature) to better understand how your threads are
running and why you appear to be missing data samples. You could even
instrument your application with sign posts and intervals.
see: <http://developer.apple.com/tools/performance/optimizingwithsystemtrace.html>
Also can you state how you actually interface with the device you are
sampling? Do you have to send the device a request to get data or does
it post data periodically? How are you read/write data from the
USB-serial adapter?
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden