Author: lupus
Date: 2007-06-14 06:30:49 -0400 (Thu, 14 Jun 2007)
New Revision: 79535
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/profiler-private.h
trunk/mono/mono/metadata/profiler.c
trunk/mono/mono/metadata/profiler.h
Log:
Thu Jun 14 12:40:05 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
* profiler-private.h, profiler.c, profiler.h: added API to profile
exception events.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-06-14 09:49:21 UTC (rev 79534)
+++ trunk/mono/mono/metadata/ChangeLog 2007-06-14 10:30:49 UTC (rev 79535)
@@ -1,3 +1,9 @@
+
+Thu Jun 14 12:40:05 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+ * profiler-private.h, profiler.c, profiler.h: added API to profile
+ exception events.
+
2007-06-13 Rodrigo Kumpera <[EMAIL PROTECTED]>
* verify.c: Fixed pointer type handling, some code and message
formating and two invalid assigments
Modified: trunk/mono/mono/metadata/profiler-private.h
===================================================================
--- trunk/mono/mono/metadata/profiler-private.h 2007-06-14 09:49:21 UTC (rev
79534)
+++ trunk/mono/mono/metadata/profiler-private.h 2007-06-14 10:30:49 UTC (rev
79535)
@@ -35,6 +35,10 @@
void mono_profiler_thread_start (gsize tid) MONO_INTERNAL;
void mono_profiler_thread_end (gsize tid) MONO_INTERNAL;
+void mono_profiler_exception_thrown (MonoObject *exception)
MONO_INTERNAL;
+void mono_profiler_exception_method_leave (MonoMethod *method) MONO_INTERNAL;
+void mono_profiler_exception_clause_handler (MonoMethod *method, int
clause_type, int clause_num) MONO_INTERNAL;
+
void mono_profiler_assembly_event (MonoAssembly *assembly, int code)
MONO_INTERNAL;
void mono_profiler_assembly_loaded (MonoAssembly *assembly, int result)
MONO_INTERNAL;
Modified: trunk/mono/mono/metadata/profiler.c
===================================================================
--- trunk/mono/mono/metadata/profiler.c 2007-06-14 09:49:21 UTC (rev 79534)
+++ trunk/mono/mono/metadata/profiler.c 2007-06-14 10:30:49 UTC (rev 79535)
@@ -61,6 +61,10 @@
static MonoProfileMethodFunc method_enter;
static MonoProfileMethodFunc method_leave;
+static MonoProfileExceptionFunc exception_throw_cb;
+static MonoProfileMethodFunc exception_method_leave_cb;
+static MonoProfileExceptionClauseFunc exception_clause_cb;
+
static MonoProfileThreadFunc thread_start;
static MonoProfileThreadFunc thread_end;
@@ -192,6 +196,13 @@
statistical_cb = callback;
}
+void mono_profiler_install_exception (MonoProfileExceptionFunc throw_callback,
MonoProfileMethodFunc exc_method_leave, MonoProfileExceptionClauseFunc
clause_callback)
+{
+ exception_throw_cb = throw_callback;
+ exception_method_leave_cb = exc_method_leave;
+ exception_clause_cb = clause_callback;
+}
+
void
mono_profiler_install_coverage_filter (MonoProfileCoverageFilterFunc callback)
{
@@ -293,6 +304,27 @@
}
void
+mono_profiler_exception_thrown (MonoObject *exception)
+{
+ if ((mono_profiler_events & MONO_PROFILE_EXCEPTIONS) &&
exception_throw_cb)
+ exception_throw_cb (current_profiler, exception);
+}
+
+void
+mono_profiler_exception_method_leave (MonoMethod *method)
+{
+ if ((mono_profiler_events & MONO_PROFILE_EXCEPTIONS) &&
exception_method_leave_cb)
+ exception_method_leave_cb (current_profiler, method);
+}
+
+void
+mono_profiler_exception_clause_handler (MonoMethod *method, int clause_type,
int clause_num)
+{
+ if ((mono_profiler_events & MONO_PROFILE_EXCEPTIONS) &&
exception_clause_cb)
+ exception_clause_cb (current_profiler, method, clause_type,
clause_num);
+}
+
+void
mono_profiler_thread_start (gsize tid)
{
if ((mono_profiler_events & MONO_PROFILE_THREADS) && thread_start)
@@ -1409,7 +1441,7 @@
const char *arg = *ptr;
if (!strcmp (arg, "time"))
- flags |= MONO_PROFILE_ENTER_LEAVE;
+ flags |= MONO_PROFILE_ENTER_LEAVE |
MONO_PROFILE_EXCEPTIONS;
else if (!strcmp (arg, "alloc"))
flags |= MONO_PROFILE_ALLOCATIONS;
else if (!strcmp (arg, "stat"))
@@ -1429,9 +1461,9 @@
}
}
if (flags & MONO_PROFILE_ALLOCATIONS)
- flags |= MONO_PROFILE_ENTER_LEAVE;
+ flags |= MONO_PROFILE_ENTER_LEAVE | MONO_PROFILE_EXCEPTIONS;
if (!flags)
- flags = MONO_PROFILE_ENTER_LEAVE | MONO_PROFILE_ALLOCATIONS |
MONO_PROFILE_JIT_COMPILATION;
+ flags = MONO_PROFILE_ENTER_LEAVE | MONO_PROFILE_ALLOCATIONS |
MONO_PROFILE_JIT_COMPILATION | MONO_PROFILE_EXCEPTIONS;
prof = create_profiler ();
ALLOC_PROFILER ();
@@ -1443,6 +1475,7 @@
mono_profiler_install (prof, simple_shutdown);
mono_profiler_install_enter_leave (simple_method_enter,
simple_method_leave);
+ mono_profiler_install_exception (NULL, simple_method_leave, NULL);
mono_profiler_install_jit_compile (simple_method_jit,
simple_method_end_jit);
mono_profiler_install_allocation (simple_allocation);
mono_profiler_install_appdomain (NULL, NULL, simple_appdomain_unload,
NULL);
Modified: trunk/mono/mono/metadata/profiler.h
===================================================================
--- trunk/mono/mono/metadata/profiler.h 2007-06-14 09:49:21 UTC (rev 79534)
+++ trunk/mono/mono/metadata/profiler.h 2007-06-14 10:30:49 UTC (rev 79535)
@@ -65,6 +65,9 @@
typedef void (*MonoProfileModuleFunc) (MonoProfiler *prof, MonoImage
*module);
typedef void (*MonoProfileAssemblyFunc) (MonoProfiler *prof, MonoAssembly
*assembly);
+typedef void (*MonoProfileExceptionFunc) (MonoProfiler *prof, MonoObject
*object);
+typedef void (*MonoProfileExceptionClauseFunc) (MonoProfiler *prof, MonoMethod
*method, int clause_type, int clause_num);
+
typedef void (*MonoProfileAppDomainResult)(MonoProfiler *prof, MonoDomain
*domain, int result);
typedef void (*MonoProfileMethodResult) (MonoProfiler *prof, MonoMethod
*method, int result);
typedef void (*MonoProfileJitResult) (MonoProfiler *prof, MonoMethod
*method, MonoJitInfo* jinfo, int result);
@@ -108,6 +111,7 @@
void mono_profiler_install_transition (MonoProfileMethodResult callback);
void mono_profiler_install_allocation (MonoProfileAllocFunc callback);
void mono_profiler_install_statistical (MonoProfileStatFunc callback);
+void mono_profiler_install_exception (MonoProfileExceptionFunc
throw_callback, MonoProfileMethodFunc exc_method_leave,
MonoProfileExceptionClauseFunc clause_callback);
void mono_profiler_install_coverage_filter (MonoProfileCoverageFilterFunc
callback);
void mono_profiler_coverage_get (MonoProfiler *prof, MonoMethod *method,
MonoProfileCoverageFunc func);
void mono_profiler_install_gc (MonoProfileGCFunc callback,
MonoProfileGCResizeFunc heap_resize_callback);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches