This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

execution time calculation for application

Other Parts Discussed in Thread: SEGGER, TM4C129XNCZAD

How  can I calculate my application execution time.  Application has 5 tasks which will run parallel. What I observed is after the BIOS_start() these tasks will be executed. If I keep timestamp calculations after  BIOS_start(), it never executes. So how I have to calculate total execution time for my application including all tasks.

Thanks in advance.

  • Hi Jayalaxmi,

    What's your developpement environnement ? We need more elements to answer you.

    Only thing i can suggest to you is to set a pin to vcc on start en on gnd after the last step and target the squarre formed by signal with an oscilloscope. But ... it's not the best way i think.

    Regards,
    John.
  • jayalaxmi b c said:
    How  can I calculate my application execution time. 

    Why "calculate" when a (real) PRO IDE (such as IAR, Keil) does exactly that?     With NO Effort nor code penalty being introduced!

    An independent (and automatic) MCU "Cycle Counter" as shown -- along w/SWD - and the ability to work w/ALL Vendors' MCUs - not just one - proves far superior...

    Here's IAR's instant & zero-effort, "solution" to your quest:  (available on the free, Kickstarter version):

  • The other option is pin toggling. Set a pin when you start a task (or the main loop within the task) and reset when you end it.

    By doing this for each task of interest and observing on a logic analyzer or oscilloscope you gather a lot of information and it's visually quite apparent.

    • The time it takes for the task to complete
    • The amount of time the task executes (not the same as above)
    • The task jitter, if the task is repetitive
    • The relationship between tasks, especially any period of 'congestion'
    • CPU Load

    The downside is you need free pins.

    Robert

    Segger looks like it may have a tool that does all of this as well but I've not had the opportunity to work with it yet.

  • May we note that, "polopolopolopolopolo..." suggested identically - although not w/your clarity & feature summary.
  • IMHO this (toggling a GPIO pin) is the better method. Especially when taking into account that the OP's request is most probable incorrectly worded. Since asynchronous events are involved, runtime calculation by counting instructions is actually worthless. Of interest are are the minimal, maximal and (probably) average runtimes of a piece of code (task, function, interrupt routine, etc.), and a good scope will deliver those statistics.

    I guess professional (high price) debug adapters + IDE's can deliver this, too. I have not yet found somebody (some company) to buy that for me ...

  • f. m. said:
    I have not yet found somebody (some company) to buy that for me ...

    We have!   Suggest that you (further) refine your investigative efforts and, "Search On."

    May I (always) respectfully disagree w/the pronouncement of "Automated Cycle Counter" being, "worthless?"   Within the twists & turns of RTOS I would bet that its selective use - and then measurement & comparison of "individual code pieces/paths" would prove of good value.

    As one specific example - the proposed, "Find, attach, adjust & then VIEW the scope" forces the human into the picture.   IAR's automated method can ALL be done via a looping program - logging each/every result - OVER HOURS (even DAYS!) - minus any intensive, "human care-taking."  

    That's far from the description earlier uttered (in haste - I'd bet) - is it not?   "Free" (i.e. "Fake free) most always extracts a price - time, ease, labor ARE NOT FREE!   And linger far beyond the "sticker shock" of a Real Tool...

  • Agree - "worthless" might not have been the proper word.

    But the number of instruction cycles is not what one really wants here. Aside from Flash wait states and prefetch buffer effects that influence 'instruction cycle' - 'execution time' relation, one chooses to use an OS to deal with asynchronous effects like interrupts, that usually preempt ordinary user tasks.
    Thus, instruction cycle (in the user task context) count is not really the relevant number here. Not sure if the OP is aware of this (pretty sure he was not).
  • All good points - yet the use of a scope as opposed to some (other) means of detecting (too short or too long) pulse duration - is hereby memorialized.

    Suspect that the detection & recording of any/all "illegal" pulse widths can "free" the human operator from a highly repetitive task. (never the "strong-suit" of those "known" to lose interest, focus as time grinds on/progresses...)
  • Agreed f.m., I generally would go to a debugger doing the timing only as a last resort. Although I am hopeful the tool I mentioned will take care of part of the advantage of a logic analyzer.

    Robert
  • Well, when I say scope, I'd like to include logic analyzer as well. And I mean those ones in the prize region of a small car, with plenty of statistical options and data export in digital form.

    And BTW, instrumenting the code in such a way (perhaps with enable/disable jumper) is often helpful for field debugging. That would require some surplus resources (GPIOs, performance), and is therefore proscribed in some "el cheapo" companies ...

  • hi,

    I am using TM4C129xnczad. I am using CCS version is 6.1.1, TI Compiler 5.2.5. Can you plz heip me out

    Thanks in advance
  • Hi jayalaxmi b c,

    I think you have all informations here to start some time measurements. What help do you need here ?

    Regards,
    John
  • What help do you need here ?

    Might be wrong here, but that last request sounds suspiciously like "Had been lazy, do my homework quickly !"

  • f. m. said:
    that last request sounds suspiciously like "Had been lazy, do my homework quickly !"

    Ya think???

    (what a complete "waste" of time/resources...)  

    Only "saving grace" is the interplay among the responders (who (apparently) have done their homework...)

  • Hi,

    Seems you did not searched this forum - search with keywords execution time and you will find some code to be used for measurement, not calculation.

    Cortex-Mx micros have a powerful mechanism implemented for such thing. Good to be used for functions, code in general - except for global time estimation in rtoses. (In IAR debugger is included by default).

  • Thanks for all your replayyyyyyyy. I already tried some of the ways like using timestamp, using some hardware register. Thought that  I will get better ideas  thats why I asked for the help.  Sorry for that.  I didnot know in forum they will comment like this instead of giving solution. i have done homework.

  • You should note that there were several suggestions on how to approach the problem.

    Robert
  • I didn't mean to exclude using a 'scope f.m. Sometimes it is sufficient, other times it's a very useful addition to a logic analyzer.

    Myself I prefer an MSO, not a full featured as a top end logic analyzer but having both analog and digital traces on the same screen operating on the same trigger is very useful.

    Robert
  • jayalaxmi b c said:
    I am using TM4C129xnczad. I am using CCS version is 6.1.1, TI Compiler 5.2.5. Can you plz heip me out  

    That posting - from you - arrived today @ 01:52.   And was AFTER nearly 15 descriptive replies had been presented!

    What are we to think?   (Can you plz help me out?)   Appears - beyond ANY doubt - that we had helped you - repeatedly!

    Some of your anger/frustration may be better aimed @ "Man in the mirror.."   At the least - (some) response from you - indicating your results - perhaps going so far as to thank helpers - would work (far more) to your advantage...   Writing, "Can you plz help me out" after so many had (already) responded in great detail - was an extremely poor - and hugely inappropriate - choice of words.

  • Jayalaxmi,

    I believe there have been several useful suggestions within this thread to help you resolve your problem of measuring code execution time. The solution regarding using on chip counters is one that can be done without adding instructions to your code if you setup and use the debugger in a way to enable the RTC counter and place break points at the beginning and end of your code being measured. As mentioned you can also add GPIO toggles and measure the time between toggles with a scope.

    Seeing as how this thread has dropped to the point of questioning your intentions and some rather judgmental comments by others, I am going to shut this thread down. If, by chance, you need additional help, please open a new thread or use the messaging capability to contact me directly.