Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GeoModelDev
GeoModel
Commits
96711b87
Commit
96711b87
authored
1 year ago
by
Joseph Boudreau
Browse files
Options
Downloads
Patches
Plain Diff
Fix to gmstatistics program
parent
6a6f8838
No related branches found
No related tags found
1 merge request
!276
Fix to gmstatistics program
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GeoModelTools/GMSTATISTICS/src/gmstatistics.cxx
+70
-56
70 additions, 56 deletions
GeoModelTools/GMSTATISTICS/src/gmstatistics.cxx
with
70 additions
and
56 deletions
GeoModelTools/GMSTATISTICS/src/gmstatistics.cxx
+
70
−
56
View file @
96711b87
...
...
@@ -96,69 +96,83 @@ int main(int argc, char ** argv) {
std
::
streambuf
*
fileBuff
=
file
.
rdbuf
();
std
::
cout
.
rdbuf
(
fileBuff
);
for
(
const
std
::
string
&
plugin
:
inputPlugins
)
{
GeoIntrusivePtr
<
GeoPhysVol
>
world
{
createGeoWorld
()};
#ifdef __APPLE__
{
GeoIntrusivePtr
<
GeoVPhysVol
>
world
{
createGeoWorld
()};
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
;
}
factory
->
create
(
world
);
if
(
printTree
)
{
GeoInventoryGraphAction
action
(
std
::
cout
);
world
->
exec
(
&
action
);
}
delete
factory
;
std
::
cout
.
rdbuf
(
fileBuff
);
}
std
::
cout
.
rdbuf
(
coutBuff
);
//
//
Loop over plugins, create the geometry and put it under the world
:
//
Ceci n'est pas une pipe
:
//
GeoGeometryPluginLoader
loader
;
GeoVGeometryPlugin
*
factory
=
loader
.
load
(
plugin
);
if
(
!
factory
)
{
std
::
cerr
<<
"Could not load plugin "
<<
plugin
<<
std
::
endl
;
std
::
cout
.
rdbuf
(
coutBuff
);
return
5
;
FILE
*
ceci
=
popen
((
"heap --guessNonObjects "
+
std
::
to_string
(
getpid
())
+
" | grep -e GeoModelKernel -e GeoGenericFunctions "
).
c_str
(),
"r"
);
//
char
*
line
;
size_t
linecap
=
0
;
int
sum
=
0.0
;
while
(
getline
(
&
line
,
&
linecap
,
ceci
)
>
0
)
{
std
::
istringstream
stream
(
line
);
unsigned
int
total
,
number
;
double
average
;
std
::
string
object
;
stream
>>
number
>>
total
>>
average
>>
object
;
std
::
cout
<<
std
::
setw
(
30
)
<<
object
<<
" "
<<
std
::
setw
(
15
)
<<
number
<<
" instances "
<<
std
::
setw
(
20
)
<<
total
<<
" bytes"
<<
std
::
endl
;
sum
+=
total
;
}
std
::
cout
<<
"Total GeoModel object allocation: "
<<
sum
/
1000000.0
<<
"MB"
<<
std
::
endl
;
}
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
{
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
);
std
::
cout
.
rdbuf
(
fileBuff
);
}
std
::
cout
.
rdbuf
(
coutBuff
);
#ifdef __APPLE__
//
// Ceci n'est pas une pipe:
//
FILE
*
ceci
=
popen
((
"heap --guessNonObjects "
+
std
::
to_string
(
getpid
())
+
" | grep -e GeoModelKernel -e GeoGenericFunctions "
).
c_str
(),
"r"
);
//
char
*
line
;
size_t
linecap
=
0
;
int
sum
=
0.0
;
while
(
getline
(
&
line
,
&
linecap
,
ceci
)
>
0
)
{
std
::
istringstream
stream
(
line
);
unsigned
int
total
,
number
;
double
average
;
std
::
string
object
;
stream
>>
number
>>
total
>>
average
>>
object
;
std
::
cout
<<
std
::
setw
(
30
)
<<
object
<<
" "
<<
std
::
setw
(
15
)
<<
number
<<
" instances "
<<
std
::
setw
(
20
)
<<
total
<<
" bytes"
<<
std
::
endl
;
sum
+=
total
;
}
std
::
cout
<<
"Total GeoModel object allocation: "
<<
sum
/
1000000.0
<<
"MB"
<<
std
::
endl
;
#endif
#endif
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment