[PATCH wayland] debug: add timestamps when logging

Corentin Chary corentin.chary at gmail.com
Mon Jul 18 05:25:37 PDT 2011


On Mon, Jul 18, 2011 at 1:27 PM, Marty Jack <martyj19 at comcast.net> wrote:
>
>
> On 07/18/2011 07:17 AM, Corentin Chary wrote:
>> On Mon, Jul 18, 2011 at 10:22 AM, Tiago Vignatti
>> <tiago.vignatti at linux.intel.com> wrote:
>>> On 07/18/2011 11:01 AM, laszlo.p.agocs at nokia.com wrote:
>>>>
>>>> Doesn't clock_gettime need -lrt? Otherwise (on Ubuntu at least) the linker
>>>> will complain about an undefined reference in libwayland-client.so when
>>>> building wayland apps.
>>>>
>>>
>>> some other dependency in the demo clients and compositor is already linking
>>> this library. But indeed the link has to come in the Wayland library side,
>>> so you are right.
>>>
>>>    Tiago
>>
>> And maybe CLOCK_REALTIME_COARSE would be better ?
>> (https://lwn.net/Articles/347811/)
>
> Unfortunately my experiments show that timerfd does not support CLOCK_*_COARSE , which would be a good addition if someone can get the kernel's attention.

Yeah, do you know if there is a reason why it's not implemented ?

> I also find that you cannot mix CLOCK_* timerfds and CLOCK_*_COARSE clock_gettime and get a working timer system.

I tried on my system (Linux 3.0), with the example code available in
`man timerfd_create`, and it seems to work well:

With CLOCK_*_COARSE clock_gettime
$ ./a.out 1 1 5
0.000: timer started
0.999: read: 1; total=1
1.999: read: 1; total=2
2.999: read: 1; total=3
3.999: read: 1; total=4
4.999: read: 1; total=5

Without:
$ ./a.out 1 1 5
0.000: timer started
1.000: read: 1; total=1
2.000: read: 1; total=2
3.000: read: 1; total=3
4.000: read: 1; total=4
5.000: read: 1; total=5

> Also, you probably would use CLOCK_MONOTONIC so that when the wall clock time changes, your expirations don't.

Hum, the current patch don't use timer, but maybe
CLOCK_MONOTONIC[_COARSE] is a good idea for traces too, that way if
you change the time in the midle of your debug session, it won't mess
your timestamps.

-- 
Corentin Chary
http://xf.iksaif.net


More information about the wayland-devel mailing list