nikgoodley-ibboost / gprof

Automatically exported from code.google.com/p/gprof
Apache License 2.0
0 stars 0 forks source link

GProf fails to profile a multi-threaded application #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
For example, the following script fails with NullPointerException but succeeds 
without Thread.start block.
{code}
def foo() {
  Thread.sleep(100)
}

def bar() {
  Thread.sleep(100)
}

profile {
  Thread.start {
    10.times { foo() }
  }
  Thread.start {
    10.times { bar() }
  }
}.prettyPrint()
{code}
{code}
Caught: java.lang.NullPointerException
java.lang.NullPointerException
    at gprof.ProfileTime.plus(ProfileTime.java:43)
    at gprof.Profile$1.visit(Profile.java:59)
    at gprof.ProfileCallTree$Node.visit(ProfileCallTree.java:97)
    at gprof.ProfileCallTree.visit(ProfileCallTree.java:32)
    at gprof.Profile.makeMethodEntries(Profile.java:33)
    at gprof.Profile.<init>(Profile.java:26)
    at gprof.Profiler.run(Profiler.java:47)
    at gprof.Profiler$run.call(Unknown Source)
    at gprof.ProfileStaticExtension.profile(ProfileStaticExtension.groovy:29)
    at ConcurrentProf.run(ConcurrentProf.groovy:9)
{code}

Original issue reported on code.google.com by nagaimas...@gmail.com on 20 Apr 2013 at 8:02

GoogleCodeExporter commented 9 years ago

Original comment by nagaimas...@gmail.com on 20 Apr 2013 at 8:10