This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: measure the execution time of each thread


On 04/18/2011 04:00 PM, moktar_bouain wrote:

http://ecos.sourceware.org/docs-latest/ref/kernel-clocks.html

static cyg_tick_count_t run_time;
cyg_tick_count_t start, end, run_time;

while (1) {
> start = cyg_current_time();

><processing ...>

    >end = cyg_current_time();
    >run_time = end - start;
}

Then you just need to convert ticks to time, based on the tick rate
for your platform.

Hi Mike, Thank you for your reply. I tried with your solution,but the value of run_time is always constant.(run_time =1)

Note that this technique is only accurate to the system tick time which is normally 10ms. If your thread runs for less time than this, you won't know.

Look at the test program tm_basic.cxx for details on how to measure
at a finer grain (without the overhead of decreasing the tick time).

--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]