Fwd: Help with debugging a POSIX timing test.
chirayudesai1 at gmail.com
Mon Nov 25 16:58:32 UTC 2013
Sorry, I sent the last message to only Joel.
---------- Forwarded message ----------
From: Chirayu Desai <chirayudesai1 at gmail.com>
Date: 25 November 2013 15:30
Subject: Re: Help with debugging a POSIX timing test.
To: Joel Sherrill <joel.sherrill at oarcorp.com>
On 25 November 2013 00:35, Joel Sherrill <joel.sherrill at oarcorp.com> wrote:
> Now that I can see and run the code, a few things
> jump out.
> + POSIX priorities -- lower numerically ==> more important
> + You did &Thread_Id to calls after created. The & isn't
> supposed to be there.
+ &policy should be the second argument to
This explains the ESRCH I was getting.
> + Pay attention to compiler warnings. :)
Sorry for not doing so.
> + Benchmark time is initialized IMMEDIATELY BEFORE the
> single operation under test. We try to avoid including
> I have attached a new version of init.c with comments
> hacked in and changes.
> The big thing I tried to put in a comment block is that
> the way this test is structured, it includes the hidden
> start up time for the first time test_thread(0 runs.
> I tried to write up notes on how to modify the test
> to avoid that.
I was unable to understand all of it.
>From what I understood, POSIX_Init is called first, which
That creates a new thread, gets the priority and policy, and then
setschedparam is called
with the new (lowered) priority, which is what we want to test.
> For convenience, I would add a helper routine like
> void set_thread_priority( id, new_priority )
> and call it. It will greatly simplify the code.
Noted, I will do that after I get a better understanding of the code.
> I hope I didn't fall into the inverse
> priority range trap in those instructions....
> WARNING: POSIX priorities run INVERSE from the internal
> priorities but in gdb if you print:
> p _Per_CPU_Information.per_cpu.executing->current_priority
> You will see the internal priority (NOT POSIX priority)
> of the currently running thread. 1 is most important
> and 255 is the IDLE task.
"RTEMS Core has priorities run in the opposite sense of the POSIX API."
So, for this task, lowering the POSIX priority is what we want, it is the
output I'm getting which confuses me
Original priority: 2
Lowered priority: 4
> So the numbers you pick are important to switch back and
> forth between the tasks.
> I think the test is pretty close in spite of all that I
> wrong. I stepped through the code attached and it is
> doing the right thing EXCEPT including the thread hidden
> start time. :)
> Benchmark programs are hard to get right but fun to write.
> On 11/24/2013 11:50 AM, Joel Sherrill wrote:
> > Sorry to be lazy/stupid but how to I download just
> > the diff to see what's going on? I am not that
> > github literate.
> > --joel
> > On 11/24/2013 11:28 AM, Chirayu Desai wrote:
> >> Hello everyone.
> >> I am Chirayu Desai, a high school student, currently participating in
> >> Google Code-In 2013
> >> I have currently working on the task , but I'm having some trouble
> >> trying to get my code to work.
> >> The task is to create a POSIX timing test psxtmthread05.
> >> The test case is: pthread_setschedparam() - lower own priority.
> >> I managed to write up something , but it doesn't work.
> >> The GDB output is:
> >> (gdb) r
> >> Starting program:
> >> *** POSIX TIME TEST PSXTMTHREAD05 ***
> >> getschedparam: 3
> >> Original priority: 5
> >> Lowered priority: 4
> >> setschedparam: 3
> >> pthread_setschedparam - lower own priority 2226
> >> *** END OF POSIX TIME TEST PSXTMTHREAD05 ***
> >> [Inferior 1 (process 42000) exited normally]
> >> :
> >> : https://github.com/chirayudesai/rtems/tree/psxtmthread05
> >> :
> >> P.S. This is my first post to this list, so excuse me for any mistakes.
> >> Regards,
> >> Chirayu Desai
> Joel Sherrill, Ph.D. Director of Research & Development
> joel.sherrill at OARcorp.com On-Line Applications Research
> Ask me about RTEMS: a free RTOS Huntsville AL 35805
> Support Available (256) 722-9985
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the devel