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