hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp
changeset 29580 a67a581cfe11
parent 25485 9c3d427eed01
equal deleted inserted replaced
29477:82f545c6572b 29580:a67a581cfe11
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   101   // Update data with a new sample.
   101   // Update data with a new sample.
   102   void sample(float new_sample);
   102   void sample(float new_sample);
   103 
   103 
   104   static inline float exp_avg(float avg, float sample,
   104   static inline float exp_avg(float avg, float sample,
   105                                unsigned int weight) {
   105                                unsigned int weight) {
   106     assert(0 <= weight && weight <= 100, "weight must be a percent");
   106     assert(weight <= 100, "weight must be a percent");
   107     return (100.0F - weight) * avg / 100.0F + weight * sample / 100.0F;
   107     return (100.0F - weight) * avg / 100.0F + weight * sample / 100.0F;
   108   }
   108   }
   109   static inline size_t exp_avg(size_t avg, size_t sample,
   109   static inline size_t exp_avg(size_t avg, size_t sample,
   110                                unsigned int weight) {
   110                                unsigned int weight) {
   111     // Convert to float and back to avoid integer overflow.
   111     // Convert to float and back to avoid integer overflow.