1/* 2 Title: gc_progress.cpp - Garbage collection progress data 3 4 Copyright (c) 2019 David C.J. Matthews 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License version 2.1 as published by the Free Software Foundation. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 19*/ 20#ifdef HAVE_CONFIG_H 21#include "config.h" 22#elif defined(_WIN32) 23#include "winconfig.h" 24#else 25#error "No configuration file" 26#endif 27 28#include "statistics.h" 29#include "gc_progress.h" 30 31// These values are coded in Statistics.ML 32enum { 33 GCP_ML = 0, // In ML Code 34 GCP_MINOR, // In minor GC 35 GCP_MAJOR, // In major GC 36 GCP_SHARING, // In GC Sharing pass 37 GCP_OTHER // In something else that suspends ML e.g. shareCommonData 38}; 39 40 41void gcProgressReturnToML() 42{ 43 globalStats.setCount(PSC_GC_STATE, GCP_ML); 44 globalStats.setCount(PSC_GC_PERCENT, 0); 45} 46 47void gcProgressBeginMinorGC() 48{ 49 globalStats.setCount(PSC_GC_STATE, GCP_MINOR); 50 globalStats.setCount(PSC_GC_PERCENT, 0); 51} 52 53void gcProgressBeginMajorGC() 54{ 55 globalStats.setCount(PSC_GC_STATE, GCP_MAJOR); 56 globalStats.setCount(PSC_GC_PERCENT, 0); 57} 58 59void gcProgressBeginSharingGC() 60{ 61 globalStats.setCount(PSC_GC_STATE, GCP_SHARING); 62 globalStats.setCount(PSC_GC_PERCENT, 0); 63} 64 65void gcProgressBeginOtherGC() 66{ 67 globalStats.setCount(PSC_GC_STATE, GCP_OTHER); 68 globalStats.setCount(PSC_GC_PERCENT, 0); 69} 70 71void gcProgressSetPercent(unsigned pc) 72{ 73 globalStats.setCount(PSC_GC_PERCENT, pc); 74} 75