Re: Patch: add timing of buffer I/O requests

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: add timing of buffer I/O requests
Date: 2011-11-29 01:17:48
Message-ID: 4ED432BC.5050409@fuzzy.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28.11.2011 22:32, Dimitri Fontaine wrote:
> "Tomas Vondra" <tv(at)fuzzy(dot)cz> writes:
>> Another option would be to reimplement the vsyscall, even on platforms
>> that don't provide it. The principle is actually quite simple - allocate a
>> shared memory, store there a current time and update it whenever a clock
>> interrupt happens. This is basically what Greg suggested in one of the
>> previous posts, where "regularly" means "on every interrupt". Greg was
>> worried about the precision, but this should be just fine I guess. It's
>> the precision you get on Linux, anyway ...
>
> That sounds good for other interesting things, which entails being able
> to have timing information attached to the XID sequence. If we go this
> way, how far are we from having a ticker in PostgreSQL?

I'm not sure. On Linux/x86 this is already done, but my knowledge of
kernel development is rather limited, especially when it comes to other
OSes and platforms. E.g. I'm not sure why it's not available in FreeBSD
on x86, I guess it's rather "we don't want it" than "it's not possible."

In Linux sources, the most interesting pieces are probably these:

1) arch/x86/include/asm/vgtod.h - that's the shared memory structure

2) arch/x86/kernel/vsyscall_64.c - this is how the memory is read
(do_vgettimeofday)

3) arch/x86/kernel/vsyscall_64.c - this is how the memory is updated
(update_vsyscall)

4) kernel/time/timekeeping.c - do_settimeofday (calls update_vsyscall)

5) drivers/rtc/class.c (and other) RTC drivers call do_settimeofday

Tomas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2011-11-29 01:21:26 Re: Patch: add timing of buffer I/O requests
Previous Message Jim Nasby 2011-11-29 01:14:34 Re: Patch: add timing of buffer I/O requests