Larger slab allocations make profiling work.

This commit is contained in:
C. Guy Yarvin 2017-11-16 11:44:52 -08:00
parent fee009a40e
commit 8c20c3dcdf
5 changed files with 10 additions and 8 deletions

View File

@ -72,7 +72,7 @@ CLD=c++ $(CFLAGS) -L/usr/local/lib $(OPTLOCALLFLAGS) $(OPENSSLLFLAGS)
ifeq ($(OS),osx) ifeq ($(OS),osx)
CLDOSFLAGS=-bind_at_load CLDOSFLAGS=-bind_at_load
OSLIBS=-framework CoreServices -framework CoreFoundation OSLIBS=-lprofiler -framework CoreServices -framework CoreFoundation
endif endif
ifeq ($(OS),linux) ifeq ($(OS),linux)
OSLIBS=-lpthread -lrt -lcurses OSLIBS=-lpthread -lrt -lcurses

View File

@ -400,6 +400,11 @@
void void
u3a_print_memory(c3_c* cap_c, c3_w wor_w); u3a_print_memory(c3_c* cap_c, c3_w wor_w);
/* u3a_deadbeef(): write 0xdeadbeef from hat to cap.
*/
void
u3a_deadbeef(void);
/* Atoms from proto-atoms. /* Atoms from proto-atoms.
*/ */
/* u3a_slab(): create a length-bounded proto-atom. /* u3a_slab(): create a length-bounded proto-atom.

View File

@ -6,7 +6,7 @@
**/ **/
/* U3_CPU_DEBUG: activate profiling. /* U3_CPU_DEBUG: activate profiling.
*/ */
# define U3_CPU_DEBUG # undef U3_CPU_DEBUG
/** Data structures. /** Data structures.
**/ **/

View File

@ -662,7 +662,7 @@ u3a_malloc(size_t len_i)
/* u3a_cellblock(): allocate a block of cells on the hat. /* u3a_cellblock(): allocate a block of cells on the hat.
*/ */
c3_o static c3_o
u3a_cellblock(c3_w num_w) u3a_cellblock(c3_w num_w)
{ {
u3p(u3a_fbox) fre_p; u3p(u3a_fbox) fre_p;
@ -758,10 +758,7 @@ u3a_celloc(void)
return u3a_walloc(c3_wiseof(u3a_cell)); return u3a_walloc(c3_wiseof(u3a_cell));
} }
else { else {
#ifdef U3_CPU_DEBUG if ( c3n == u3a_cellblock(256 << 10) ) {
u3R->pro.cel_d++;
#endif
if ( c3n == u3a_cellblock(1024) ) {
return u3a_walloc(c3_wiseof(u3a_cell)); return u3a_walloc(c3_wiseof(u3a_cell));
} }
cel_p = u3R->all.cel_p; cel_p = u3R->all.cel_p;

View File

@ -204,7 +204,7 @@ u3i_cell(u3_noun a, u3_noun b)
#ifdef U3_CPU_DEBUG #ifdef U3_CPU_DEBUG
u3R->pro.cel_d++; u3R->pro.cel_d++;
#endif #endif
{ {
// c3_w* nov_w = u3a_walloc(c3_wiseof(u3a_cell)); // c3_w* nov_w = u3a_walloc(c3_wiseof(u3a_cell));
c3_w* nov_w = u3a_celloc(); c3_w* nov_w = u3a_celloc();