Re: What is a typical precision of gettimeofday()?

From: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>, Hannu Krosing <hannuk(at)google(dot)com>, Ants Aasma <ants(at)cybertec(dot)at>, gregsmithpgsql(at)gmail(dot)com
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: What is a typical precision of gettimeofday()?
Date: 2024-06-18 05:47:52
Message-ID: 47AEACEE-E5CC-40E4-8611-01F3A465AF16@yandex-team.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 19 Mar 2024, at 13:28, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> I feel that we don't actually have any information about this portability concern. Does anyone know what precision we can expect from gettimeofday()? Can we expect the full microsecond precision usually?

At PGConf.dev Hannu Krossing draw attention to pg_test_timing module. I’ve tried this module(slightly modified to measure nanoseconds) on some systems, and everywhere I found ~100ns resolution (95% of ticks fall into 64ns and 128ns buckets).

I’ll add cc Hannu, and also pg_test_timing module authors Ants ang Greg. Maybe they can add some context.

Best regards, Andrey Borodin.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-06-18 06:01:12 Flush pgstats file during checkpoints
Previous Message David Rowley 2024-06-18 05:30:21 Re: Xact end leaves CurrentMemoryContext = TopMemoryContext