diff options
| author | Eli Zaretskii | 2019-01-19 20:09:38 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2019-01-19 20:09:38 +0200 |
| commit | 8bb5939efaf61eb0dc944eff5023d3f2e6ff85a7 (patch) | |
| tree | 9cba87ec6a3c85e90455b3c6d08bc12a6b0c2fce | |
| parent | 436c225f1b8ca48fa7c7e769fe6b7055f37af95d (diff) | |
| download | emacs-8bb5939efaf61eb0dc944eff5023d3f2e6ff85a7.tar.gz emacs-8bb5939efaf61eb0dc944eff5023d3f2e6ff85a7.zip | |
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'.
| -rw-r--r-- | doc/lispref/internals.texi | 12 | ||||
| -rw-r--r-- | src/pdumper.c | 39 |
2 files changed, 39 insertions, 12 deletions
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 | |||
| 225 | be available. | 225 | be available. |
| 226 | @end defun | 226 | @end defun |
| 227 | 227 | ||
| 228 | @defun pdumper-stats | ||
| 229 | If the current Emacs session restored its state from a portable dump | ||
| 230 | file, this function returns information about the dump file and the | ||
| 231 | time it took to restore the Emacs state. The value is an alist | ||
| 232 | @w{@code{((dumped-with-pdumper . t) (load-time . @var{time}) | ||
| 233 | (dump-file-name . @var{file}))}}, | ||
| 234 | where @var{file} is the name of the dump file, and @var{time} is the | ||
| 235 | time in milliseconds it took to restore the state from the dump file. | ||
| 236 | If the current session was not restored from a portable dump file, the | ||
| 237 | value is nil. | ||
| 238 | @end defun | ||
| 239 | |||
| 228 | @node Pure Storage | 240 | @node Pure Storage |
| 229 | @section Pure Storage | 241 | @section Pure Storage |
| 230 | @cindex pure storage | 242 | @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) | |||
| 5568 | return err; | 5568 | return err; |
| 5569 | } | 5569 | } |
| 5570 | 5570 | ||
| 5571 | DEFUN ("pdumper-stats", | 5571 | DEFUN ("pdumper-stats", Fpdumper_stats, Spdumper_stats, 0, 0, 0, |
| 5572 | Fpdumper_stats, Spdumper_stats, | 5572 | doc: /* Return statistics about portable dumping used by this session. |
| 5573 | 0, 0, 0, | 5573 | If this Emacs sesion was started from a portable dump file, |
| 5574 | doc: /* Return an alist of statistics about dump file that | 5574 | the return value is an alist of the form: |
| 5575 | started this Emacs, if any. Nil if this Emacs was not | 5575 | |
| 5576 | started using a portable dumper dump file.*/) | 5576 | ((dumped-with-pdumper . t) (load-time . TIME) (dump-file-name . FILE)) |
| 5577 | |||
| 5578 | where TIME is the time in milliseconds it took to restore Emacs state | ||
| 5579 | from the dump file, and FILE is the name of the dump file. | ||
| 5580 | Value is nil if this session was not started using a portable dump file.*/) | ||
| 5577 | (void) | 5581 | (void) |
| 5578 | { | 5582 | { |
| 5579 | if (!dumped_with_pdumper_p ()) | 5583 | if (!dumped_with_pdumper_p ()) |
| 5580 | return Qnil; | 5584 | return Qnil; |
| 5581 | 5585 | ||
| 5582 | return CALLN ( | 5586 | Lisp_Object dump_fn; |
| 5583 | Flist, | 5587 | #ifdef WINDOWSNT |
| 5584 | Fcons (Qdumped_with_pdumper, Qt), | 5588 | char dump_fn_utf8[MAX_UTF8_PATH]; |
| 5585 | Fcons (Qload_time, make_float (dump_private.load_time)), | 5589 | if (filename_from_ansi (dump_private.dump_filename, dump_fn_utf8) == 0) |
| 5586 | Fcons (Qdump_file_name, | 5590 | dump_fn = DECODE_FILE (build_unibyte_string (dump_fn_utf8)); |
| 5587 | build_unibyte_string (dump_private.dump_filename))); | 5591 | else |
| 5592 | dump_fn = build_unibyte_string (dump_private.dump_filename); | ||
| 5593 | #else | ||
| 5594 | dump_fn = DECODE_FILE (build_unibyte_string (dump_private.dump_filename)); | ||
| 5595 | #endif | ||
| 5596 | |||
| 5597 | dump_fn = Fexpand_file_name (dump_fn, Qnil); | ||
| 5598 | |||
| 5599 | return CALLN (Flist, | ||
| 5600 | Fcons (Qdumped_with_pdumper, Qt), | ||
| 5601 | Fcons (Qload_time, make_float (dump_private.load_time)), | ||
| 5602 | Fcons (Qdump_file_name, dump_fn)); | ||
| 5588 | } | 5603 | } |
| 5589 | 5604 | ||
| 5590 | #endif /* HAVE_PDUMPER */ | 5605 | #endif /* HAVE_PDUMPER */ |