Author: lupus
Date: 2007-10-08 05:24:11 -0400 (Mon, 08 Oct 2007)
New Revision: 87081
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/domain.c
Log:
Mon Oct 8 11:38:04 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
* domain.c: track statistics about the actual amount of native code
allocated.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-10-08 08:37:41 UTC (rev 87080)
+++ trunk/mono/mono/metadata/ChangeLog 2007-10-08 09:24:11 UTC (rev 87081)
@@ -1,4 +1,9 @@
+Mon Oct 8 11:38:04 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+ * domain.c: track statistics about the actual amount of native code
+ allocated.
+
Sat Oct 6 10:01:42 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
* class.c: the valuetype enumerators don't have the additional
Modified: trunk/mono/mono/metadata/domain.c
===================================================================
--- trunk/mono/mono/metadata/domain.c 2007-10-08 08:37:41 UTC (rev 87080)
+++ trunk/mono/mono/metadata/domain.c 2007-10-08 09:24:11 UTC (rev 87081)
@@ -18,6 +18,7 @@
#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-logger.h>
#include <mono/utils/mono-membar.h>
+#include <mono/utils/mono-counters.h>
#include <mono/metadata/object.h>
#include <mono/metadata/object-internals.h>
#include <mono/metadata/domain-internals.h>
@@ -71,6 +72,11 @@
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 @@
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 @@
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 @@
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);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches