Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

I don't understand these profiles - what is taking all the CPU-time?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

http://www2.binf.ku.dk/~biehl/profile1.jpg
http://www2.binf.ku.dk/~biehl/profile2.jpg

with data (for the netbeans 5 profiler)

http://www2.binf.ku.dk/~biehl/prof1.nps
http://www2.binf.ku.dk/~biehl/prof2.nps

I don't understand where all of the cpu-time is used? Is something not inlined? What can explain such a profile?

Thanks
Anders

PS This is also posted at http://forums.java.net/jive/thread.jspa?threadID=1888&tstart=0 but that forum doesn't seem very alive.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post the Protein.calcEnergy method? That's where all the time is spend...
 
Anders Norgaard
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the method - but one thing I find strange is that on from the first to the second profile i reorganized some of the methods - but then the large time consumption just moved in the call hierachy.

And also - I wonder what the time that is not marked as "self" in a method is spent on (except other methods). The numbers dont add up. "self" + "other methods" < total time.

-Anders
/**
* Calculate the entire energy for this protein. This is done by an all vs
* all check. However the energy is symmetric, so if A <-> B is done, then
* avoid B <-> A.
*
* @return whether a hard-core overlap was detected
*/
public boolean calcEnergy() {
// update the Energy

totalEnergy = 0;

boolean overlap = false;
for (int i = 0; i < ncalf; i++) {
Monomer monI = monomers[i];

for (int j = i; j < ncalf; j++) {
Monomer monJ = monomers[j];
int indexDist = Math.abs(j - i);

if (indexDist > 1 && overlap(monI, monJ)) {
overlap = true;
break;
}
totalEnergy += energyMatrix
.calcEnergy(monI, monJ, monJ.pos);
}
}
return overlap;
}
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually it's EnergyMatrix.calcEnergy where all the time is going, right?
 
Anders Norgaard
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Actually it's EnergyMatrix.calcEnergy where all the time is going, right?

Well, it depends - in profile1 it looks that way. But after a bit of code - reorg - in profile2 it is Protein.calcEnergy that takes all the time. And the really strange part is that the "EnergyMatrix.calcEnergy" that takes all the time in profile1 is the two-parameter one of the two methods below.
This is why I question if I understand the profiles correctly?

Anders


/**
* Calculate the contact energy between the two monomers
*
* @param m1
* @param m2
* @return the contact energy value
*/
public static double calcEnergy(Monomer m1, Monomer m2){
return calcEnergy(m1, m2, m2.pos);
}

/**
* Calculate the contact energy between the two monomers
*
* @param m1
* @param m2
* @param m2Pos the position to be used for m2 in stead of
* m2.pos
* @return the contact energy value
*/
public static double calcEnergy(Monomer m1, Monomer m2, Point m2Pos){
final float energy = matrix[m1.aa.ordinal()][m2.aa.ordinal()];
double dist = m1.pos.distanceTo(m2Pos);
double ddist = dist - m1.aa.size - m2.aa.size;
//TODO clean up
return energy*distanceFactor(ddist);
}
[ November 07, 2005: Message edited by: Anders Norgaard ]
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It *may* be a bug in the NetBeans profiler. At least, as you I don't understand the output.
 
Anders Norgaard
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok - it was a bug in the profiler - now fixed - yay!

http://forums.java.net/jive/thread.jspa?threadID=1888&tstart=0
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic