From: Vlad Brezae Date: Mon, 11 Apr 2016 16:23:50 +0000 (+0800) Subject: Merge pull request #2819 from BrzVlad/fix-major-log X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=08a728d237965feb2bbd485f909998b17c0bbb11;hp=-c;p=mono.git Merge pull request #2819 from BrzVlad/fix-major-log [sgen] Fix major size logging --- 08a728d237965feb2bbd485f909998b17c0bbb11 diff --combined mono/metadata/sgen-mono.c index cadd83f30fd,ad3c31fdb65..0ffea956f7f --- a/mono/metadata/sgen-mono.c +++ b/mono/metadata/sgen-mono.c @@@ -3,7 -3,18 +3,7 @@@ * * Copyright (C) 2014 Xamarin Inc * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License 2.0 as published by the Free Software Foundation; - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License 2.0 along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #include "config.h" @@@ -26,7 -37,6 +26,7 @@@ #include "metadata/handle.h" #include "utils/mono-memory-model.h" #include "utils/mono-logger-internals.h" +#include "sgen/sgen-thread-pool.h" #ifdef HEAVY_STATISTICS static guint64 stat_wbarrier_set_arrayref = 0; @@@ -2298,7 -2308,6 +2298,7 @@@ voi sgen_client_thread_register_worker (void) { mono_thread_info_register_small_id (); + mono_thread_info_set_name (mono_native_thread_id_get (), "SGen worker"); } /* Variables holding start/end nursery so it won't have to be passed at every call */ @@@ -2738,13 -2747,11 +2738,11 @@@ sgen_client_log_timing (GGTimingInfo *i if (!info->is_overflow) sprintf (full_timing_buff, "total %.2fms, bridge %.2fms", info->stw_time / 10000.0f, (int)info->bridge_time / 10000.0f); if (info->generation == GENERATION_OLD) - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR%s: (%s) pause %.2fms, %s major %dK/%dK los %dK/%dK", + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR%s: (%s) pause %.2fms, %s los %dK/%dK", info->is_overflow ? "_OVERFLOW" : "", info->reason ? info->reason : "", (int)info->total_time / 10000.0f, full_timing_buff, - major_collector->section_size * num_major_sections / 1024, - major_collector->section_size * last_major_num_sections / 1024, los_memory_usage / 1024, last_los_memory_usage / 1024); else @@@ -2939,14 -2946,9 +2937,14 @@@ sgen_client_describe_invalid_pointer (G sgen_bridge_describe_pointer (ptr); } +static gboolean gc_inited; + void mono_gc_base_init (void) { + if (gc_inited) + return; + mono_counters_init (); #ifdef HEAVY_STATISTICS @@@ -2969,14 -2971,11 +2967,14 @@@ if (mono_tls_key_get_offset (TLS_KEY_SGEN_TLAB_NEXT_ADDR) == -1) sgen_set_use_managed_allocator (FALSE); #endif + + gc_inited = TRUE; } void mono_gc_base_cleanup (void) { + sgen_thread_pool_shutdown (); } gboolean diff --combined mono/sgen/sgen-marksweep.c index 9f4cbfc129d,d2ebc5d3e9c..5f4f149a3f4 --- a/mono/sgen/sgen-marksweep.c +++ b/mono/sgen/sgen-marksweep.c @@@ -7,7 -7,18 +7,7 @@@ * Copyright 2009-2010 Novell, Inc. * Copyright (C) 2012 Xamarin Inc * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License 2.0 as published by the Free Software Foundation; - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License 2.0 along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #include "config.h" @@@ -1639,6 -1650,8 +1639,8 @@@ sweep_finish (void } } + sgen_memgov_major_post_sweep (); + set_sweep_state (SWEEP_STATE_SWEPT, SWEEP_STATE_COMPACTING); } diff --combined mono/sgen/sgen-memory-governor.c index 398c36e2ab2,345ce46b868..7415ce3bff1 --- a/mono/sgen/sgen-memory-governor.c +++ b/mono/sgen/sgen-memory-governor.c @@@ -10,7 -10,18 +10,7 @@@ * Copyright 2011 Xamarin Inc (http://www.xamarin.com) * Copyright (C) 2012 Xamarin Inc * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License 2.0 as published by the Free Software Foundation; - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License 2.0 along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #include "config.h" @@@ -178,6 -189,17 +178,17 @@@ sgen_memgov_major_pre_sweep (void } } + void + sgen_memgov_major_post_sweep (void) + { + mword num_major_sections = major_collector.get_num_major_sections (); + + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR_SWEEP: major %dK/%dK", + num_major_sections * major_collector.section_size / 1024, + last_major_num_sections * major_collector.section_size / 1024); + last_major_num_sections = num_major_sections; + } + void sgen_memgov_major_collection_start (void) { @@@ -213,7 -235,7 +224,7 @@@ sgen_memgov_collection_end (int generat if (info[i].generation != -1) sgen_client_log_timing (&info [i], last_major_num_sections, last_los_memory_usage); } - last_major_num_sections = major_collector.get_num_major_sections (); + last_los_memory_usage = los_memory_usage; } /* diff --combined mono/sgen/sgen-memory-governor.h index 4ce17f5993b,71c31f56a19..9bcd55b4d80 --- a/mono/sgen/sgen-memory-governor.h +++ b/mono/sgen/sgen-memory-governor.h @@@ -2,7 -2,24 +2,7 @@@ * Copyright 2001-2003 Ximian, Inc * Copyright 2003-2010 Novell, Inc. * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #ifndef __MONO_SGEN_MEMORY_GOVERNOR_H__ #define __MONO_SGEN_MEMORY_GOVERNOR_H__ @@@ -17,6 -34,7 +17,7 @@@ void sgen_memgov_minor_collection_star void sgen_memgov_minor_collection_end (void); void sgen_memgov_major_pre_sweep (void); + void sgen_memgov_major_post_sweep (void); void sgen_memgov_major_collection_start (void); void sgen_memgov_major_collection_end (gboolean forced);