[PATCH] Log error when unable to start a slave activity

Patch RTT v1 so that the user can debug why a slave activity can't start. This can occur when the user accidentally tries to start a slave activity when the master activity isn't yet started.
S

AttachmentSize
0001-Log-error-when-unable-to-start-a-slave-activity.patch1.15 KB

[PATCH] Log error when unable to start a slave activity

On Saturday 21 May 2011 14:47:53 S Roderick wrote:
> Patch RTT v1 so that the user can debug why a slave activity can't start.
> This can occur when the user accidentally tries to start a slave activity
> when the master activity isn't yet started. S

So far hard-real-time use. I now realize that log4cpp::TimeStamp uses
gettimeofday(), which certainly causes mode switches in Xenomai applications.

We'll have to refine the code in Orocos to use the
TimeStamp::TimeStamp(unsigned int seconds, unsigned int microSeconds)
constructor instead of the default constructor

There is an example here:
http://www.xenomai.org/index.php/Porting_POSIX_applications_to_Xenomai
on how to get the time of day in Xenomai applications using the posix skin.

Since we need other 'time of day' like services, it's probably better to
implement it in the fosi and then use that throughout the toolchain.

Peter

[PATCH] Log error when unable to start a slave activity

On May 24, 2011, at 08:41 , Peter Soetens wrote:

> On Saturday 21 May 2011 14:47:53 S Roderick wrote:
>> Patch RTT v1 so that the user can debug why a slave activity can't start.
>> This can occur when the user accidentally tries to start a slave activity
>> when the master activity isn't yet started. S
>
> So far hard-real-time use. I now realize that log4cpp::TimeStamp uses
> gettimeofday(), which certainly causes mode switches in Xenomai applications.

Hmmm ...

> We'll have to refine the code in Orocos to use the
> TimeStamp::TimeStamp(unsigned int seconds, unsigned int microSeconds)
> constructor instead of the default constructor

Modify the log4cpp::Timestamp implementation itself? That would introduce a depenancy that log4cpp needs RTT, right? Or are you saying to copy RTT's approach into log4cpp?

> There is an example here:
> http://www.xenomai.org/index.php/Porting_POSIX_applications_to_Xenomai
> on how to get the time of day in Xenomai applications using the posix skin.

Why not just use clock_gettime() directly within the Timestamp implementation? We could easily add a cmake check for that.

> Since we need other 'time of day' like services, it's probably better to
> implement it in the fosi and then use that throughout the toolchain.

We should certainly do this also, I'm just wary of making a dependancy on RTT in log4cpp, just to avoid writing a few lines.
S

[PATCH] Log error when unable to start a slave activity

On Tue, May 24, 2011 at 6:19 PM, Stephen Roderick <kiwi [dot] net [..] ...> wrote:
> On May 24, 2011, at 08:41 , Peter Soetens wrote:
>
>> On Saturday 21 May 2011 14:47:53 S Roderick wrote:
>>> Patch RTT v1 so that the user can debug why a slave activity can't start.
>>> This can occur when the user accidentally tries to start a slave activity
>>> when the master activity isn't yet started. S
>>
>> So far hard-real-time use. I now realize that log4cpp::TimeStamp uses
>> gettimeofday(), which certainly causes mode switches in Xenomai applications.
>
> Hmmm ...
>
>> We'll have to refine the code in Orocos to use the
>> TimeStamp::TimeStamp(unsigned int seconds, unsigned int microSeconds)
>> constructor instead of the default constructor
>
> Modify the log4cpp::Timestamp implementation itself? That would introduce a depenancy that log4cpp needs RTT, right? Or are you saying to copy RTT's approach into log4cpp?

No. I was thinking of refining the Category in OCL. The category
constructs the log message, thus also the timestamp. We should have
OCL use the RTT to set the correct date in the timestamp class. I
don't think it's good to let log4cpp depend on RTT, I even would like
to avoid that it depends on Xenomai, if possible.

>
>> There is an example here:
>> http://www.xenomai.org/index.php/Porting_POSIX_applications_to_Xenomai
>> on how to get the time of day in Xenomai applications using the posix skin.
>
> Why not just use clock_gettime() directly within the Timestamp implementation? We could easily add a cmake check for that.

That adds a dependency on Xenomai, we'd need to rename to
log4cpp-xenomai/-gnulinux etc. Like to avoid that...

>
>> Since we need other 'time of day' like services, it's probably better to
>> implement it in the fosi and then use that throughout the toolchain.
>
> We should certainly do this also, I'm just wary of making a dependancy on RTT in log4cpp, just to avoid writing a few lines.

I don't think it's gonna be a big patch... but we need to add support
in RTT which the OCL Category can use...

Peter

[PATCH] Log error when unable to start a slave activity

On May 24, 2011, at 15:11 , Peter Soetens wrote:

> On Tue, May 24, 2011 at 6:19 PM, Stephen Roderick <kiwi [dot] net [..] ...> wrote:
>> On May 24, 2011, at 08:41 , Peter Soetens wrote:
>>
>>> On Saturday 21 May 2011 14:47:53 S Roderick wrote:
>>>> Patch RTT v1 so that the user can debug why a slave activity can't start.
>>>> This can occur when the user accidentally tries to start a slave activity
>>>> when the master activity isn't yet started. S
>>>
>>> So far hard-real-time use. I now realize that log4cpp::TimeStamp uses
>>> gettimeofday(), which certainly causes mode switches in Xenomai applications.
>>
>> Hmmm ...
>>
>>> We'll have to refine the code in Orocos to use the
>>> TimeStamp::TimeStamp(unsigned int seconds, unsigned int microSeconds)
>>> constructor instead of the default constructor
>>
>> Modify the log4cpp::Timestamp implementation itself? That would introduce a depenancy that log4cpp needs RTT, right? Or are you saying to copy RTT's approach into log4cpp?
>
> No. I was thinking of refining the Category in OCL. The category
> constructs the log message, thus also the timestamp. We should have
> OCL use the RTT to set the correct date in the timestamp class. I
> don't think it's good to let log4cpp depend on RTT, I even would like
> to avoid that it depends on Xenomai, if possible.

+1

>>> There is an example here:
>>> http://www.xenomai.org/index.php/Porting_POSIX_applications_to_Xenomai
>>> on how to get the time of day in Xenomai applications using the posix skin.
>>
>> Why not just use clock_gettime() directly within the Timestamp implementation? We could easily add a cmake check for that.
>
> That adds a dependency on Xenomai, we'd need to rename to
> log4cpp-xenomai/-gnulinux etc. Like to avoid that...
>
>>
>>> Since we need other 'time of day' like services, it's probably better to
>>> implement it in the fosi and then use that throughout the toolchain.
>>
>> We should certainly do this also, I'm just wary of making a dependancy on RTT in log4cpp, just to avoid writing a few lines.
>
> I don't think it's gonna be a big patch... but we need to add support
> in RTT which the OCL Category can use...

Agreed
S

[PATCH] Log error when unable to start a slave activity

On Saturday 21 May 2011 14:47:53 S Roderick wrote:
> Patch RTT v1 so that the user can debug why a slave activity can't start.
> This can occur when the user accidentally tries to start a slave activity
> when the master activity isn't yet started. S

Applied, thanks.

Peter