Search code examples
mono

Mono profiler not running


I'm trying to run the mono profiler, however, I'm not getting any profiler output or error messages.

If I run mono --profile=log program.exe the program runs as expected and there are no error messages, yet there is no output.mlpd file.

I have the profiler libs installed and visible:-

# ldconfig -p | grep libmono-profiler
        libmono-profiler-log.so.0 (libc6,hard-float) => /usr/lib/libmono-profiler-log.so.0
        libmono-profiler-coverage.so.0 (libc6,hard-float) => /usr/lib/libmono-profiler-coverage.so.0
        libmono-profiler-aot.so.0 (libc6,hard-float) => /usr/lib/libmono-profiler-aot.so.0

I've tried using mono-sgen and just about every example of profiler options I could find, and nothing changes.

Changing the profiler to something invalid, like mono --profile=meh program.exe has the same result (program runs, no error message, no profiler output)

I've tried on two different machines (Yocto Thud and Ubuntu 18.04.2)

Mono JIT compiler version 5.18.0.268 (tarball Fri Jun 28 03:01:54 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          supported, not enabled.
        Suspend:       preemptive
        GC:            sgen (concurrent by default)
Mono JIT compiler version 5.20.1.19 (tarball Thu Apr 11 09:02:17 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          yes(600)
        Suspend:       hybrid
        GC:            sgen (concurrent by default)

This used to work in previous versions of mono in these environments, however, it's non-trivial to roll back and test.

UPDATE

I've managed to resolve this on some platforms (Ubuntu) with the installation of the mono-profiler package.

This package provides the following files:-

/.
/usr
/usr/bin
/usr/bin/emveepee
/usr/bin/mprof-decoder
/usr/bin/mprof-heap-viewer
/usr/lib
/usr/lib/mono-tools
/usr/lib/mono-tools/Mono.Profiler.Widgets.dll
/usr/lib/mono-tools/emveepee.exe
/usr/lib/mono-tools/mprof-decoder-library.dll
/usr/lib/mono-tools/mprof-decoder.exe
/usr/lib/mono-tools/mprof-heap-snapshot-explorer.dll
/usr/lib/mono-tools/mprof-heap-viewer.exe
/usr/share
/usr/share/doc
/usr/share/doc/mono-profiler
/usr/share/doc/mono-profiler/changelog.Debian.gz
/usr/share/doc/mono-profiler/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/mprof-decoder.1.gz
/usr/share/man/man1/mprof-heap-viewer.1.gz

These appear to be just tools for dealing with profile output. It's not clear which of these files "enables" /usr/bin/mono to actually capture profile data, or why mono is not reporting an error that required files(?) are not present.

The /usr/lib/libmono-profiler-*.so files were already on these platforms (prior to installing mono-profiler)

The remaining platform to resolve is Yocto Thud on ARM. With no package available as with Ubuntu, and no error message, it's difficult to tell what's missing that might be causing this issue.


Solution

  • The solution for Ubuntu was to install the mono-profiler package.

    The issue on Yocto Thud was that /usr/lib/libmono-profiler-log.so.0 was present, however, mono looks for /usr/lib/libmono-profiler-log.so (determined using strace) which was not symlinked to /usr/lib/libmono-profiler-log.so.0.

    The fact that mono doesn't report this as an error appears to be a bug.