826 if (envvar != NULL) {
827 st->print("%s", env_list[i]);
828 st->print("=");
829 st->print_cr("%s", envvar);
830 }
831 }
832 }
833 }
834
835 void os::print_cpu_info(outputStream* st) {
836 // cpu
837 st->print("CPU:");
838 st->print("total %d", os::processor_count());
839 // It's not safe to query number of active processors after crash
840 // st->print("(active %d)", os::active_processor_count());
841 st->print(" %s", VM_Version::cpu_features());
842 st->cr();
843 pd_print_cpu_info(st);
844 }
845
846 void os::print_date_and_time(outputStream *st) {
847 const int secs_per_day = 86400;
848 const int secs_per_hour = 3600;
849 const int secs_per_min = 60;
850
851 time_t tloc;
852 (void)time(&tloc);
853 st->print("time: %s", ctime(&tloc)); // ctime adds newline.
854
855 double t = os::elapsedTime();
856 // NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
857 // Linux. Must be a bug in glibc ? Workaround is to round "t" to int
858 // before printf. We lost some precision, but who cares?
859 int eltime = (int)t; // elapsed time in seconds
860
861 // print elapsed time in a human-readable format:
862 int eldays = eltime / secs_per_day;
863 int day_secs = eldays * secs_per_day;
864 int elhours = (eltime - day_secs) / secs_per_hour;
865 int hour_secs = elhours * secs_per_hour;
866 int elmins = (eltime - day_secs - hour_secs) / secs_per_min;
867 int minute_secs = elmins * secs_per_min;
868 int elsecs = (eltime - day_secs - hour_secs - minute_secs);
869 st->print_cr("elapsed time: %d seconds (%dd %dh %dm %ds)", eltime, eldays, elhours, elmins, elsecs);
870 }
871
872 // moved from debug.cpp (used to be find()) but still called from there
873 // The verbose parameter is only set by the debug code in one case
|
826 if (envvar != NULL) {
827 st->print("%s", env_list[i]);
828 st->print("=");
829 st->print_cr("%s", envvar);
830 }
831 }
832 }
833 }
834
835 void os::print_cpu_info(outputStream* st) {
836 // cpu
837 st->print("CPU:");
838 st->print("total %d", os::processor_count());
839 // It's not safe to query number of active processors after crash
840 // st->print("(active %d)", os::active_processor_count());
841 st->print(" %s", VM_Version::cpu_features());
842 st->cr();
843 pd_print_cpu_info(st);
844 }
845
846 void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
847 const int secs_per_day = 86400;
848 const int secs_per_hour = 3600;
849 const int secs_per_min = 60;
850
851 time_t tloc;
852 (void)time(&tloc);
853 st->print("time: %s", ctime(&tloc)); // ctime adds newline.
854
855 struct tm* tz = localtime(&tloc);
856 ::strftime(buf, buflen, "%Z", tz);
857 st->print_cr("timezone: %s", buf);
858
859 double t = os::elapsedTime();
860 // NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
861 // Linux. Must be a bug in glibc ? Workaround is to round "t" to int
862 // before printf. We lost some precision, but who cares?
863 int eltime = (int)t; // elapsed time in seconds
864
865 // print elapsed time in a human-readable format:
866 int eldays = eltime / secs_per_day;
867 int day_secs = eldays * secs_per_day;
868 int elhours = (eltime - day_secs) / secs_per_hour;
869 int hour_secs = elhours * secs_per_hour;
870 int elmins = (eltime - day_secs - hour_secs) / secs_per_min;
871 int minute_secs = elmins * secs_per_min;
872 int elsecs = (eltime - day_secs - hour_secs - minute_secs);
873 st->print_cr("elapsed time: %d seconds (%dd %dh %dm %ds)", eltime, eldays, elhours, elmins, elsecs);
874 }
875
876 // moved from debug.cpp (used to be find()) but still called from there
877 // The verbose parameter is only set by the debug code in one case
|