From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 1E86A3858D39 for ; Tue, 7 Mar 2023 11:11:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1E86A3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678187465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SWMl7Msmczr1XjF/w8mVwEqEZfQtL353Ui3XJ2pBPB8=; b=YJZt9kKkF2aADTOFWOilZaivRwWdbqVgeLvZUXxDJ0uW+YRTaoPr1K5trtRPSuKG8VKW3T OWZHEMhLjJUUSlDrjM/8ccY9YYkvxk4sGanytIkx6MqmsswKw4wFkocPL5EZVJCBi3XMMg 3eYii5+NgA8RQZ2s7PqClEDpj8X6zZ0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-661-8AfAcry6NlqT5k3LAxzfZQ-1; Tue, 07 Mar 2023 06:11:04 -0500 X-MC-Unique: 8AfAcry6NlqT5k3LAxzfZQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B03D31C04191; Tue, 7 Mar 2023 11:11:03 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.80]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAECE112132D; Tue, 7 Mar 2023 11:11:02 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org, Bruno Haible Subject: Re: [PATCH] time: Use CLOCK_REALTIME for time (BZ #30200) References: <20230306160321.2942372-1-adhemerval.zanella@linaro.org> Date: Tue, 07 Mar 2023 12:11:01 +0100 In-Reply-To: <20230306160321.2942372-1-adhemerval.zanella@linaro.org> (Adhemerval Zanella's message of "Mon, 6 Mar 2023 13:03:21 -0300") Message-ID: <87ttywq0je.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Adhemerval Zanella: > Different than gettimeofday and timespec_get, time uses > CLOCK_REALTIME_COARSE instead of CLOCK_REALTIME on Linux. The > coarse time is used mostly as optimization, but it may show > divergence progression due the clock resolution. > > For x86_64 and powerpc64, it should add slight more latency since > it would call now clock_gettime internally. It seems really significant on x86-64. Before: min: 14 ns 25%: 16 ns 50%: 17 ns 75%: 17 ns 95%: 18 ns 99%: 18 ns max: 18722 ns avg: 16.6606 ns After: min: 29 ns 25%: 31 ns 50%: 31 ns 75%: 32 ns 95%: 32 ns 99%: 33 ns max: 12161 ns avg: 31.2205 ns And of those original 17 ns, quite a bit is overhead from the benchmarking loop. I guess applications could work around it by having a background timer thread that increments a global variable and use that instead of the time function call, but that seems not a great approach. Based on previous feedback, I expect we'd have to carry a downstream revert of this patch indefinitely, so I'm rather strongly against applying it upstrean. Thanks, Florian