PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/java-1.7.0-openjdk/openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.hpp

#
C++ Header | 76 lines | 32 code | 12 blank | 32 comment | 2 complexity | 975883d5cc79aacaf34d648e8cb8712a MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, LGPL-3.0, LGPL-2.0
  1. /*
  2. * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  3. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4. *
  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
  7. * published by the Free Software Foundation.
  8. *
  9. * This code is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * version 2 for more details (a copy is included in the LICENSE file that
  13. * accompanied this code).
  14. *
  15. * You should have received a copy of the GNU General Public License version
  16. * 2 along with this work; if not, write to the Free Software Foundation,
  17. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20. * or visit www.oracle.com if you need additional information or have any
  21. * questions.
  22. *
  23. */
  24. #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GENERATIONSIZER_HPP
  25. #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GENERATIONSIZER_HPP
  26. #include "memory/collectorPolicy.hpp"
  27. // There is a nice batch of tested generation sizing code in
  28. // TwoGenerationCollectorPolicy. Lets reuse it!
  29. class GenerationSizer : public TwoGenerationCollectorPolicy {
  30. public:
  31. GenerationSizer() {
  32. // Partial init only!
  33. initialize_flags();
  34. initialize_size_info();
  35. }
  36. void initialize_flags() {
  37. // Do basic sizing work
  38. this->TwoGenerationCollectorPolicy::initialize_flags();
  39. // If the user hasn't explicitly set the number of worker
  40. // threads, set the count.
  41. assert(UseSerialGC ||
  42. !FLAG_IS_DEFAULT(ParallelGCThreads) ||
  43. (ParallelGCThreads > 0),
  44. "ParallelGCThreads should be set before flag initialization");
  45. // The survivor ratio's are calculated "raw", unlike the
  46. // default gc, which adds 2 to the ratio value. We need to
  47. // make sure the values are valid before using them.
  48. if (MinSurvivorRatio < 3) {
  49. MinSurvivorRatio = 3;
  50. }
  51. if (InitialSurvivorRatio < 3) {
  52. InitialSurvivorRatio = 3;
  53. }
  54. }
  55. size_t min_young_gen_size() { return _min_gen0_size; }
  56. size_t young_gen_size() { return _initial_gen0_size; }
  57. size_t max_young_gen_size() { return _max_gen0_size; }
  58. size_t min_old_gen_size() { return _min_gen1_size; }
  59. size_t old_gen_size() { return _initial_gen1_size; }
  60. size_t max_old_gen_size() { return _max_gen1_size; }
  61. size_t perm_gen_size() { return PermSize; }
  62. size_t max_perm_gen_size() { return MaxPermSize; }
  63. };
  64. #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GENERATIONSIZER_HPP