.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, or in the MONO_PROFILER_LIB_DIR
-path (see "RUNTIME OPTIONS" below).
+be on your dynamic linker library path.
.PP
A list of other third party profilers is available from Mono's web
site (www.mono-project.com/docs/advanced/performance-tips/)
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_SHARED_DIR\fR
If set its the directory where the ".wapi" handle state is stored.
This is the directory where the Windows I/O Emulation layer stores its
return result;
}
+// TODO: Much of the library loading code here is custom. It would be better to merge this with mono-dl
static gboolean
load_profiler_from_directory (const char *directory, const char *libname, const char *desc)
{
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);
+ mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT, "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);
+ mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT, "Attempting to load profiler: %s, %ssuccessful, err: %s", path, pmodule?"":"not ", err);
g_free (path);
g_free (err);
if (pmodule)
}
static gboolean
-load_profiler_from_mono_instalation (const char *libname, const char *desc)
+load_profiler_from_mono_installation (const char *libname, const char *desc)
{
char *err = NULL;
MonoDl *pmodule = mono_dl_open_runtime_lib (libname, MONO_DL_LAZY, &err);
+ mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT, "Attempting to load profiler from runtime libs: %s, %ssuccessful, err: %s", libname, pmodule?"":"not ", err);
g_free (err);
if (pmodule)
return load_profiler (pmodule, desc, INITIALIZER_NAME);
}
if (!load_embedded_profiler (desc, mname)) {
libname = g_strdup_printf ("mono-profiler-%s", mname);
- char *profiler_lib_dir = getenv ("MONO_PROFILER_LIB_DIR");
- if (profiler_lib_dir)
- res = load_profiler_from_directory (profiler_lib_dir, libname, desc);
+ res = load_profiler_from_mono_installation (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);
- if (!res)
- res = load_profiler_from_mono_instalation (libname, desc);
if (!res)
g_warning ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname);
g_free (libname);
if (binl != -1) {
char *base;
char *resolvedname, *name;
+ char *baseparent = NULL;
buf [binl] = 0;
resolvedname = mono_path_resolve_symlinks (buf);
base = g_path_get_dirname (resolvedname);
name = g_strdup_printf ("%s/.libs", base);
runtime_lib = try_load (lib_name, name, flags, error_msg);
g_free (name);
+ if (!runtime_lib)
+ baseparent = g_path_get_dirname (base);
if (!runtime_lib) {
- char *newbase = g_path_get_dirname (base);
- name = g_strdup_printf ("%s/lib", newbase);
+ name = g_strdup_printf ("%s/lib", baseparent);
runtime_lib = try_load (lib_name, name, flags, error_msg);
g_free (name);
}
#ifdef __MACH__
if (!runtime_lib) {
- char *newbase = g_path_get_dirname (base);
- name = g_strdup_printf ("%s/Libraries", newbase);
+ name = g_strdup_printf ("%s/Libraries", baseparent);
runtime_lib = try_load (lib_name, name, flags, error_msg);
g_free (name);
}
#endif
+ if (!runtime_lib) {
+ name = g_strdup_printf ("%s/profiler/.libs", baseparent);
+ runtime_lib = try_load (lib_name, name, flags, error_msg);
+ g_free (name);
+ }
g_free (base);
g_free (resolvedname);
+ g_free (baseparent);
}
if (!runtime_lib)
runtime_lib = try_load (lib_name, NULL, flags, error_msg);