jvm-profiling-tools / honest-profiler

A sampling JVM profiler without the safepoint sample bias
https://github.com/RichardWarburton/honest-profiler/wiki
MIT License
1.25k stars 146 forks source link

How to build on OSX? #222

Closed MichaelScofield closed 7 years ago

MichaelScofield commented 7 years ago

The How to build wiki didn't mention how to build on OSX. I Googled it, all I got were pretty much out-dated (back to 3 years ago).

PS: If I directly use the downloaded liblagent.so file from http://insightfullogic.com/honest-profiler.zip and run it by exec java -agentpath:/Users/me/path/to/honest-profiler/liblagent.so=interval=7,logPath=/tmp/myapp.hpl myapp, it complains the following error:

Could not find agent library /Users/me/path/to/honest-profiler/liblagent.so in absolute path, with error: dlopen(/Users/me/path/to/honest-profiler/liblagent.so, 1): no suitable image found.  Did find:
    /Users/me/path/to/honest-profiler/liblagent.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
    /Users/me/path/to/honest-profiler/liblagent.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00

So I guess I have to build it from source, and thus the issue.

RichardWarburton commented 7 years ago

The download link is to a linux binary.

I don't use Mac OS myself - so I don't support it working on Mac OS. Basically the problem is that if I don't have a mac I don't really have a way of debugging it working. It should work though, since it's supported by the JVM and sigprof exists on Mac OS. Some users have tried using it and found it to work.

In order to compile the code you'll need to install a C++ compiler, cmake and unittest++. You can download unittest++ from https://unittest-cpp.github.io/. I hope that helps, perhaps if someone else uses Mac OS then they can chime in with further suggestions?