unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Daniel Colascione <dancol@dancol.org>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 8e2b2a2: Minor cleanup in pdumper.c
Date: Sat, 19 Jan 2019 14:41:04 -0800	[thread overview]
Message-ID: <ed715b23-c332-968c-97d1-08b30a468691@cs.ucla.edu> (raw)
In-Reply-To: <65893773f79082a62d6654c818979479.squirrel@dancol.org>

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

Daniel Colascione wrote:
> No reason in particular. We can always change it.

OK, thanks, I did that by installing the attached. (One of my pet little peeves 
is avoiding rounding errors, admittedly overkill here.)

[-- Attachment #2: 0001-pdumper-stats-now-returns-s-not-ms.patch --]
[-- Type: text/x-patch, Size: 2196 bytes --]

From 7b82c1efa10b249191be51a9bc001a345b26ce2e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 19 Jan 2019 14:38:52 -0800
Subject: [PATCH] pdumper-stats now returns s, not ms

* doc/lispref/internals.texi (pdumper-stats):
* src/pdumper.c (pdumper_load): Return seconds, not milliseconds.
Minimize rounding errors in the usual case.
---
 doc/lispref/internals.texi | 2 +-
 src/pdumper.c              | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 437657f243..06ff9f70bf 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -232,7 +232,7 @@ Building Emacs
 @w{@code{((dumped-with-pdumper . t) (load-time . @var{time})
 (dump-file-name . @var{file}))}},
 where @var{file} is the name of the dump file, and @var{time} is the
-time in milliseconds it took to restore the state from the dump file.
+time in seconds it took to restore the state from the dump file.
 If the current session was not restored from a portable dump file, the
 value is nil.
 @end defun
diff --git a/src/pdumper.c b/src/pdumper.c
index 19a21329b1..4bbeabb828 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -5545,9 +5545,10 @@ pdumper_load (const char *dump_filename)
 
   struct timespec load_timespec =
     timespec_sub (current_timespec (), start_time);
-  dump_private.load_time =
-    (double) load_timespec.tv_sec * 1000.0
-    + (double) load_timespec.tv_nsec * 0.000001;
+  ALLOW_IMPLICIT_CONVERSION;
+  double s = load_timespec.tv_sec, ns = load_timespec.tv_nsec;
+  DISALLOW_IMPLICIT_CONVERSION;
+  dump_private.load_time = (s * 1e9 + ns) / 1e9;
   dump_private.dump_filename = dump_filename_copy;
   dump_filename_copy = NULL;
 
@@ -5569,7 +5570,7 @@ the return value is an alist of the form:
 
   ((dumped-with-pdumper . t) (load-time . TIME) (dump-file-name . FILE))
 
-where TIME is the time in milliseconds it took to restore Emacs state
+where TIME is the time in seconds it took to restore Emacs state
 from the dump file, and FILE is the name of the dump file.
 Value is nil if this session was not started using a portable dump file.*/)
      (void)
-- 
2.17.1


  reply	other threads:[~2019-01-19 22:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190119182259.26893.32117@vcs0.savannah.gnu.org>
     [not found] ` <20190119182301.0DE562043D@vcs0.savannah.gnu.org>
2019-01-19 21:33   ` [Emacs-diffs] master 8e2b2a2: Minor cleanup in pdumper.c Daniel Colascione
2019-01-19 21:35     ` Daniel Colascione
2019-01-19 21:53       ` Paul Eggert
2019-01-19 21:56         ` Daniel Colascione
2019-01-19 22:41           ` Paul Eggert [this message]
2019-01-20  3:44             ` Eli Zaretskii
2019-01-21 20:49               ` Paul Eggert
2019-01-21 22:46                 ` Daniel Colascione
2019-01-22  7:24                   ` Paul Eggert
2019-01-22 16:53                     ` Eli Zaretskii
2019-01-23  1:29                       ` Daniel Colascione
2019-01-23 22:07                         ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed715b23-c332-968c-97d1-08b30a468691@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=dancol@dancol.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).