Measure a time in a component

Hi all!

I've finished my project in University, and now I want to do some tests.

For example, in each iteration of the component, I want to know what the running time exactly (the period is 0.01 seconds, but the running time should be less).

Is there any function within the Orocos library to measure that time? Can I use clock() function in c++, or is there another more accurate?

Thank you very much.

Jose

PS: Soon I will upload a video of my parallel robot 3DOF PRS with all the control implemented by Orocos (with Xenomai).

Measure a time in a component

On Tue, 26 Jul 2011, jocamo5 [..] ... wrote:

> Hi all!
>
> I've finished my project in University, and now I want to do some tests.
>
> For example, in each iteration of the component, I want to know what the running time exactly (the period is 0.01 seconds, but the running time should be less).
>
> Is there any function within the Orocos library to measure that time?
> Can I use clock() function in c++, or is there another more accurate?
>
RTT has a TimeService:
<http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v2.x/api/html/classRTT_1_1os_1_1TimeService.html>

> Thank you very much.
>
> Jose
>
> PS: Soon I will upload a video of my parallel robot 3DOF PRS with all the
> control implemented by Orocos (with Xenomai).

What does the robot do?

Herman

Measure a time in a component

2011/7/26 jocamo5 [..] ... <jocamo5 [..] ...>:
> Hi all!
>
> I've finished my project in University, and now I want to do some tests.
>
> For example, in each iteration of the component, I want to know what the running time exactly (the period is 0.01 seconds, but the running time should be less).
>
> Is there any function within the Orocos library to measure that time?
> Can I use  clock() function in c++, or is there another more accurate?

You can use the RTT::os::TimeService:

&#10;#include &lt;rtt/os/Timer.hpp&gt;&#10;&#10;RTT::os::TimeService::ticks time_begin =&#10;RTT::os::TimeService::Instance()-&gt;getTicks();&#10;

To get the current time (in .. ticks)

And get the time elapsed since that moment with

&#10;double time_passed =&#10;RTT::os::TimeService::Instance()-&gt;secondsSince(m_time_begin);&#10;

Regards,

Steven

>
> Thank you very much.
>
> Jose
>
> PS: Soon I will upload a video of my parallel robot 3DOF PRS with all the control implemented by Orocos (with Xenomai).
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>