Configuring Eclipse TPTP (a.k.a PQP) profiler on Linux
After struggling for weeks and almost giving up, I finally managed to have the Eclipse TPTP profiler working on my Ubuntu 64bits box!
As this was a painful and unbelievably hard experience (because of Eclipse TPTP, not Ubuntu/Linux, BTW), I'm going to share a few tips here.
First of all, this is going to be a quick and dirty blog. I don't have the time, patience, or motivation to do a detailed step-by-step tutorial - there are plenty available (Got google?). The problem is, you follow them and something just is not there or does not work, then you got stuck - the idea here is to provide clues on why you got stuck and how to get going.
So, let's assume you installed TPTP and try to profile a web application (which is already configured and can be ran as 'Run As -> Run on Server'). You right-click in the project, do a 'Profile As -> Profile on Server') and then... nothing. No exception, no error, no frogs failing from sky, nothing. Actually, there is one symptom: the monitor dialog opens, but empty.
I knew from previous (and frustrated) attempts that the profiler needs to run an agent (which is OS-specific) and if the agent is not running, it pops up an error message (stating that the agent is not running - when I first got that message a few weeks ago, I google for it and figure that out). As the message didn't pop up this time, I figured some exception has been just ignored by Eclipse's UI, so I decide to do a tail -f on the .log file (located on WORKSPACE_DIR/.metadata), and bingo: got a message saying that the script could not be executed. (PS: I don't have the log messages anymore, so I won't be able to copy and paste the exact message).
I will ignore for now the fact that when you download a linux tarball the proper files necessary to run the application should have all necessary executable bits turned on and jump to the point where I had to cd to
ECLIPSE_INSTALL/plugins/org.eclipse.tptp.platform.ac.linux_em64t_4.4.1.v200804021410/agent_controller/bin and do a 'chmod +x *'. Once I did it, I tried to run again and got:
[: 46: ==: unexpected operator
Looking at those lines, I found some marvels of modern shell spripting:
if [ x$TEMP == x ]; then
As a lazy bum with a 10GB /tmp partition, I just commented it to:
#if [ x$TEMP == x ]; then
Running it again, I got a new error now, something like (again, I don't have the output anymore):
ACServer: error while loading shared libraries: ../lib/libtptpUtils.so: short file
Sounded weird, so I decided to take a look on that file:
# file ../lib/libtptpUtils.so
Very nice: not only the files on bin are not executable, but the libraries that should be a symbolic link are text files which the name of the real libraries! Never saw such think, whoever did that deserves a Duke Award! Specially because I could fix it with a quick shell command:
for i in `file *|grep -i ascii|cut -f 1 -d : `; do new=`cat $i`; rm $i ;ln -s $new $i; done
Now that I fixed the broken files provided in the tarball, I got an 'easy' problem:
ACServer: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
After I couple of minutes googleing and apt-cache searching:
# sudo apt-get install libstdc++5
Starting Agent Controller.
ACServer started successfully.
Shutting down the Agent Controller...
In other words, at this point I knew the non-java (the agent) part of the profiler will work, so I could try it again in the UI (notice that the only Ubuntu-specific issue here was the missing libstdc++5; all the rest was bad packaging by the PTPT project).
Back to Eclipse, I did the "Profile As" again, and... nothing. I mean, know I saw same status bar messages saying the profiler received events and such, and a 'ps -aef|grep AC' shows the agent running. But I couldn't figure out how to get the results in real time (I could export a report in HTML, which is not useful for the kind of profiling I was going to do). After googleing around, it looked like I should be able to right click the profiler elements in the Monitor view and select a 'Opening With -> Execution Statistics' editor (see? I'm even using the correct Eclipse terms at this point :-). But looks like the bastard is not available, even though when I installed the TPTP/Web project I select the option to install all the dependencies.
At this point, I thought that the only plausible issue was some missing plugin to visualize the results. I triggered the Eclipse update panel again and expanded all TPTP options to see if I found something with a reasonable name that could solve the issue... and nothing. So, as a last and desperate resource, I decided to install all remaining TPTP plugins (including some BIRT stuff), and... voilÃ , it worked!
Seriously, I finally got the execution statistics, method statistics, etc. I was so thrilled that I almost cried! But instead, I decided to write this quick block.
And for those non-believers (I was such one), here is a screenshot:
PS: regarding the meaning of PQP, I will leave the explanation to the Brazilian readers :-)