In the JX project 1 we build a complete operating system using the type-safe, object-oriented language Java. One of the major challenges is achieving a performance that is competitive to mainstream operating systems, such as Linux or Solaris. It is in the nature of our microkernel-based system, that most time is spent executing Java code. Achieving a good performance therefore requires an optimizing bytecode-to-nativecode translator and instrumentation/visualization tools to locate performance problems. In this paper we concentrate on the second requirement. We instrumented the microkernel and the bytecode-to-nativecode translator to get information about nearly every aspect of the systems behavior. The gathered data can be visualized to show CPU time consumption of methods, thread scheduling, object allocation behavior, and object ages.
Time related information.To improve the code, it is necessary for the programmer to identify the most time-consuming parts of a program. These often indicate poor code or bottlenecks and are the parts of the code that benefit most from optimizations. We have two possibilities to identify such parts: (1) method timing and (2) sampling.Method timing. For method timing we instrumented our bytecodeto-nativecode translator to insert code that measures the execution times of methods. The elapsed time during a method is recorded using the time stamp counter (TSC) of the Pentium processor family. The result is totalized for each invocation pair consisting of caller and callee method. The sum is saved together with the number of invocations and the caller and callee address in a data structure per thread. Especially in nested methods the measurement overhead falsifies the result. To get more accurate results, we accumulate the quantified drift by identifying the needed extra cycles. The results can be visualized using a call graph display, or a time diagram, where the time consumed by a method is proportional to the size of a box. Furthermore the execution of extra code during the measurement has noticeable impact on the memory access, the caches, the buffers, and the branch prediction of the processor.Sampling. Sampling is used to find hotspots in the system, but with almost no measurement overhead. While timing measures the exact execution times of methods, sampling can only produce a statistical view of the system. The timer interrupt service routine (ISR) logs the instruction pointer of the interrupted instruction. The distribution of the instruction pointers indicates where the program spends most of its time.Event tracing. JX allows Java components to log component-specific events to an kernel internal event log. The events can be specified by using a system interface. Additionally our bytecode translator may insert calls to the log system to record specific method calls. Time stamps and event numbers are continuously stored in main memory. The microkernel also uses this logging mechanism to log some internal events. For example, the scheduling behavior of the system can be logged a...
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.