Re: 100% CPU utilization during (run)

Alan Bram <[email protected]> Thu, 04 Jun 2009 14:38:26 -0700 (PDT)
Newsgroups gmane.lisp.scheme.scsh
Message-ID <[email protected]>
>> I would use oprofile to see where the scshvm is spending all its time.
> 
> The output of strace would probably be sufficient, 

Thank you, Martin and Brian.  Those were good suggestions.

Using strace I found out that we were calling setitimer alternately
with a kind of off/on pattern.  Looking at the source code, it seems
we must be calling s48_wait_for_event repeatedly.

#3  0x080700d1 in s48_wait_for_event (max_wait=-1, is_minutes=0 '\0')
    at c/unix/event.c:570
#4  0x0805a26b in s48_restart (proc_361X=-1231036397, nargs_362X=5)
    at c/scheme48vm.c:9072
#5  0x0805c262 in s48_call_startup_procedure (startup_vector_1335X=0xbff102e4, 
    startup_vector_length_1336X=1) at c/scheme48vm.c:10898
#6  0x0804fc11 in internal_s48_main (heap_size=5000000, stack_size=2500, 
    object_file=0xbff10cfc "/usr/lib/scsh-0.6/scshvm", 
    image_name=0xbff10d18 "/usr/lib/scsh-0.6/scsh.image", argc=1, argv=0xbff102e4)
    at ./c/init.c:106
#7  0x0804f87b in main (argc=6, argv=0x216c) at ./c/main.c:73

However, from there it becomes daunting pretty quickly.  I guess the
scheme48vm.c must obviously be some sort of generated code.

This has the feel of the beginning of an adventure of learning quite a
lot about Scheme internals.


Cheers,
 - arb