A method and system for monitoring performance of a program using global metric
variables to provide the support in an symmetric multiprocessor (SMP) system. A
Java virtual machine (Jvm) either calls the profiler whenever bytes are allocated
or provides an interface to allow the profiler to determine the value of the change
in the metric for the current thread. The profiler then applies the changes to
a metric for the current thread. Alternatively, per processor data areas are maintained
for storing per processor metric values. Whenever a thread switch occurs or there
is a request for the metric on a specified thread, an operating system kernel updates
the thread level metric values with changes in the values per processor metrics.