This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How do I calculate the execution time for a program?

Hello,

I use a LPC2148(arm7) in uVision Keil Mdk. I get the dis-assembly listing when I compile any code.Suppose if I want to calculate the execution time for the code, one way is to find the number of cycles for execution each instruction,multiply it with the clock frequency,have a recursive addition for all the instructions and finally I can get it.. But I don want to do it manually. I want to develop an app where if I enter the dis-assembly listing and the clock frequency used, it must give me my execution time. we have the readily available dis-assembly listing for the respective code generated from the ide. But how do I proceed with that? I hope I am clear with my question..

Regards
Ram Prasadh

Parents
  • Use multiple LED and turn on/off when a task calls an RTX function that may block/task switch and when it returns from that function.

    The LED for the highest priority thread will show correct time, minus losses from interrupts.
    The LED for the next highest priority can potentially continue to be lit while the higher-prio task have stepped in - but subtracting the time of the task that stepped in (simple boolean logic for the LEDs) indicates amount of time for the less prioritized task.

    In the end, it is more common to measure the time of individual threads with the other threads locked. Then to set up a model for worst-case behaviour based on what worst-case stimuli you may have that activates higher-prio threads to steal CPU capacity.

    In some situations, you'll have to settle for statistics models that runs the system at a big load while measuring the individual response times and then produces confidence values - i.e. that task C will be able to respond in less than 5ms with a confidence of 0.99 and in less than 10ms with a confidence of 0.997. You then compare your confidence intervals with the danger resulting from a missed deadline.

    In the end, few more complex systems will manage 100% confidence unless the processor is so powerful that it can always run every single thread every time and still manage all deadlines. For bigger systems, that would mean a processor that might run at much less than 1% just to have the burst capacity to do everything at once if someone really managed to create a full set of stimuli all at once.

Reply
  • Use multiple LED and turn on/off when a task calls an RTX function that may block/task switch and when it returns from that function.

    The LED for the highest priority thread will show correct time, minus losses from interrupts.
    The LED for the next highest priority can potentially continue to be lit while the higher-prio task have stepped in - but subtracting the time of the task that stepped in (simple boolean logic for the LEDs) indicates amount of time for the less prioritized task.

    In the end, it is more common to measure the time of individual threads with the other threads locked. Then to set up a model for worst-case behaviour based on what worst-case stimuli you may have that activates higher-prio threads to steal CPU capacity.

    In some situations, you'll have to settle for statistics models that runs the system at a big load while measuring the individual response times and then produces confidence values - i.e. that task C will be able to respond in less than 5ms with a confidence of 0.99 and in less than 10ms with a confidence of 0.997. You then compare your confidence intervals with the danger resulting from a missed deadline.

    In the end, few more complex systems will manage 100% confidence unless the processor is so powerful that it can always run every single thread every time and still manage all deadlines. For bigger systems, that would mean a processor that might run at much less than 1% just to have the burst capacity to do everything at once if someone really managed to create a full set of stimuli all at once.

Children
No data