257
258 void outputStream::print_julong(julong value) {
259 print(JULONG_FORMAT, value);
260 }
261
262 /**
263 * This prints out hex data in a 'windbg' or 'xxd' form, where each line is:
264 * <hex-address>: 8 * <hex-halfword> <ascii translation (optional)>
265 * example:
266 * 0000000: 7f44 4f46 0102 0102 0000 0000 0000 0000 .DOF............
267 * 0000010: 0000 0000 0000 0040 0000 0020 0000 0005 .......@... ....
268 * 0000020: 0000 0000 0000 0040 0000 0000 0000 015d .......@.......]
269 * ...
270 *
271 * indent is applied to each line. Ends with a CR.
272 */
273 void outputStream::print_data(void* data, size_t len, bool with_ascii) {
274 size_t limit = (len + 16) / 16 * 16;
275 for (size_t i = 0; i < limit; ++i) {
276 if (i % 16 == 0) {
277 indent().print(INTPTR_FORMAT_W(07)":", i);
278 }
279 if (i % 2 == 0) {
280 print(" ");
281 }
282 if (i < len) {
283 print("%02x", ((unsigned char*)data)[i]);
284 } else {
285 print(" ");
286 }
287 if ((i + 1) % 16 == 0) {
288 if (with_ascii) {
289 print(" ");
290 for (size_t j = 0; j < 16; ++j) {
291 size_t idx = i + j - 15;
292 if (idx < len) {
293 char c = ((char*)data)[idx];
294 print("%c", c >= 32 && c <= 126 ? c : '.');
295 }
296 }
297 }
929 _outer_xmlStream = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
930 start_log();
931 } else {
932 // and leave xtty as NULL
933 LogVMOutput = false;
934 DisplayVMOutput = true;
935 LogCompilation = false;
936 }
937 }
938
939 void defaultStream::start_log() {
940 xmlStream*xs = _outer_xmlStream;
941 if (this == tty) xtty = xs;
942 // Write XML header.
943 xs->print_cr("<?xml version='1.0' encoding='UTF-8'?>");
944 // (For now, don't bother to issue a DTD for this private format.)
945 jlong time_ms = os::javaTimeMillis() - tty->time_stamp().milliseconds();
946 // %%% Should be: jlong time_ms = os::start_time_milliseconds(), if
947 // we ever get round to introduce that method on the os class
948 xs->head("hotspot_log version='%d %d'"
949 " process='%d' time_ms='"INT64_FORMAT"'",
950 LOG_MAJOR_VERSION, LOG_MINOR_VERSION,
951 os::current_process_id(), (int64_t)time_ms);
952 // Write VM version header immediately.
953 xs->head("vm_version");
954 xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr();
955 xs->tail("name");
956 xs->head("release"); xs->text("%s", VM_Version::vm_release()); xs->cr();
957 xs->tail("release");
958 xs->head("info"); xs->text("%s", VM_Version::internal_vm_info_string()); xs->cr();
959 xs->tail("info");
960 xs->tail("vm_version");
961 // Record information about the command-line invocation.
962 xs->head("vm_arguments"); // Cf. Arguments::print_on()
963 if (Arguments::num_jvm_flags() > 0) {
964 xs->head("flags");
965 Arguments::print_jvm_flags_on(xs->text());
966 xs->tail("flags");
967 }
968 if (Arguments::num_jvm_args() > 0) {
969 xs->head("args");
|
257
258 void outputStream::print_julong(julong value) {
259 print(JULONG_FORMAT, value);
260 }
261
262 /**
263 * This prints out hex data in a 'windbg' or 'xxd' form, where each line is:
264 * <hex-address>: 8 * <hex-halfword> <ascii translation (optional)>
265 * example:
266 * 0000000: 7f44 4f46 0102 0102 0000 0000 0000 0000 .DOF............
267 * 0000010: 0000 0000 0000 0040 0000 0020 0000 0005 .......@... ....
268 * 0000020: 0000 0000 0000 0040 0000 0000 0000 015d .......@.......]
269 * ...
270 *
271 * indent is applied to each line. Ends with a CR.
272 */
273 void outputStream::print_data(void* data, size_t len, bool with_ascii) {
274 size_t limit = (len + 16) / 16 * 16;
275 for (size_t i = 0; i < limit; ++i) {
276 if (i % 16 == 0) {
277 indent().print(INTPTR_FORMAT_W(07) ":", i);
278 }
279 if (i % 2 == 0) {
280 print(" ");
281 }
282 if (i < len) {
283 print("%02x", ((unsigned char*)data)[i]);
284 } else {
285 print(" ");
286 }
287 if ((i + 1) % 16 == 0) {
288 if (with_ascii) {
289 print(" ");
290 for (size_t j = 0; j < 16; ++j) {
291 size_t idx = i + j - 15;
292 if (idx < len) {
293 char c = ((char*)data)[idx];
294 print("%c", c >= 32 && c <= 126 ? c : '.');
295 }
296 }
297 }
929 _outer_xmlStream = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
930 start_log();
931 } else {
932 // and leave xtty as NULL
933 LogVMOutput = false;
934 DisplayVMOutput = true;
935 LogCompilation = false;
936 }
937 }
938
939 void defaultStream::start_log() {
940 xmlStream*xs = _outer_xmlStream;
941 if (this == tty) xtty = xs;
942 // Write XML header.
943 xs->print_cr("<?xml version='1.0' encoding='UTF-8'?>");
944 // (For now, don't bother to issue a DTD for this private format.)
945 jlong time_ms = os::javaTimeMillis() - tty->time_stamp().milliseconds();
946 // %%% Should be: jlong time_ms = os::start_time_milliseconds(), if
947 // we ever get round to introduce that method on the os class
948 xs->head("hotspot_log version='%d %d'"
949 " process='%d' time_ms='" INT64_FORMAT "'",
950 LOG_MAJOR_VERSION, LOG_MINOR_VERSION,
951 os::current_process_id(), (int64_t)time_ms);
952 // Write VM version header immediately.
953 xs->head("vm_version");
954 xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr();
955 xs->tail("name");
956 xs->head("release"); xs->text("%s", VM_Version::vm_release()); xs->cr();
957 xs->tail("release");
958 xs->head("info"); xs->text("%s", VM_Version::internal_vm_info_string()); xs->cr();
959 xs->tail("info");
960 xs->tail("vm_version");
961 // Record information about the command-line invocation.
962 xs->head("vm_arguments"); // Cf. Arguments::print_on()
963 if (Arguments::num_jvm_flags() > 0) {
964 xs->head("flags");
965 Arguments::print_jvm_flags_on(xs->text());
966 xs->tail("flags");
967 }
968 if (Arguments::num_jvm_args() > 0) {
969 xs->head("args");
|