how can i see serial port speed

I’m trying to get input from a stationary bike into Unity. I’m reading from the serial port (at 9600 baud) and it’s slowing things down to about 1fps. I’ve seen the other posts with similar problems but I was already doing the polling from Update (rather than OnGUI) and I’ve tried slowing down the sampling rate (to no avail).

Presently, I’ve put the polling in another thread and only using the data when it is updated but that results in a lag. What I would like to do is to see exactly how much time the serial port is taking but I’m not sure how to get the system time in milliseconds in Unity.

Is there a way to do that? Also, any suggestions about serial port reading would be appreciated (I can post up the code if that would be useful). Thanks!

I don’t know if this is what you’re looking for, but you can read Time.realtimeSinceStartup - this value is based on the system timer, don’t take Time.timeScale into account and is updated even during the update cycle (different from Time.time, which shows the same value during the whole update cycle).