aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorGerd Möllmann2024-06-29 23:28:01 +0200
committerGerd Möllmann2024-06-29 23:36:02 +0200
commitdc3e5cbe5b65278bd977c86f347df748823712a7 (patch)
tree0440242bf75cfe13441823f67bc1f3868c69d80d /src/alloc.c
parent7f993bf780e34f4b718e43f1fd1f2bd1de4db311 (diff)
downloademacs-dc3e5cbe5b65278bd977c86f347df748823712a7.tar.gz
emacs-dc3e5cbe5b65278bd977c86f347df748823712a7.zip
build_marker histogram
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 09b51ba2a08..5ee1b37e292 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4167,11 +4167,14 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
4167/* Return a newly allocated marker which points into BUF 4167/* Return a newly allocated marker which points into BUF
4168 at character position CHARPOS and byte position BYTEPOS. */ 4168 at character position CHARPOS and byte position BYTEPOS. */
4169 4169
4170static int build_marker_counts[100] = {0};
4171
4170Lisp_Object 4172Lisp_Object
4171build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos) 4173build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos, int where)
4172{ 4174{
4173 /* No dead buffers here. */ 4175 /* No dead buffers here. */
4174 eassert (BUFFER_LIVE_P (buf)); 4176 eassert (BUFFER_LIVE_P (buf));
4177 build_marker_counts[where] += 1;
4175 4178
4176 /* Every character is at least one byte. */ 4179 /* Every character is at least one byte. */
4177 eassert (charpos <= bytepos); 4180 eassert (charpos <= bytepos);
@@ -4371,6 +4374,16 @@ FUNCTION. FUNCTION will be run once per finalizer object. */)
4371 return make_lisp_ptr (finalizer, Lisp_Vectorlike); 4374 return make_lisp_ptr (finalizer, Lisp_Vectorlike);
4372} 4375}
4373 4376
4377DEFUN ("build-marker-counts", Fbuild_marker_counts, Sbuild_marker_counts, 0, 0,
4378 0, doc: /* */)
4379 (void)
4380{
4381 Lisp_Object v = Fmake_vector (make_fixnum (30), Qnil);
4382 for (int i = 0; i < 30; ++i)
4383 ASET (v, i, make_int (build_marker_counts[i]));
4384 return v;
4385}
4386
4374 4387
4375/************************************************************************ 4388/************************************************************************
4376 Mark bit access functions 4389 Mark bit access functions
@@ -8555,7 +8568,8 @@ N should be nonnegative. */);
8555 defsubr (&Sgarbage_collect_maybe); 8568 defsubr (&Sgarbage_collect_maybe);
8556 defsubr (&Smemory_info); 8569 defsubr (&Smemory_info);
8557 defsubr (&Smemory_use_counts); 8570 defsubr (&Smemory_use_counts);
8558#if defined GNU_LINUX && defined __GLIBC__ && \ 8571 defsubr (&Sbuild_marker_counts);
8572#if defined GNU_LINUX && defined __GLIBC__ && \
8559 (__GLIBC__ > 2 || __GLIBC_MINOR__ >= 10) 8573 (__GLIBC__ > 2 || __GLIBC_MINOR__ >= 10)
8560 8574
8561 defsubr (&Smalloc_info); 8575 defsubr (&Smalloc_info);