Error when using RTEMS_MICROSECONDS_TO_TICKS

Richi Dubey richidubey at gmail.com
Tue May 11 15:10:06 UTC 2021


>
> Yes, 6000 microseconds isn't 6 seconds.

:p Ouch. Yes. Thanks.

Use (rtems_clock_get_ticks_per_second() * 6) as documented here:
>
> https://docs.rtems.org/releases/rtems-docs-4.11.2/c-user/clock_manager.html#rtems-clock-get-ticks-per-second
>


Yes, This works! Thanks.

On Tue, May 11, 2021 at 7:27 PM Joel Sherrill <joel at rtems.org> wrote:

>
>
>
> On Tue, May 11, 2021 at 1:11 AM Gedare Bloom <gedare at rtems.org> wrote:
>
>> On Sun, May 9, 2021 at 9:33 AM Richi Dubey <richidubey at gmail.com> wrote:
>> >
>> > Hi,
>> >
>> > I am using the line:
>> rtems_task_wake_after(RTEMS_MICROSECONDS_TO_TICKS(6000)); in my test
>> program to emulate a 6 seconds sleep. But when I deubg the program using
>> qemu, I do not see it waiting for 6 seconds; on debugging, there is a error
>> of a shared library file not found, which leads to the ticks being 0. Can
>> someone please help?
>> >
>>
>> Yes, 6000 microseconds isn't 6 seconds.
>>
>
> Use (rtems_clock_get_ticks_per_second() * 6) as documented here:
>
>
> https://docs.rtems.org/releases/rtems-docs-4.11.2/c-user/clock_manager.html#rtems-clock-get-ticks-per-second
>
>
> But if you are on a simulator, it won't match 6 seconds of "real world
> time". Simulators run at a different speed than "real time" and 6 seconds
> of simulated processor time could take much less or much more time. Depends
> on the simulator, target processor, and the host computer.
>
>
>>
>> > Debug log:
>> >
>> >
>> ----------------------------------------------------------------------------------------------------------
>> > 35  rtems_task_wake_after(RTEMS_MICROSECONDS_TO_TICKS(6000));
>> > (gdb) si
>> > 0x00101176 135
>> rtems_task_wake_after(RTEMS_MICROSECONDS_TO_TICKS(6000));
>> > (gdb)
>> > 0x00101178 135
>> rtems_task_wake_after(RTEMS_MICROSECONDS_TO_TICKS(6000));
>> > (gdb)
>> > 0x0010117c 135
>> rtems_task_wake_after(RTEMS_MICROSECONDS_TO_TICKS(6000));
>> > (gdb)
>> > __udivsi3 () at
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S:1104
>> > 1104
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S: No
>> such file or directory.
>> > (gdb)
>> > 1105 in
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S
>> > (gdb) ni
>> > 1106 in
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S
>> > (gdb)
>> > 1107 in
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S
>> > (gdb) si
>> > 1108 in
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S
>> > (gdb) ni
>> > 1109 in
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S
>> > (gdb)
>> > 1118 in
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S
>> > (gdb)
>> > 1119 in
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S
>> > (gdb)
>> > 1120 in
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S
>> > (gdb)
>> > 1121 in
>> ../../../../../../gnu-mirror-gcc-57b5da3/libgcc/config/arm/lib1funcs.S
>> > (gdb)
>> > 0x00101180 in test () at
>> ../../../testsuites/smptests/smpschededf05/init.c:135
>> > 135  rtems_task_wake_after(RTEMS_MICROSECONDS_TO_TICKS(6000));
>> > (gdb) si
>> > 0x00101182 135
>> rtems_task_wake_after(RTEMS_MICROSECONDS_TO_TICKS(6000));
>> > (gdb)
>> > 0x00101184 135
>> rtems_task_wake_after(RTEMS_MICROSECONDS_TO_TICKS(6000));
>> > (gdb)
>> > rtems_task_wake_after (ticks=16777216) at
>> ../../../cpukit/rtems/src/taskwakeafter.c:30
>> > 30 {
>> > (gdb)
>> > 0x00108b44 30 {
>> > (gdb) ni
>> > 0x00108b46 30 {
>> > (gdb)
>> > 0x00108b48 30 {
>> > (gdb)
>> > 38  cpu_self = _Thread_Dispatch_disable();
>> > (gdb)
>> > 0x00108b4e 38  cpu_self = _Thread_Dispatch_disable();
>> > (gdb)
>> > 39    executing = _Per_CPU_Get_executing( cpu_self );
>> > (gdb)
>> > 0x00108b52 39    executing = _Per_CPU_Get_executing( cpu_self );
>> > (gdb)
>> > 0x00108b56 39    executing = _Per_CPU_Get_executing( cpu_self );
>> > (gdb)
>> > 41    if ( ticks == 0 ) {
>> > (gdb)
>> > 0x00108b5a 41    if ( ticks == 0 ) {
>> > (gdb) p ticks
>> > $1 = 0
>> > (gdb)
>> >
>> >
>> ----------------------------------------------------------------------------------------------------------
>> > _______________________________________________
>> > devel mailing list
>> > devel at rtems.org
>> > http://lists.rtems.org/mailman/listinfo/devel
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210511/b76f2d3c/attachment-0001.html>


More information about the devel mailing list