hotspot/src/share/vm/runtime/timer.cpp
changeset 33160 c59f1676d27e
parent 31334 d55c96b36b5f
child 35061 be6025ebffea
equal deleted inserted replaced
33159:89b942323bd1 33160:c59f1676d27e
    32   return counter / freq;
    32   return counter / freq;
    33 }
    33 }
    34 
    34 
    35 double TimeHelper::counter_to_millis(jlong counter) {
    35 double TimeHelper::counter_to_millis(jlong counter) {
    36   return counter_to_seconds(counter) * 1000.0;
    36   return counter_to_seconds(counter) * 1000.0;
       
    37 }
       
    38 
       
    39 elapsedTimer::elapsedTimer(jlong time, jlong timeUnitsPerSecond) {
       
    40   _active = false;
       
    41   jlong osTimeUnitsPerSecond = os::elapsed_frequency();
       
    42   assert(osTimeUnitsPerSecond % 1000 == 0, "must be");
       
    43   assert(timeUnitsPerSecond % 1000 == 0, "must be");
       
    44   while (osTimeUnitsPerSecond < timeUnitsPerSecond) {
       
    45     timeUnitsPerSecond /= 1000;
       
    46     time *= 1000;
       
    47   }
       
    48   while (osTimeUnitsPerSecond > timeUnitsPerSecond) {
       
    49     timeUnitsPerSecond *= 1000;
       
    50     time /= 1000;
       
    51   }
       
    52   _counter = time;
    37 }
    53 }
    38 
    54 
    39 void elapsedTimer::add(elapsedTimer t) {
    55 void elapsedTimer::add(elapsedTimer t) {
    40   _counter += t._counter;
    56   _counter += t._counter;
    41 }
    57 }