From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#44674: 28.0.50; Adding current-cpu-time for performance tests Date: Mon, 16 Nov 2020 12:46:07 +0100 Message-ID: References: <1BDDC2C4-2831-460F-AC48-C353664D28D2@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21143"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44674@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 16 12:47:18 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kecyc-0005O2-9m for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Nov 2020 12:47:18 +0100 Original-Received: from localhost ([::1]:53462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kecyb-00022e-CJ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Nov 2020 06:47:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kecyM-000214-P9 for bug-gnu-emacs@gnu.org; Mon, 16 Nov 2020 06:47:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kecyM-0006g0-ES for bug-gnu-emacs@gnu.org; Mon, 16 Nov 2020 06:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kecyM-00070O-BC for bug-gnu-emacs@gnu.org; Mon, 16 Nov 2020 06:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Nov 2020 11:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44674 X-GNU-PR-Package: emacs Original-Received: via spool by 44674-submit@debbugs.gnu.org id=B44674.160552718625197 (code B ref 44674); Mon, 16 Nov 2020 11:47:02 +0000 Original-Received: (at 44674) by debbugs.gnu.org; 16 Nov 2020 11:46:26 +0000 Original-Received: from localhost ([127.0.0.1]:55287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kecxl-0006Y4-Sw for submit@debbugs.gnu.org; Mon, 16 Nov 2020 06:46:26 -0500 Original-Received: from mail-ot1-f52.google.com ([209.85.210.52]:41319) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kecxj-0006Ro-Me for 44674@debbugs.gnu.org; Mon, 16 Nov 2020 06:46:25 -0500 Original-Received: by mail-ot1-f52.google.com with SMTP id o3so5150917ota.8 for <44674@debbugs.gnu.org>; Mon, 16 Nov 2020 03:46:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XZoerTt4razplaZf5weHaZaBWcOqD5csX1nE7PKjrls=; b=JVA0DbPnStz6gGt1yoB9BjJuXMKxbIh8RP7YOqmh/4bGu8T3T9xLWC8wtMmgarc6RG HJVwErn28yYo9oeRp3L2N+TeEyecGadvy+5jLNQfrzTts2OYLKBE7zv5UpkgOIAmStUt 6vMeQ5HJJnkodYPEosTlirByHSa4pJfq5xmrHmq3wP66+VmIDJBZY6ycTg0F93KpCZ2E j3ohV5iMCoLuLjaTV0+uuwqYvnLxkWW0UxvdrH36HEOW9zMFrO6vNLL6PnE8uvqvpcaC l/7Q1H8ENV/PD62IYQ5MkUxdOXp06CIxktDQQiHnwN1jveeyXCjPBX9xB5q9M9em4Mkv cXdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XZoerTt4razplaZf5weHaZaBWcOqD5csX1nE7PKjrls=; b=EszhQh5doznL7X6ClzyeZThfUhqk56snXnT/1iRDgtSek4xbGl3ffThq06hTfJJPpJ t0J9Jf+qnVTmhagedm25rfmR3hLaTc/wEFFbIBDjDDaL6NqdQWMhUh9qEqOt+WBrOUtL g0WkUiWuOLa5ZN1hjidzDxNhPjRyn2LsdQpWMBn0nFh+6hgVRn7X5f5NDK3QqJGshcvx PDqMmoJSm4aE+2azWzU8jAFEZEqcFQBkfU0pfi4FV9P+OXlx+hyCzd+kPtOaIdhMz7+a JYHLfGwuB1Fz2AB5N8QoxOCRIuRfGVOJZoLxAa80IMtkgXr9j5RjzAnCf5lNFxnKot9u C2tQ== X-Gm-Message-State: AOAM530knrWt6v7s+8rWHQf5qVqW5Rikfi8HPEci8in+uDYvQAUDf8io uk1i0xZ/r9LsfH0mHGu8Jzj/Xo0ETunJ/PQFlpA= X-Google-Smtp-Source: ABdhPJwBGJNRiB3e2TFVBAueZ3gAQZnxesgeO9X22X8m84N0TqWHhdijhvykAPSwGNewf7XfZbBn9LzynBWeMCsmsAs= X-Received: by 2002:a9d:d73:: with SMTP id 106mr10072430oti.36.1605527178007; Mon, 16 Nov 2020 03:46:18 -0800 (PST) In-Reply-To: <1BDDC2C4-2831-460F-AC48-C353664D28D2@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:193421 Archived-At: Am Mo., 16. Nov. 2020 um 09:19 Uhr schrieb Eli Zaretskii : > > On November 16, 2020 9:58:40 AM GMT+02:00, Eli Zaretskii wrote: > > On November 16, 2020 3:07:35 AM GMT+02:00, Stefan Monnier > > wrote: > > > Package: Emacs > > > Version: 28.0.50 > > > > > > > > > I tried to write a test for the performance problem seen in > > bug#41029, > > > but found it very difficult to make it work half-reliably because we > > > only have access to wall-clock time from Elisp. > > > > > > So I suggest we add a new primitive `current-cpu-time` with which > > > those > > > tests seem to be at least somewhat doable. > > > > > > See my current patch below which includes a test for that > > > performance bug. It clearly requires adding w32 support (or > > > fetching more clock functionality from gnulib) but I don't know how > > to > > > do that. > > > > AFAIU, using 'clock' here is not the best idea, as there are caveats > > wrt to calling 'system', and the origin of the returned value is not > > well defined to be portable. > > > > I suggest to use 'times' instead. For w32, we could easily implement > > it, as we already have that functionality for 'getloadavg'. > > Btw, once this goes in, how about making benchmark-run use it? > benchmark-run measures walltime, not CPU time, it should use CLOCK_MONOTONIC. We might consider adding another macro that returns the CPU time (or both).