* src/makefile.w32-in (OBJ2, GLOBAL_SOURCES): Add profiler.c.

($(BLD)/profiler.$(O)): New target.
This commit is contained in:
Juanma Barranquero 2012-09-25 23:43:26 -04:00 committed by Stefan Monnier
parent 6521894d1a
commit 611b7507a8
3 changed files with 27 additions and 2 deletions

View file

@ -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

View file

@ -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 \

View file

@ -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. */
}
}
}