<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How do I calculate the execution time for a program?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/40137/how-do-i-calculate-the-execution-time-for-a-program</link><description> 
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</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/150365?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 11:53:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:617d07e3-7044-4574-af53-ae74c3c2e9ec</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Damn - why do I so often manage to write &amp;quot;think&amp;quot; when trying to
write &amp;quot;thing&amp;quot;? Must be damaged synapses somewhere...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/149938?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 11:53:09 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:221bfbbf-fcbe-4d4e-a9d7-2b6eb0c4ab20</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
The main think you missed here is that for an individual
instruction, you could try to look up the cycle count.&lt;/p&gt;

&lt;p&gt;
But a real program isn&amp;#39;t a single linear sequence of instructions.
It branches and loops. And some instructions takes different time
depending on input data.&lt;/p&gt;

&lt;p&gt;
Not only that. But think about a trivial memory read. It will
matter if you read from flash (and in the case the flash happens to
be cached in a cache line) or from RAM. And it will matter if the
address corresponds with some I/O functionality. And if doing
load/store, you may need to keep track of how many outstanding stores
the memory controller or the I/O controller hardware can keep track
of before being forced to stall the processor core to avoid
overflowing.&lt;/p&gt;

&lt;p&gt;
That is a reason that high-end processors often have internal
performance counters, allowing a test program to run and then read
out the performance counters to figure out&lt;br /&gt;
- number of clock cycles consumed&lt;br /&gt;
- number of read stalls&lt;br /&gt;
- number of write stalls&lt;br /&gt;
- ...&lt;/p&gt;

&lt;p&gt;
It is almost impossible to simulate this perfectly, because you
basically have to simulate the gated logic inside the processor. Keil
staff neither have the capacity or the information needed to do this
kind of simulation perfectly. So a single end user who haven&amp;#39;t spent
years jumping in and out of processor cores, simulators, ... will not
have an easier time to perform this task.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/149467?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 11:42:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c0513766-6bce-4522-9ecb-a2d27a6901bd</guid><dc:creator>Ram Prasadh</dc:creator><description>&lt;p&gt;&lt;p&gt;
There is nothing wrong in admitting truths. Yes I am way out of my
depth. I have a long way to go. Thank you for your suggestions. Will
catch on later when I come come through things later.&lt;/p&gt;

&lt;p&gt;
Regards&lt;br /&gt;
RamPrasadh&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/148966?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 11:06:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a60151d0-578c-4ec1-ade7-b95a24ad0c35</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
So why don&amp;#39;t you just write a script to parse the listing? I&amp;#39;ve
written such static analysis tools, if you knew the first thing about
what your were doing you wouldn&amp;#39;t need to be asking questions here.
How are you going to deal with loop iterations, or dynamic code
flow?&lt;/p&gt;

&lt;p&gt;
Just admit you&amp;#39;re way out of your depth, and use a practical
method like Erik suggests, and time multiple passes if you want to
quantify interruptions or caching.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/136985?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 10:57:17 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:20c12963-02c2-4c47-bb3d-90bf32d82212</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
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.&lt;/p&gt;

&lt;p&gt;
The LED for the highest priority thread will show correct time,
minus losses from interrupts.&lt;br /&gt;
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.&lt;/p&gt;

&lt;p&gt;
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.&lt;/p&gt;

&lt;p&gt;
In some situations, you&amp;#39;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.&lt;/p&gt;

&lt;p&gt;
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.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/128105?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 10:08:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ec614edd-30cc-4124-a23d-8d405779da0d</guid><dc:creator>Ram Prasadh</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;set a pin at start and reset it at end, put a scope on and you
have, by simple means, a precise run time measurement&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
This will work only when I use a particular module in polling
mode. Eg. A module runs,and I have an interrupt which gets serviced
and then the previous module one continues, Your method will give me
only the time to execute along with the context serviced too. When
two or three modules of functions run separably or with interrupts,I
need to get the execution time of each module, separably. Is it
possible to do that?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/128088?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 08:14:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c8cf1de4-2acd-4a88-8f5a-35302d135499</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Surely, the ARM7 instruction execution time is going to be
(almost) negligible relative to the timings required of the
LCD...?!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/120007?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 07:13:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2815110e-e2d2-46e0-b05a-d2e173696242</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;By the way, there is a simulator in Keil uVision, so you can
just use that. I don&amp;#39;t know how accurate it is timing-wise,&lt;/i&gt;&lt;br /&gt;
no simulator (I know of) consider cache misses and thus, per
definition, no simulator can assess execution time accurately.&lt;/p&gt;

&lt;p&gt;
anyhow&lt;/p&gt;

&lt;p&gt;
why bother with a simulator? set a pin at start and reset it at
end, put a scope on and you have, by simple means, a precise run time
measurement.&lt;/p&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/106983?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 06:52:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:49474b82-9535-433e-a3d8-cab13ba743d6</guid><dc:creator>Mike Kleshov</dc:creator><description>&lt;p&gt;&lt;p&gt;
By the way, there is a simulator in Keil uVision, so you can just
use that. I don&amp;#39;t know how accurate it is timing-wise, but I&amp;#39;m sure
you&amp;#39;ll have to work hard to match it if you decide to write your own
simulator.&lt;br /&gt;
But normally it is so much easier to measure execution time in actual
target hardware, and you get &lt;b&gt;real&lt;/b&gt; numbers as opposed to
simulations which can be not so accurate. I suggest you do just
that.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/106981?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 06:52:44 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1009f627-1faf-4d6d-b939-7a574fd60d19</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Why have 10 people doing the same thing?&lt;/p&gt;

&lt;p&gt;
Are you assessing student assignments, or something like that?&lt;/p&gt;

&lt;p&gt;
Why not just &lt;b&gt;run the code, and time it&lt;/b&gt;?!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I calculate the execution time for a program?</title><link>https://community.arm.com/thread/81104?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2013 06:33:39 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cb4c58f7-35c6-4ad3-a2c8-edbe76ee38de</guid><dc:creator>Ram Prasadh</dc:creator><description>&lt;p&gt;&lt;p&gt;
oh!! I will have a look on what is that...&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;&amp;quot;Do you really want to do it?&amp;quot;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
This is my scenario. Suppose 10 people are writing a code for the
working of LCD module for an arm7 uP. I want to find out the
execution times of each code out there and obviously we will be
having a code with the least and the high execution time. Depending
on those time obtained,I am going to make an algorithm for execution
of the a task(in this case,the LCD code is the task) for which I will
be taking the computation time of the task as the least execution
time which was obtained earlier and the deadline for the task as the
highest execution time obtained.. I hope I am clear with what am
going to do.. So , for making these stuffs possible , I need a
program to find the execution times from the dis-assembly
listing...&lt;/p&gt;

&lt;p&gt;
The thing which you said just now, &lt;b&gt;full-blown cycle-accurate
simulator&lt;/b&gt;, will it suit my need??&lt;/p&gt;

&lt;p&gt;
Regards&lt;br /&gt;
RamPrasadh&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>