Hello,
I am trying to use gBenchmark to compare real and CPU time of a macro in interpreted mode versus compiled mode. I have created a standalone application to be able to compile the code with g++, version 9.1. To reproduce the error, here is a simple example:
#include "TApplication.h"
#include "TH1F.h"
#include "TBenchmark.h"
void ExampleMacro_GUI(){
gBenchmark->Start("example");
TH1F* h=new TH1F("h", "test histogram", 100,-5.,5.);
h->FillRandom("gaus",1E4);
h->Draw("H");
h->Draw("E,P,SAME");
gBenchmark->Show("example");
}
void StandaloneApplication(int argc, char** argv) {
ExampleMacro_GUI();
}
int main(int argc, char** argv) {
TApplication app("ROOT Application", &argc, argv);
StandaloneApplication(app.Argc(), app.Argv());
app.Run();
return 0;
}
Using gBenchmark causes a segmentation violation:
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f5717f99387 in __GI___waitpid (pid=20199, stat_loc=stat_loc
entry=0x7ffd63e2f608, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1 0x00007f5717f0ad57 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:167
#2 0x00007f57189eecf0 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x55fd6b5b0b80) at /home/kimdamiani/Products/root-6.18.04/core/unix/src/TUnixSystem.cxx:2106
#3 TUnixSystem::StackTrace (this=0x55fd6b5b0b80) at /home/kimdamiani/Products/root-6.18.04/core/unix/src/TUnixSystem.cxx:2400
#4 0x00007f57189f1754 in TUnixSystem::DispatchSignals (this=0x55fd6b5b0b80, sig=kSigSegmentationViolation) at /home/kimdamiani/Products/root-6.18.04/core/unix/src/TUnixSystem.cxx:3631
#5 <signal handler called>
#6 0x000055fd6a6a81ee in ExampleMacro_GUI() ()
#7 0x000055fd6a6a82fe in StandaloneApplication(int, char**) ()
#8 0x000055fd6a6a8384 in main ()
===========================================================
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6 0x000055fd6a6a81ee in ExampleMacro_GUI() ()
#7 0x000055fd6a6a82fe in StandaloneApplication(int, char**) ()
#8 0x000055fd6a6a8384 in main ()
Is it because I am compiling with g++ instead of ACLiC?
Any help would be greatly appreciated.
_ROOT Version: 6.18/04
_Platform: Ubuntu 19.04 x86_64