Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8240295

hs_err elapsed time in seconds is not accurate enough

    XMLWordPrintable

Details

    • b14
    • generic
    • generic

    Backports

      Description

        hs_err reports elapsed time in seconds.
        Events are reported in 1/1000th of a second detail.

        As second can be a long time, and we might want to know if the last Event logged happened a second ago, or 1/1000th of a second a go, i.e. "right now"?

        hotspot/share/runtime/os.cpp

        void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
        ...
          double t = os::elapsedTime();
          // NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
          // Linux. Must be a bug in glibc ? Workaround is to round "t" to int
          // before printf. We lost some precision, but who cares?
          int eltime = (int)t; // elapsed time in seconds


        The comment came from before JDK 5 repo creation.
        It's time to remove the slight on glibc here.



        Attachments

          Issue Links

            Activity

              People

                kevinw Kevin Walls
                kevinw Kevin Walls
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: