Measuring hardware API and C# - best approach advice needed



  • @dkf said:

    That shouldn't happen in the data collector; put it in another thread and let the OS do most of the worrying (since most CPUs have multiple cores now, that should be OK).

    Indeed, beyond basic sanity checking there'll be no further processing of data in the collector's thread.

    Only thing I haven't yet found is how to set the priority of the thread to high. Windows Apps are supposed to use the ThreadPool and for one-shot threads, there's indeed a way to set the priority. But there's no such thing for the periodic timer (or at least I haven't found it yet). Which means that I have two choices:

    1. Trust that the regular timer with a 1 ms period gets enough processing power
    2. Use a while()-loop inside a one-shot thread which could also mean that the USB device gets absolutely hammered with a frequency way shorter than 1 ms.

    Oh well. Will go with option 1 for now.



  • @Rhywden said:

    Is C# fast enough for that or do I need to look at C++, considering the millisecond requirement?

    I've written C# code that calculates the perceived luminance of every pixel in a full-page 300dpi scan in real time... so, yes.



  • @Jaime said:

    I've written C# code that calculates the perceived luminance of every pixel in a full-page 300dpi scan in real time... so, yes.

    I see you have read Calvin and Hobbes.

    "Do you want chocolate or strawberry ice cream?"
    "Yes!"
    "That was an either-or-question!"
    "And that was an as-well-as-answer!"

    😛

    But no need to beat me further over the head with it :)



  • I wouldn't worry about changing the thread priority level yet. Last time I messed with that, it was a big pain, so I'd recommend trying it the simple way, and only messing with priority levels if that isn't fast enough.


Log in to reply