emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8bb5939: Improve 'pdumper-stats' and its documentat


From: Eli Zaretskii
Subject: [Emacs-diffs] master 8bb5939: Improve 'pdumper-stats' and its documentation
Date: Sat, 19 Jan 2019 13:12:02 -0500 (EST)

branch: master
commit 8bb5939efaf61eb0dc944eff5023d3f2e6ff85a7
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Improve 'pdumper-stats' and its documentation
    
    * src/pdumper.c (Fpdumper_stats): Improve formatting and
    wording of the doc string.  Decode the pdump file name and
    expand-file-name it.
    
    * doc/lispref/internals.texi (Building Emacs): Document
    'pdumper-stats'.
---
 doc/lispref/internals.texi | 12 ++++++++++++
 src/pdumper.c              | 39 +++++++++++++++++++++++++++------------
 2 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 66606da..437657f 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -225,6 +225,18 @@ Emacs was built without @code{unexec} support, this 
function will not
 be available.
 @end defun
 
address@hidden pdumper-stats
+If the current Emacs session restored its state from a portable dump
+file, this function returns information about the dump file and the
+time it took to restore the Emacs state.  The value is an alist
address@hidden@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.
+If the current session was not restored from a portable dump file, the
+value is nil.
address@hidden defun
+
 @node Pure Storage
 @section Pure Storage
 @cindex pure storage
diff --git a/src/pdumper.c b/src/pdumper.c
index cd242f7..b51a379 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -5568,23 +5568,38 @@ pdumper_load (const char *dump_filename)
   return err;
 }
 
-DEFUN ("pdumper-stats",
-       Fpdumper_stats, Spdumper_stats,
-       0, 0, 0,
-       doc: /* Return an alist of statistics about dump file that
-               started this Emacs, if any.  Nil if this Emacs was not
-               started using a portable dumper dump file.*/)
+DEFUN ("pdumper-stats", Fpdumper_stats, Spdumper_stats, 0, 0, 0,
+       doc: /* Return statistics about portable dumping used by this session.
+If this Emacs sesion was started from a portable dump file,
+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
+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)
 {
   if (!dumped_with_pdumper_p ())
     return Qnil;
 
-  return CALLN (
-    Flist,
-    Fcons (Qdumped_with_pdumper, Qt),
-    Fcons (Qload_time, make_float (dump_private.load_time)),
-    Fcons (Qdump_file_name,
-           build_unibyte_string (dump_private.dump_filename)));
+  Lisp_Object dump_fn;
+#ifdef WINDOWSNT
+  char dump_fn_utf8[MAX_UTF8_PATH];
+  if (filename_from_ansi (dump_private.dump_filename, dump_fn_utf8) == 0)
+    dump_fn = DECODE_FILE (build_unibyte_string (dump_fn_utf8));
+  else
+    dump_fn = build_unibyte_string (dump_private.dump_filename);
+#else
+  dump_fn = DECODE_FILE (build_unibyte_string (dump_private.dump_filename));
+#endif
+
+  dump_fn = Fexpand_file_name (dump_fn, Qnil);
+
+  return CALLN (Flist,
+               Fcons (Qdumped_with_pdumper, Qt),
+               Fcons (Qload_time, make_float (dump_private.load_time)),
+               Fcons (Qdump_file_name, dump_fn));
 }
 
 #endif /* HAVE_PDUMPER */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]