Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Jamaica.doc
Скачиваний:
9
Добавлен:
01.03.2025
Размер:
1.89 Mб
Скачать

2.1.1. Creating a profiling application

The compilation technology of Jamaica’s builder is able to use the data generated during profile runs using the -profile option to guide the compilation process, producing optimal performance with a minimum increase in code size.

Here is a demonstration of the profiler using the HelloWorld example:

> jamaicabuilder -cp classes -setGraphics=none -profile -interpret HelloWorld

The generated executable HelloWorld now prints the profiling information after execution. The output may look like this:

> ./HelloWorld 10000

2.2. Using a profile with the Builder

Having collected the profiling data, the Jamaica Compiler can create a compiled version of the application using the profile information. This compiled version benefits from profiling information in several ways:

  • Compilation is limited to the most time critical methods, keeping noncritical methods in smaller interpreted byte-code format.

  • Method inlining prefers inlining of calls that have shown to be executed most frequently during the profiling run.

  • Profiling information also collects information on the use of reflection, so an application that cannot use smart linking due to reflection can profit from smart linking even without manually listing all classes referenced via reflection.

2.2.1. Building with a profile

The builder option -useProfile is used to select the generated profiling data:

> jamaicabuilder -cp classes -setGraphics=none -useProfile HelloWorld.prof HelloWorld

Due to the profile-guided optimizations performed by the compiler, the runtime performance of the application built using a profile as shown usually exceeds the performance of a fully compiled application. Furthermore, the memory footprint is significantly smaller and the modify-compile-run cycle time is usually significantly shorter as well since only a small fraction of the application needs to be compiled. It is not necessary to re-generate profile data after every modification.

2.3. Interpreting the profiling output

When running in profiling mode, the VM collects data to create an optimized application but can also be interpreted manually to find find memory leaks or time consuming methods. You can make Jamaica collect information about performance, memory requirements etc.

To collect additional information, you have to set the property jamaica. profile_groups to select one or more profiling groups. The default value is builder to collect data used by the builder. You can set the property to the values builder, memory, speed, all or a comma separated combination of those. Example:

> jamaicavmp -cp classes \

> -Djamaica.profile_groups=builder,speed \

> HelloWorld

2.3.1. Format of the profile file

Every line in the profiling output starts with a keyword followed by space separated values. The meaning of these values depends on the keyword.

For a better overview, the corresponding values in different lines are aligned as far as possible and words and signs that improve human reading are added. Here for every keyword the additional words and signs are omitted and the values are listed in the same order as they appear in the text file.

Keyword: BEGIN_PROFILE_DUMP Groups: all

Values

  1. unique dump ID

Keyword: END_PROFILE_DUMP Groups: all

Values

  1. unique dump ID

Keyword: HEAP_REFS Groups: memory

Values

  1. total number of references in object attributes

  1. total number of words in object attributes

  1. relative number of references in object attributes

Keyword: HEAP_USE Groups: memory

Values

  1. total number of currently allocated objects of this class

  1. number of blocks needed for one object of this class

  1. block size in bytes

  2. number of bytes needed for all objects of this class

  1. relative heap usage of objects of this class

  2. total number of objects of this class organized in a tree structure

  3. relative number of objects of this class organized in a tree structure

  4. name of the class

Keyword: INSTANTIATION_COUNT Groups: memory

Values

  1. total number of instantiated objects of this class

  2. number of blocks needed for one object of this class

  3. number of blocks needed for all objects of this class

  4. number of bytes needed for all objects of this class

  5. total number of objects of this class organized in a tree structure

  6. relative number of objects of this class organized in a tree structure

  7. class loader that loaded the class

  8. name of the class

Keyword: PROFILE Groups: builder

Values

  1. total number of bytecodes spent in this method

  2. relative number of bytecodes spent in this method

  3. signature of the method

  4. class loader that loaded the class of the method

Keyword: PROFILE_CLASS_USED_VIA_REFLECTION Groups: builder

Values

  1. name of the class used via reflection

Keyword: PROFILE_CYCLES Groups: speed

Values

  1. total number of processor cycles spent in this method (if available on the target)

  2. signature of the method

Keyword: PROFILE_INVOKE Groups: builder

Values

  1. number of calls from caller method to called method

  2. bytecode position of the call within the method

  3. signature of the caller method

  4. signature of the called method

Keyword: PROFILE_INVOKE_CYCLES Groups: speed

Values

  1. number of processor cycles spent in the called method

  2. bytecode position of the call within the method

  3. signature of the caller method

  4. signature of the called method

Keyword: PROFILE_NATIVE Groups: all

Values

  1. total number of calls to the native method

  2. relative number of calls to the native method

  1. signature of the called native method

Keyword: PROFILE_NEWARRAY Groups: memory

Values

  1. number of calls to array creation within a method

  1. bytecode position of the call within the method

  2. signature of the method

Keyword: PROFILE_THREAD Groups: memory, speed

Values

  1. current Java priority of the thread

  2. total amount of CPU cycles in this thread

  1. relative time in interpreted code

  2. relative time in compiled code

  1. relative time in JNI code

  2. relative time in garbage collector code

  1. required C stack size

  2. required Java stack size

Keyword: PROFILE_THREADS Groups: builder

Values

  1. maximum number of concurrently used threads

Keyword: PROFILE_THREADS_JNI Groups: builder

Values

  1. maximum number of threads attached via JNI

Keyword: PROFILE_VERSION Groups: all

Values

  1. version of Jamaica the profile was created with

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]