Re: calculation of execution time of assembly code in a realtime program with large number of tasks



Arlet escribió:
John B wrote:

On 04/01/2007 karthikbg wrote:

Hi,

I have some 20 lines of code in assembly .
I have various tasks running. How to calculate the total time of
execution of the code in assembly alone in Vxworks ?

Since any task might get invoked due to various reasons ,
Is putting one printf that prints the current time at the start of
assmbly and another printf at the end of assmbly code that prints the
current time the only way for caculating the assmbly code execution
time ?

Any other ideas.

Thx in advans,
Karthik Balaguru
Calling 'printf()' at the start and end of 20 lines of assembler is
meaningless. The execution time of the library code will far exceed
that of the assembler. Use the old method of counting processor cycles
and adding them up. You'll be surprised at how easy it is. If you don't
have access to a pencil and paper then an abacus is quite useful.

I agree. To get the time for longer/more complicated pieces of code,
you can toggle an IO pin at the beginning and end, and use a scope to
measure the time. If the time isn't constant, a digital scope with
infinite persistence is very handy, while trying to exercise all
possible execution paths.

For a software solution, make sure you have an accurate hardware timer,
and take a timestamp at beginning and end, then subtract the values,
and report (through printf, or any other suitable method). Use the same
method to time an empty piece of code to measure the timestamping
overhead.

If you use a Pentium target, you can use the internal processor's cycle counter, which can be accesed with a pair of protected instructions. I used it when debugging a subtle concurrency problem years ago, and was very handy.
.



Relevant Pages

  • Re: HLA History
    ... Maybe you are right, DOS is obsolete ... listing generated by the assembler. ... execution of code belonging to the operating system (in this ... the instruction after the int instruction. ...
    (alt.lang.asm)
  • Re: calculation of execution time of assembly code in a realtime program with large number of tasks
    ... I have various tasks running. ... assmbly and another printf at the end of assmbly code that prints the ... current time the only way for caculating the assmbly code execution ... Calling 'printf' at the start and end of 20 lines of assembler is ...
    (comp.arch.embedded)
  • Re: the pipeline of C64x+
    ... I have a chance of programming on C64x+ from TI. ... The pipeline executes one VLIW instruction package per cycle. ... Each of this packages may have instructions for each of the eight execution units. ... I had my share of assembler coding on the C64x+ and it's a lot of work. ...
    (comp.dsp)
  • Re: subroutine storage can be used by another?
    ... Recently,I wrote a COBOL program A which call subroutine B and C ... As the objective is to write a record to an output data set, which appears to have consistent attributes during execution but which may differ from execution to execution, the question arises "Is Assembler needed at all?" ... I have used the techniques described to alter the DDNAME of a file, so that a Cobol program has a single FD, but multiple DD statements processed consecutively, and in that instance an Assembler routine is necessary. ...
    (bit.listserv.ibm-main)
  • Re: Disobeying jet engines - why?
    ... This really isn't a particularly good example because on a lot of CPUs there is an almost 1 to 1 correspondence between each line of C here and an assembler instruction. ... I challenge the ASM will do everything you need crowd to write a QUINE in their favourite assembler language. ... The errata lists are surprisingly short considering how much clever stuff like register colouring and speculative execution is going on the background to keep the thing fully utilised at every clock cycle. ...
    (sci.electronics.design)