diff options
author | Juanma Barranquero <lekktu@gmail.com> | 2012-09-25 23:43:26 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-09-25 23:43:26 -0400 |
commit | 611b7507a8eb63d0c3fd8b5c6182920453292688 (patch) | |
tree | 4b389019c5ed0e74ad314f5ce3a84cc3975d8230 | |
parent | 6521894d1aa5a1017dd6f3f55b5e7c11dde5d004 (diff) | |
download | emacs-611b7507a8eb63d0c3fd8b5c6182920453292688.tar.gz |
* src/makefile.w32-in (OBJ2, GLOBAL_SOURCES): Add profiler.c.
($(BLD)/profiler.$(O)): New target.
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/makefile.w32-in | 8 | ||||
-rw-r--r-- | src/profiler.c | 16 |
3 files changed, 27 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d534a3f4104..f540aef3814 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-09-26 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (OBJ2, GLOBAL_SOURCES): Add profiler.c. + ($(BLD)/profiler.$(O)): New target. + 2012-09-25 Stefan Monnier <monnier@iro.umontreal.ca> * profiler.c: Rename sample_profiler_* to profiler_cpu_* and diff --git a/src/makefile.w32-in b/src/makefile.w32-in index bdb292099bc..f89a4c83ee7 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -125,6 +125,7 @@ OBJ2 = $(BLD)/sysdep.$(O) \ $(BLD)/terminal.$(O) \ $(BLD)/menu.$(O) \ $(BLD)/xml.$(O) \ + $(BLD)/profiler.$(O) \ $(BLD)/w32term.$(O) \ $(BLD)/w32xfns.$(O) \ $(BLD)/w32fns.$(O) \ @@ -222,7 +223,7 @@ GLOBAL_SOURCES = dosfns.c msdos.c \ process.c callproc.c unexw32.c \ region-cache.c sound.c atimer.c \ doprnt.c intervals.c textprop.c composite.c \ - gnutls.c xml.c + gnutls.c xml.c profiler.c SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o obj = $(GLOBAL_SOURCES:.c=.o) @@ -966,6 +967,11 @@ $(BLD)/xml.$(O) : \ $(CONFIG_H) \ $(LISP_H) +$(BLD)/profiler.$(O) : \ + $(SRC)/profiler.c \ + $(CONFIG_H) \ + $(LISP_H) + $(BLD)/image.$(O) : \ $(SRC)/image.c \ $(SRC)/epaths.h \ diff --git a/src/profiler.c b/src/profiler.c index 1c4fa0fa218..8573d13b554 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -136,6 +136,8 @@ record_backtrace (log_t *log, size_t count) ptrdiff_t asize; if (!INTEGERP (log->next_free)) + /* FIXME: transfer the evicted counts to a special entry rather + than dropping them on the floor. */ evict_lower_half (log); index = XINT (log->next_free); @@ -145,6 +147,7 @@ record_backtrace (log_t *log, size_t count) /* Copy the backtrace contents into working memory. */ for (; i < asize && backlist; i++, backlist = backlist->next) + /* FIXME: For closures we should ignore the environment. */ ASET (backtrace, i, *backlist->function); /* Make sure that unused space of working memory is filled with nil. */ @@ -172,7 +175,18 @@ record_backtrace (log_t *log, size_t count) /* FIXME: If the hash-table is almost full, we should set some global flag so that some Elisp code can offload its - data elsewhere, so as to avoid the eviction code. */ + data elsewhere, so as to avoid the eviction code. + There are 2 ways to do that, AFAICT: + - Set a flag checked in QUIT, such that QUIT can then call + Fprofiler_cpu_log and stash the full log for later use. + - Set a flag check in post-gc-hook, so that Elisp code can call + profiler-cpu-log. That gives us more flexibility since that + Elisp code can then do all kinds of fun stuff like write + the log to disk. Or turn it right away into a call tree. + Of course, using Elisp is generally preferable, but it may + take longer until we get a chance to run the Elisp code, so + there's more risk that the table will get full before we + get there. */ } } } |