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

Execution Time

Hello, I want to determine execution time required for a function which executes when a serial interrupt occurs. I am using Keil C compiler for it. Can anybody tell me procedure for the same.

Regards,
Abhijeet R. Mudgal.

Parents
  • I want to determine execution time required for a function"

    Why do you want to do that?

    Have you simply been set this as an exercise, or is it an important requirement for your application for you to know this?

    If it is important for your application for you to know this, then you should not be writing in 'C' - because 'C' gives you absolutely no guarantee whatsoever that it won't change!

    If it is important for your application for you to know this, then you should be writing it in assembler - then you know exactly what you will get!

Reply
  • I want to determine execution time required for a function"

    Why do you want to do that?

    Have you simply been set this as an exercise, or is it an important requirement for your application for you to know this?

    If it is important for your application for you to know this, then you should not be writing in 'C' - because 'C' gives you absolutely no guarantee whatsoever that it won't change!

    If it is important for your application for you to know this, then you should be writing it in assembler - then you know exactly what you will get!

Children
  • If it is important for your application for you to know this, then you should be writing it in assembler - then you know exactly what you will get!

    Why so categorical? I _always_ try to estimate execution time and expected rate of triggering of my ISRs. Just to make sure I don't overwhelm the CPU. Knowing that I have a good margin in CPU usage, I can be sure that minor modifications in compiler output will not change my estimate dramatically.

  • An estimate is one thing; trying to fully determine it is another.

    But maybe I misinterpreted the question - and all he wants is, as you say, an estimate.

    "I can be sure that minor modifications in compiler output will not change my estimate dramatically."

    Beware - aparently "minor" changes to the source code might cause major changes in the executable...!

  • I meant to add:

    If he made clear why he wants to do this - which was my question - it'd probably be clear whether or not I'd misinterpreted...