The Source for Java Technology Collaboration
User: Password:



Felipe Leme's Blog

Felipe Leme Felipe Leme has worked professionally with Java since 1996, and in the last years had became an active enthusiastic of the technology: he is a frequent speaker in the main Brazilian Java conferences, presented at JavaOne for 3 years in a row, is a developer of a few Java-based open-source projects (like DbUnit and Jakarta Cactus), and is an individual member of the Java Community Process, where he took part of the JSP 2.1 and Java EE 5.0 expert groups.

He is a father of two, and in his spare time likes to assemble jigsaw puzzles and collect Marvel comic books with his older son, Thomas. He used to scuba dive as well, but have not dove yet in this new millennium.

Currently, he works as an independent consultant and Java instructor in Brazil, but is planning to move back to the US, where he worked from 1999 to 2002.



Configuring Eclipse TPTP (a.k.a PQP) profiler on Linux

Posted by felipeal on June 26, 2008 at 07:23 PM | Permalink | Comments (3)

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
	export TEMP=/tmp
fi


As a lazy bum with a 10GB /tmp partition, I just commented it to:

#if [ x$TEMP == x ]; then
	export TEMP=/tmp
#fi


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
ASCII Text

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:

# ./ACStart.sh 
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
And now:

# ./ACStart.sh 
Starting Agent Controller.
ACServer started successfully.

# ./ACStop.sh 
Shutting down the Agent Controller...
ACServer stopped.

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:


pqp.png

PS: regarding the meaning of PQP, I will leave the explanation to the Brazilian readers :-)

July 2008
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    


Search this blog:
  

Categories
Business
Community
Community: Java Enterprise
Community: Java Specification Requests
Community: Java Tools
Community: Mac Java Community
Deployment
Distributed
Eclipse
J2EE
J2SE
JavaOne
Linux
Open Source
Performance
Tools
Web Applications
Archives

June 2008
March 2008
July 2007
June 2007
May 2007
February 2007
November 2006
July 2006
June 2006
March 2006
June 2005
January 2005
December 2004
October 2004
July 2004
March 2004
January 2004
November 2003
October 2003
September 2003

Recent Entries

Configuring Eclipse TPTP (a.k.a PQP) profiler on Linux

Spring, ICEFaces, and the dreaded thread-bound request issue

JSP is not dead!

Articles

Creating EL-Aware Taglibs Using XDoclet
Passing dynamic values to taglibs via the JSP expression language (EL) is convenient, but is hard on the taglib developer and is therefore little-supported. Felipe Leme shows how code generation might solve that problem. Jun. 18, 2004

Validating Custom Tags at Translation Time
While typical JSP taglibs are held to a set of well known rules, many developers aren't aware that new rules can be defined and enforced by the developer. Felipe Leme examines these underappreciated JSP features. Feb. 4, 2004

All articles by Felipe Leme »



Powered by
Movable Type 3.01D


 Feed java.net RSS Feeds