←back to thread

327 points AareyBaba | 2 comments | | HN request time: 0.391s | source
Show context
arein3 ◴[] No.46194171[source]
She said it could be estimated how many cycles it takes to complete a calculation, but there are a lot of different paths which take different cycles.

How does the code work with timing? It counts cycles?

replies(1): >>46196359 #
1. constantcrying ◴[] No.46196359[source]
Major commercial airliners have system controllers where the measuring is done as follows: Write into the code some instruction which flips some output bit, hook the system up to a test rig and then get an oscilloscope. With the oscilloscope measure how long it takes between bit flips. The instructions for the measurements get commented out for the final release.

Yes, I have done this. By the way, these measurements of course have to be part of the certification.

replies(1): >>46217670 #
2. arein3 ◴[] No.46217670[source]
And it is tested with inputs that would go trough all the code branches right?

Does it have an upper limit for the longest run, or all branches have to have the same duration? I'm asking because I am curious if the function execution time being a constant is part of the program working correctly (scheduling). Somewhat related to how early programs worked correctly for 4.77 MHz and faster clock on CPU would break the program https://en.wikipedia.org/wiki/Turbo_button

I am working in free time on code for a controller that has to do time sensitive operations (actuate a solenoid/injector for a couple milliseconds) and I am thinking on how to correctly trigger the code so that the timing is accurate.