.PP
In the above sample Mono will load the user defined profiler from the
shared library `mono-profiler-custom.so'. This profiler module must
-be on your dynamic linker library path.
+be on your dynamic linker library path, or in the MONO_PROFILER_LIB_DIR
+path (see "RUNTIME OPTIONS" below).
.PP
A list of other third party profilers is available from Mono's web
site (www.mono-project.com/docs/advanced/performance-tips/)
For a complete description of recommended practices for application
deployment, see
http://www.mono-project.com/docs/getting-started/application-deployment/
+.TP
+\fBMONO_PROFILER_LIB_DIR\fR
+Provides a search path to the runtime where to look for custom profilers. See the
+section "CUSTOM PROFILERS" above for more information. Custom profilers will be
+searched for in the MONO_PROFILER_LIB_DIR path before the standard library paths.
+
.TP
\fBMONO_RTC\fR
Experimental RTC support in the statistical profiler: if the user has
#include "mono/metadata/mono-config-dirs.h"
#include "mono/io-layer/io-layer.h"
#include "mono/utils/mono-dl.h"
+#include <mono/utils/mono-logger-internals.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
char *err;
void *iter;
+ mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Attempting to load profiler %s from %s (desc %s)", libname, directory, desc);
+
iter = NULL;
err = NULL;
while ((path = mono_dl_build_path (directory, libname, &iter))) {
pmodule = mono_dl_open (path, MONO_DL_LAZY, &err);
+ mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Attempting to load profiler: %s %ssuccessful, err: %s", path, pmodule?"":"not ", err);
g_free (path);
g_free (err);
if (pmodule)
}
if (!load_embedded_profiler (desc, mname)) {
libname = g_strdup_printf ("mono-profiler-%s", mname);
- if (mono_config_get_assemblies_dir ())
+ char *profiler_lib_dir = getenv ("MONO_PROFILER_LIB_DIR");
+ if (profiler_lib_dir)
+ res = load_profiler_from_directory (profiler_lib_dir, libname, desc);
+ if (!res && mono_config_get_assemblies_dir ())
res = load_profiler_from_directory (mono_assembly_getrootdir (), libname, desc);
if (!res)
res = load_profiler_from_directory (NULL, libname, desc);
# Setup the execution environment
# for the profiler module
-append_path ("LD_LIBRARY_PATH", $profbuilddir . "/.libs");
-append_path ("DYLD_LIBRARY_PATH", $profbuilddir . "/.libs");
+append_path ("MONO_PROFILER_LIB_DIR", $profbuilddir . "/.libs");
append_path ("DYLD_LIBRARY_PATH", $minibuilddir . "/.libs");
# for mprof-report
append_path ("PATH", $profbuilddir);