PrintNMethodHistogram (was: NIC info)

Jecel Assumpcao Jr jecel at
Mon Jan 27 05:58:23 UTC 1997

> The scales in the spy are the same for old space as for the code
> cache, debug and other areas (all are proportional to area).  Each
> tick mark under the old space bar represents 1Mb.

This really helps a lot. I was demonstrating the system after
I read this and one student asked if it was possible create
huge objects in Self (I mentioned that Mushroom had a limit),
so I did "vector copySize: 8000000 FillingWith: 3" to show off.
The result seemed puzzling, and it was only after I got home
that I realized the vector was 32MB long, not 8MB as I claimed :-)

BTW, I also said that "clean up memory - throughly" from the
yellow menu would free up the vector's memory after I dismissed
it. We tried it and it didn't. I poked around for a while
trying to find a hidden reference somewhere, but didn't have
any luck. I guess I need to rehearse before giving demos...

> I think you'll find _PrintNMethodHistogram: useful.  Unfortunately the
> documentation string says nothing useful.  But try it with arguments
> or say 20, 10, and 5, and read the source to see what it does...I'm
> sure it's fairly obvious.

That's perfect - exactly what I needed! I only had time to try
_PrintNMethodHistogram: 20 and wasn't able to study the results,
but what I did see was encouraging.

There are also _FindNmethodsRcvr:Selector: and _PrintNMethodCode
look very interesting as well, though the latter seems a little
hard to use.

>    All of these calculations suppose that a large part of the 300KB of
>    bytecodes are represented in the cache at any one time. How close
>    is this to the truth?
> A good point, and one I had missed.  I'd guess only half the bytecodes
> are represented.  Not sure how you can determine this without doing
> some VM hacking, though.

I think it is possible with the _PrintNMethodHistogram: primitive
you mentioned. In the first table that is output, the middle
column is the number of methods that have a certain number of
corresponding native methods, so adding up this column would
give us the number of Self methods represented in the cache. On
the other hand, the code expansion figure I am interested in
can be easily obtained for a single method from the second
table that the primitive prints. 

-- Jecel

More information about the Self-interest mailing list