You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -130,6 +130,7 @@ AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BOEHM_DEFINES = @BOEHM_DEFINES@
|
||||
BREAKPOINT = @BREAKPOINT@
|
||||
BTLS_ARCH = @BTLS_ARCH@
|
||||
BTLS_CFLAGS = @BTLS_CFLAGS@
|
||||
BTLS_CMAKE_ARGS = @BTLS_CMAKE_ARGS@
|
||||
@@ -170,12 +171,27 @@ EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GDKX11 = @GDKX11@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GINT_TO_POINTER = @GINT_TO_POINTER@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GNUC_NORETURN = @GNUC_NORETURN@
|
||||
GNUC_PRETTY = @GNUC_PRETTY@
|
||||
GNUC_UNUSED = @GNUC_UNUSED@
|
||||
GPOINTER_TO_INT = @GPOINTER_TO_INT@
|
||||
GPOINTER_TO_UINT = @GPOINTER_TO_UINT@
|
||||
GREP = @GREP@
|
||||
GSIZE = @GSIZE@
|
||||
GSIZE_FORMAT = @GSIZE_FORMAT@
|
||||
GTKX11 = @GTKX11@
|
||||
GUINT_TO_POINTER = @GUINT_TO_POINTER@
|
||||
G_GINT32_FORMAT = @G_GINT32_FORMAT@
|
||||
G_GINT64_FORMAT = @G_GINT64_FORMAT@
|
||||
G_GUINT32_FORMAT = @G_GUINT32_FORMAT@
|
||||
G_GUINT64_FORMAT = @G_GUINT64_FORMAT@
|
||||
G_HAVE_ISO_VARARGS = @G_HAVE_ISO_VARARGS@
|
||||
HAVE_ALLOCA_H = @HAVE_ALLOCA_H@
|
||||
HAVE_MSGFMT = @HAVE_MSGFMT@
|
||||
HOST_CC = @HOST_CC@
|
||||
INSTALL = @INSTALL@
|
||||
@@ -220,6 +236,8 @@ NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
ORDER = @ORDER@
|
||||
OS = @OS@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
@@ -229,15 +247,19 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATHSEP = @PATHSEP@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PIDTYPE = @PIDTYPE@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PLATFORM_AOT_SUFFIX = @PLATFORM_AOT_SUFFIX@
|
||||
RANLIB = @RANLIB@
|
||||
SEARCHSEP = @SEARCHSEP@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SGEN_DEFINES = @SGEN_DEFINES@
|
||||
SHARED_CFLAGS = @SHARED_CFLAGS@
|
||||
SHELL = @SHELL@
|
||||
SIZEOF_VOID_P = @SIZEOF_VOID_P@
|
||||
SQLITE = @SQLITE@
|
||||
SQLITE3 = @SQLITE3@
|
||||
STRIP = @STRIP@
|
||||
@@ -310,6 +332,7 @@ mkdir_p = @mkdir_p@
|
||||
mono_build_root = @mono_build_root@
|
||||
mono_cfg_dir = @mono_cfg_dir@
|
||||
mono_runtime = @mono_runtime@
|
||||
ninja = @ninja@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
/*
|
||||
* Bare bones profiler. Compile with:
|
||||
*
|
||||
* linux : gcc -shared -o mono-profiler-sample.so sample.c `pkg-config --cflags --libs mono`
|
||||
* mac : gcc sample.c -o mono-profiler-sample.dylib -Dmono_free=free -lz `pkg-config --cflags mono-2` -undefined suppress -flat_namespace
|
||||
*
|
||||
* Install the binary where the dynamic loader can find it. eg /usr/lib etc
|
||||
* linux : gcc -fPIC -shared -o libmono-profiler-sample.so sample.c `pkg-config --cflags --libs mono-2`
|
||||
* mac : gcc -o mono-profiler-sample.dylib sample.c -lz `pkg-config --cflags mono-2` -undefined suppress -flat_namespace
|
||||
* linux with a custom prefix (e.g. --prefix=/opt/my-mono-build):
|
||||
* gcc -fPIC -shared -o libmono-profiler-sample.so sample.c `PKG_CONFIG_PATH=/opt/my-mono-build/lib/pkgconfig/ pkg-config --cflags --libs mono-2`
|
||||
*
|
||||
* Install the binary where the dynamic loader can find it. eg /usr/lib etc.
|
||||
* For a custom prefix build, <prefix>/lib would also work.
|
||||
* Then run mono with:
|
||||
* mono --profile=sample your_application.exe
|
||||
*
|
||||
@@ -14,40 +17,40 @@
|
||||
*/
|
||||
|
||||
struct _MonoProfiler {
|
||||
int ncalls;
|
||||
unsigned long long ncalls;
|
||||
};
|
||||
|
||||
static MonoProfiler prof_instance;
|
||||
|
||||
/* called at the end of the program */
|
||||
static void
|
||||
sample_shutdown (MonoProfiler *prof)
|
||||
{
|
||||
g_print ("total number of calls: %d\n", prof->ncalls);
|
||||
printf("total number of calls: %llu\n", prof->ncalls);
|
||||
}
|
||||
|
||||
static void
|
||||
sample_method_enter (MonoProfiler *prof, MonoMethod *method)
|
||||
sample_method_enter (MonoProfiler *prof, MonoMethod *method, MonoProfilerCallContext *ctx)
|
||||
{
|
||||
prof->ncalls++;
|
||||
}
|
||||
|
||||
static void
|
||||
sample_method_leave (MonoProfiler *prof, MonoMethod *method)
|
||||
static MonoProfilerCallInstrumentationFlags
|
||||
sample_instrumentation_filter (MonoProfiler *prof, MonoMethod *method)
|
||||
{
|
||||
return MONO_PROFILER_CALL_INSTRUMENTATION_ENTER;
|
||||
}
|
||||
|
||||
/* the entry point */
|
||||
void
|
||||
mono_profiler_startup (const char *desc)
|
||||
mono_profiler_init_sample (const char *desc)
|
||||
{
|
||||
MonoProfiler *prof;
|
||||
MonoProfiler *prof = &prof_instance;
|
||||
|
||||
prof = g_new0 (MonoProfiler, 1);
|
||||
|
||||
mono_profiler_install (prof, sample_shutdown);
|
||||
|
||||
mono_profiler_install_enter_leave (sample_method_enter, sample_method_leave);
|
||||
|
||||
mono_profiler_set_events (MONO_PROFILE_ENTER_LEAVE);
|
||||
MonoProfilerHandle handle = mono_profiler_create (prof);
|
||||
mono_profiler_set_runtime_shutdown_end_callback (handle, sample_shutdown);
|
||||
mono_profiler_set_call_instrumentation_filter_callback (handle, sample_instrumentation_filter);
|
||||
mono_profiler_set_method_enter_callback (handle, sample_method_enter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ GetMemoryUsage (MonoObject *this)
|
||||
|
||||
static int installed = 0;
|
||||
|
||||
void install_icall (MonoProfiler *prof, MonoMethod *method, MonoJitInfo* jinfo, int result)
|
||||
void install_icall (MonoProfiler *prof, MonoMethod *method, MonoJitInfo* jinfo)
|
||||
{
|
||||
if (installed)
|
||||
return;
|
||||
@@ -131,8 +131,8 @@ void install_icall (MonoProfiler *prof, MonoMethod *method, MonoJitInfo* jinfo,
|
||||
}
|
||||
|
||||
void
|
||||
mono_profiler_startup (const char *desc)
|
||||
mono_profiler_init_size (const char *desc)
|
||||
{
|
||||
mono_profiler_install_jit_end (install_icall);
|
||||
mono_profiler_set_events (MONO_PROFILE_JIT_COMPILATION);
|
||||
MonoProfilerHandle handle = mono_profiler_create (NULL);
|
||||
mono_profiler_set_jit_done_callback (handle, install_icall);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user