Skip to content
Snippets Groups Projects
Commit 96711b87 authored by Joseph Boudreau's avatar Joseph Boudreau
Browse files

Fix to gmstatistics program

parent 6a6f8838
No related branches found
No related tags found
1 merge request!276Fix to gmstatistics program
......@@ -97,15 +97,10 @@ int main(int argc, char ** argv) {
std::cout.rdbuf(fileBuff);
#ifdef __APPLE__
{
GeoIntrusivePtr<GeoVPhysVol> world{createGeoWorld()};
for (const std::string & plugin : inputPlugins) {
GeoIntrusivePtr<GeoPhysVol> world{createGeoWorld()};
//
// Loop over plugins, create the geometry and put it under the world:
//
GeoGeometryPluginLoader loader;
GeoVGeometryPlugin *factory=loader.load(plugin);
if (!factory) {
......@@ -113,34 +108,15 @@ int main(int argc, char ** argv) {
std::cout.rdbuf(coutBuff);
return 5;
}
int before=snoop();
factory->create(world);
int net=snoop()-before;
std::cout.rdbuf(coutBuff);
if (printTree) {
GeoInventoryGraphAction action(std::cout);
world->exec(&action);
}
#ifndef __APPLE__
unsigned int expand=heapsize();
world->unref();
unsigned int contract=expand-heapsize();
std::cout << basename((char *) plugin.c_str()) << " allocates " << net/factor << " MB" << " net GeoModel " << contract/1000000.0 << " MB" << std::endl;
delete factory;
#else
// APPLE: meaningless std::cout << basename((char *) plugin.c_str()) << " allocates " << net/factor << " MB" << std::endl;
#endif
std::cout.rdbuf(fileBuff);
}
std::cout.rdbuf(coutBuff);
#ifdef __APPLE__
//
// Ceci n'est pas une pipe:
//
......@@ -160,5 +136,43 @@ int main(int argc, char ** argv) {
sum +=total;
}
std::cout << "Total GeoModel object allocation: " << sum/1000000.0 << "MB" << std::endl;
}
#else
{
for (const std::string & plugin : inputPlugins) {
GeoGeometryPluginLoader loader;
GeoVGeometryPlugin *factory=loader.load(plugin);
if (!factory) {
std::cerr << "Could not load plugin " << plugin << std::endl;
std::cout.rdbuf(coutBuff);
return 5;
}
unsigned int expand{0};
unsigned int net{0};
{
GeoIntrusivePtr<GeoVPhysVol> world{createGeoWorld()};
int before=snoop();
factory->create(world);
net=snoop()-before;
std::cout.rdbuf(coutBuff);
if (printTree) {
GeoInventoryGraphAction action(std::cout);
world->exec(&action);
}
expand=heapsize();
}
unsigned int contract=expand-heapsize();
std::cout << basename((char *) plugin.c_str()) << " allocates " << net/factor << " MB" << " net GeoModel " << contract/1000000.0 << " MB" << std::endl;
delete factory;
std::cout.rdbuf(fileBuff);
}
std::cout.rdbuf(coutBuff);
}
#endif
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment