src/share/vm/runtime/os.cpp

Print this page




 920 void os::print_cpu_info(outputStream* st) {
 921   // cpu
 922   st->print("CPU:");
 923   st->print("total %d", os::processor_count());
 924   // It's not safe to query number of active processors after crash
 925   // st->print("(active %d)", os::active_processor_count());
 926   st->print(" %s", VM_Version::cpu_features());
 927   st->cr();
 928   pd_print_cpu_info(st);
 929 }
 930 
 931 void os::print_date_and_time(outputStream *st) {
 932   time_t tloc;
 933   (void)time(&tloc);
 934   st->print("time: %s", ctime(&tloc));  // ctime adds newline.
 935 
 936   double t = os::elapsedTime();
 937   // NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
 938   //       Linux. Must be a bug in glibc ? Workaround is to round "t" to int
 939   //       before printf. We lost some precision, but who cares?
 940   st->print_cr("elapsed time: %d seconds", (int)t);






 941 }
 942 
 943 // moved from debug.cpp (used to be find()) but still called from there
 944 // The verbose parameter is only set by the debug code in one case
 945 void os::print_location(outputStream* st, intptr_t x, bool verbose) {
 946   address addr = (address)x;
 947   CodeBlob* b = CodeCache::find_blob_unsafe(addr);
 948   if (b != NULL) {
 949     if (b->is_buffer_blob()) {
 950       // the interpreter is generated into a buffer blob
 951       InterpreterCodelet* i = Interpreter::codelet_containing(addr);
 952       if (i != NULL) {
 953         st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", addr, (int)(addr - i->code_begin()));
 954         i->print_on(st);
 955         return;
 956       }
 957       if (Interpreter::contains(addr)) {
 958         st->print_cr(INTPTR_FORMAT " is pointing into interpreter code"
 959                      " (not bytecode specific)", addr);
 960         return;




 920 void os::print_cpu_info(outputStream* st) {
 921   // cpu
 922   st->print("CPU:");
 923   st->print("total %d", os::processor_count());
 924   // It's not safe to query number of active processors after crash
 925   // st->print("(active %d)", os::active_processor_count());
 926   st->print(" %s", VM_Version::cpu_features());
 927   st->cr();
 928   pd_print_cpu_info(st);
 929 }
 930 
 931 void os::print_date_and_time(outputStream *st) {
 932   time_t tloc;
 933   (void)time(&tloc);
 934   st->print("time: %s", ctime(&tloc));  // ctime adds newline.
 935 
 936   double t = os::elapsedTime();
 937   // NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
 938   //       Linux. Must be a bug in glibc ? Workaround is to round "t" to int
 939   //       before printf. We lost some precision, but who cares?
 940   int eltime = (int)t;  // elapsed time in seconds
 941   int eldays, elhours, elminutes, elseconds;  // for printing elapsed time in a humanly readable format
 942   eldays = eltime / 86400;
 943   elhours = (eltime - eldays * 86400) / 3600;
 944   elminutes = (eltime - eldays * 86400 - elhours * 3600) / 60;
 945   elseconds = (eltime - eldays * 86400 - elhours * 3600 - elminutes * 60);
 946   st->print_cr("elapsed time: %d seconds (%dd %dh %dm %ds)", eltime, eldays, elhours, elminutes, elseconds);
 947 }
 948 
 949 // moved from debug.cpp (used to be find()) but still called from there
 950 // The verbose parameter is only set by the debug code in one case
 951 void os::print_location(outputStream* st, intptr_t x, bool verbose) {
 952   address addr = (address)x;
 953   CodeBlob* b = CodeCache::find_blob_unsafe(addr);
 954   if (b != NULL) {
 955     if (b->is_buffer_blob()) {
 956       // the interpreter is generated into a buffer blob
 957       InterpreterCodelet* i = Interpreter::codelet_containing(addr);
 958       if (i != NULL) {
 959         st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", addr, (int)(addr - i->code_begin()));
 960         i->print_on(st);
 961         return;
 962       }
 963       if (Interpreter::contains(addr)) {
 964         st->print_cr(INTPTR_FORMAT " is pointing into interpreter code"
 965                      " (not bytecode specific)", addr);
 966         return;