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:

#include <rtt/os/Timer.hpp>
 
RTT::os::TimeService::ticks time_begin =
RTT::os::TimeService::Instance()->getTicks();

To get the current time (in .. ticks)

And get the time elapsed since that moment with

double time_passed =
RTT::os::TimeService::Instance()->secondsSince(m_time_begin);

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
>