From: Eli Zaretskii Date: Sat, 19 Jan 2019 18:09:38 +0000 (+0200) Subject: Improve 'pdumper-stats' and its documentation X-Git-Tag: emacs-27.0.90~3781 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8bb5939efaf61eb0dc944eff5023d3f2e6ff85a7;p=emacs.git 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'. --- diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 66606da6ecf..437657f2438 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 +@defun 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 +@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. +If the current session was not restored from a portable dump file, the +value is nil. +@end defun + @node Pure Storage @section Pure Storage @cindex pure storage diff --git a/src/pdumper.c b/src/pdumper.c index cd242f7dc9f..b51a3797dd4 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 */