mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-08 23:40:24 -08:00
Add a igc-describe-arena command
* src/igc.c (Figc__describe_arena): New wrapper for ArenaDescribe. (syms_of_igc): Register it. * lisp/emacs-lisp/igc.el (igc-describe-arena): New command.
This commit is contained in:
parent
d576b11eea
commit
3360c5373d
2 changed files with 34 additions and 0 deletions
|
|
@ -543,6 +543,15 @@ This function is called from a timer; see `igc-start-collecting-stats'."
|
|||
(* igc--idle-delay (ash 1 repetition)))
|
||||
nil #'igc--on-idle state (1+ repetition)))))))))
|
||||
|
||||
|
||||
(defun igc-describe-arena ()
|
||||
"Describe MPS internals in a separate window."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*Arena*"
|
||||
(with-current-buffer standard-output
|
||||
(insert (igc--describe-arena))
|
||||
(setq truncate-lines t))))
|
||||
|
||||
(provide 'igc)
|
||||
|
||||
;;; igc.el ends here.
|
||||
|
|
|
|||
25
src/igc.c
25
src/igc.c
|
|
@ -5596,6 +5596,30 @@ Return t if there was work to do, nil otherwise. */)
|
|||
return work_to_do ? Qt : Qnil;
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPEN_MEMSTREAM
|
||||
/* Only used for debugging */
|
||||
extern int ArenaDescribe(mps_arena_t, FILE *, size_t depth);
|
||||
|
||||
DEFUN ("igc--describe-arena", Figc__describe_arena, Sigc__describe_arena,
|
||||
0, 0, 0,
|
||||
doc: /* Return a string describing the MPS arena.
|
||||
|
||||
Only useful for low-level debugging. */)
|
||||
(void)
|
||||
{
|
||||
char *buffer = NULL;
|
||||
size_t size = 0;
|
||||
FILE *f = open_memstream (&buffer, &size);
|
||||
if (!f)
|
||||
report_file_error ("open_memstream failed", Qnil);
|
||||
ArenaDescribe (global_igc->arena, f, 0);
|
||||
fclose (f);
|
||||
Lisp_Object description = make_string (buffer, size);
|
||||
free (buffer);
|
||||
return description;
|
||||
}
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
Init
|
||||
***********************************************************************/
|
||||
|
|
@ -5621,6 +5645,7 @@ syms_of_igc (void)
|
|||
defsubr (&Sigc__add_extra_dependency);
|
||||
defsubr (&Sigc__remove_extra_dependency);
|
||||
defsubr (&Sigc__arena_step);
|
||||
defsubr (&Sigc__describe_arena);
|
||||
DEFSYM (Qambig, "ambig");
|
||||
DEFSYM (Qexact, "exact");
|
||||
Fprovide (intern_c_string ("mps"), Qnil);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue