From 401c34edcbe6c5d8f8a08bf47a4f3cbd1f75682a Mon Sep 17 00:00:00 2001 From: Paolo Molaro Date: Mon, 8 Oct 2007 09:24:11 +0000 Subject: [PATCH] Mon Oct 8 11:38:04 CEST 2007 Paolo Molaro * domain.c: track statistics about the actual amount of native code allocated. svn path=/trunk/mono/; revision=87081 --- mono/metadata/ChangeLog | 5 +++++ mono/metadata/domain.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index 656a0811d19..f2f1ce6c973 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,4 +1,9 @@ +Mon Oct 8 11:38:04 CEST 2007 Paolo Molaro + + * domain.c: track statistics about the actual amount of native code + allocated. + Sat Oct 6 10:01:42 CEST 2007 Paolo Molaro * class.c: the valuetype enumerators don't have the additional diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c index 94dffe642ae..4a715837fbc 100644 --- a/mono/metadata/domain.c +++ b/mono/metadata/domain.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -71,6 +72,11 @@ static CRITICAL_SECTION appdomains_mutex; static MonoDomain *mono_root_domain = NULL; +/* some statistics */ +static int max_domain_code_size = 0; +static int max_domain_code_alloc = 0; +static int total_domain_code_alloc = 0; + /* AppConfigInfo: Information about runtime versions supported by an * aplication. */ @@ -1104,6 +1110,10 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * if (domain) g_assert_not_reached (); + mono_counters_register ("Max native code in a domain", MONO_COUNTER_INT|MONO_COUNTER_JIT, &max_domain_code_size); + mono_counters_register ("Max code space allocated in a domain", MONO_COUNTER_INT|MONO_COUNTER_JIT, &max_domain_code_alloc); + mono_counters_register ("Total code space allocated", MONO_COUNTER_INT|MONO_COUNTER_JIT, &total_domain_code_alloc); + MONO_GC_PRE_INIT (); appdomain_thread_id = TlsAlloc (); @@ -1684,6 +1694,7 @@ delete_jump_list (gpointer key, gpointer value, gpointer user_data) void mono_domain_free (MonoDomain *domain, gboolean force) { + int code_size, code_alloc; GSList *tmp; if ((domain == mono_root_domain) && !force) { g_warning ("cant unload root domain"); @@ -1744,6 +1755,13 @@ mono_domain_free (MonoDomain *domain, gboolean force) domain->ldstr_table = NULL; jit_info_table_free (domain->jit_info_table); domain->jit_info_table = NULL; + + /* collect statistics */ + code_alloc = mono_code_manager_size (domain->code_mp, &code_size); + total_domain_code_alloc += code_alloc; + max_domain_code_alloc = MAX (max_domain_code_alloc, code_alloc); + max_domain_code_size = MAX (max_domain_code_size, code_size); + #ifdef DEBUG_DOMAIN_UNLOAD mono_mempool_invalidate (domain->mp); mono_code_manager_invalidate (domain->code_mp); -- 2.25.1