Skip to contentSkip to conversation

RTDM timing problems

Xenomai-help Rodrigo Rosenfeld Rosas 3 participants 8 messages Jan 30, 2006 – Feb 2, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I just can't understand what is happening.

The above code on my driver initialization gives the following results.

        start_time = rtdm_clock_read();
	rtdm_task_busy_sleep(43000);
	temp_time = rtdm_clock_read();
	   rtdm_printk(KERN_INFO "%u - %u = %u\n",(unsigned int) temp_time, (unsigned 

int) start_time, (unsigned int) (temp_time-start_time));

	   rtdm_printk(KERN_INFO "%u - %u = %u\n",(unsigned int) 

(temp_time&0xffffffff), (unsigned int) start_time&0xffffffff, (unsigned int) ((temp_time-start_time)&0xffffffff));

As I expected, both printk gave the same (wrong?) result:
3175950208 - 2800623168 = 375327040

I was waiting something near to 43000, shouldn't I?

Please, can someone explain me what is going on...

Thanks,

Rodrigo.

_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html

#1 lore raw
Quoted 17 lines · Rodrigo Rosenfeld Rosas

Hi,

I just can't understand what is happening.

The above code on my driver initialization gives the following results.

        start_time = rtdm_clock_read();
	rtdm_task_busy_sleep(43000);
	temp_time = rtdm_clock_read();
	   rtdm_printk(KERN_INFO "%u - %u = %u\n",(unsigned int) temp_time, (unsigned 

int) start_time, (unsigned int) (temp_time-start_time));

	   rtdm_printk(KERN_INFO "%u - %u = %u\n",(unsigned int) 

(temp_time&0xffffffff), (unsigned int) start_time&0xffffffff, (unsigned int) ((temp_time-start_time)&0xffffffff));

Quoted 7 lines

As I expected, both printk gave the same (wrong?) result:
3175950208 - 2800623168 = 375327040

I was waiting something near to 43000, shouldn't I?

Please, can someone explain me what is going on...

Basically confirmed:

I-pipe: Domain Xenomai registered.
Xenomai: hal/x86 started.
Xenomai: real-time nucleus v2.1-rc2 (Champagne) loaded.
Xenomai: starting RTDM services.
4194262080 - 2680902336 = 1513359744

But when I additionally load xeno_posix to get the system timer started:

Xenomai: starting POSIX services.
3899754503 - 3899706087 = 48416

The point is that rtdm_clock_read() relies on the nucleus timer being started. Otherwise, it just returns plain wrong numbers.

This makes me scream again for that damn timer being started AUTOMATICALLY! I guess Philippe knows what I'm talking about... ;) Meanwhile, we should state this in the docs. At least for 2.0.x, this will remain true anyway.

Jan

#2 lore raw

Jan,

Can't you start it with a short Linux user-space app upon startup ? Doesn't even need to go realtime.

I'm planning to try this as I want to start two unrelated Xenomai processes which need the timer for timeouts (obviously in a perpetual effort to test the Xenomai kernel ;-))

Jeroen.

This makes me scream again for that damn timer being started

Quoted 4 lines

AUTOMATICALLY! I guess Philippe knows what I'm talking about... ;) Meanwhile, we should state this in the docs. At least for 2.0.x, this will remain true anyway.

#3 lore raw
Quoted 9 lines · Jeroen Van den Keybus

Jan,

Can't you start it with a short Linux user-space app upon startup ? Doesn't even need to go realtime.

I'm planning to try this as I want to start two unrelated Xenomai processes which need the timer for timeouts (obviously in a perpetual effort to test the Xenomai kernel ;-))

Of course, you can. And this is also what we are doing in our software so far. Anyway, the point is that this step is superfluous if only aperiodic mode is available. Moreover, it's inconsistent compared to other skin's interfaces. But there is hope we will overcome it one day. :)

Jan

#4 lore raw
In reply to Jan Kiszka

Em Segunda 30 Janeiro 2006 16:42, Jan Kiszka escreveu:

Quoted 7 lines

The point is that rtdm_clock_read() relies on the nucleus timer being started. Otherwise, it just returns plain wrong numbers.

This makes me scream again for that damn timer being started AUTOMATICALLY! I guess Philippe knows what I'm talking about... ;) Meanwhile, we should state this in the docs. At least for 2.0.x, this will remain true anyway.

What can I do for now? What is the relation between the system time and the timer?

Thank you Jan,

Rodrigo.

_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html

#5 lore raw
Quoted 5 lines · Rodrigo Rosenfeld Rosas

Em Segunda 30 Janeiro 2006 16:42, Jan Kiszka escreveu:

Quoted 3 lines

The point is that rtdm_clock_read() relies on the nucleus timer being started. Otherwise, it just returns plain wrong numbers.

Quoted 7 lines
Quoted 4 lines

This makes me scream again for that damn timer being started AUTOMATICALLY! I guess Philippe knows what I'm talking about... ;) Meanwhile, we should state this in the docs. At least for 2.0.x, this will remain true anyway.

What can I do for now? What is the relation between the system time and the timer?

Just start the timer before using rtdm_clock_read(). This is now also stated in the docs.

Jan

#6 lore raw

Em Quinta 02 Fevereiro 2006 10:48, voc=EA escreveu:

Quoted 10 lines
Quoted 9 lines · Rodrigo Rosenfeld Rosas

Em Segunda 30 Janeiro 2006 16:42, Jan Kiszka escreveu:

Quoted 7 lines

The point is that rtdm_clock_read() relies on the nucleus timer being started. Otherwise, it just returns plain wrong numbers.

This makes me scream again for that damn timer being started AUTOMATICALLY! I guess Philippe knows what I'm talking about... ;) Meanwhile, we should state this in the docs. At least for 2.0.x, this will remain true anyway.

Quoted 4 lines
Quoted 2 lines

What can I do for now? What is the relation between the system time and the timer?

Just start the timer before using rtdm_clock_read().

Sorry, It is not clear to me how can I do that.

Regards,

Rodrigo.

_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html

#7 lore raw
Quoted 11 lines · Rodrigo Rosenfeld Rosas

Em Quinta 02 Fevereiro 2006 10:48, você escreveu:

Quoted 9 lines
Quoted 8 lines · Rodrigo Rosenfeld Rosas

Em Segunda 30 Janeiro 2006 16:42, Jan Kiszka escreveu:

Quoted 7 lines

The point is that rtdm_clock_read() relies on the nucleus timer being started. Otherwise, it just returns plain wrong numbers.

This makes me scream again for that damn timer being started AUTOMATICALLY! I guess Philippe knows what I'm talking about... ;) Meanwhile, we should state this in the docs. At least for 2.0.x, this will remain true anyway.

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

What can I do for now? What is the relation between the system time and the timer?

Just start the timer before using rtdm_clock_read().

Sorry, It is not clear to me how can I do that.

rt_timer_start() if you use the native API in your application. But I would suggest to maintain a simple helper tool just for starting / stopping the timer for native apps as long as this is explicitly needed. As I indicated, plans exist to overcome this in 2.1.

Jan