Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
Visualization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Modules
Visualization
Commits
3dc6dad6
Commit
3dc6dad6
authored
14 years ago
by
Mark Olesen
Browse files
Options
Downloads
Patches
Plain Diff
ENH: use memInfo instead of parsing meminfo ourselves
parent
565c8fcb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C
+4
-34
4 additions, 34 deletions
...ins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C
with
4 additions
and
34 deletions
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C
+
4
−
34
View file @
3dc6dad6
...
...
@@ -33,6 +33,7 @@ Description
#include
"fvMesh.H"
#include
"Time.H"
#include
"IFstream.H"
#include
"memInfo.H"
// VTK includes
#include
"vtkDataArraySelection.h"
...
...
@@ -325,44 +326,13 @@ void Foam::vtkPV3Foam::setSelectedArrayEntries
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// parse these bits of info from /proc/meminfo (Linux)
//
// MemTotal: 2062660 kB
// MemFree: 1124400 kB
//
// used = MemTotal - MemFree is what the free(1) uses.
//
void
Foam
::
vtkPV3Foam
::
printMemory
()
{
const
char
*
mem
i
nfo
=
"/proc/meminfo"
;
mem
I
nfo
mem
;
if
(
exists
(
meminfo
))
if
(
mem
.
valid
(
))
{
IFstream
is
(
meminfo
);
label
memTotal
=
0
;
label
memFree
=
0
;
string
line
;
while
(
is
.
getLine
(
line
).
good
())
{
char
tag
[
32
];
int
value
;
if
(
sscanf
(
line
.
c_str
(),
"%30s %d"
,
tag
,
&
value
)
==
2
)
{
if
(
!
strcmp
(
tag
,
"MemTotal:"
))
{
memTotal
=
value
;
}
else
if
(
!
strcmp
(
tag
,
"MemFree:"
))
{
memFree
=
value
;
}
}
}
Info
<<
"memUsed: "
<<
(
memTotal
-
memFree
)
<<
" kB
\n
"
;
Info
<<
"mem peak/size/rss: "
<<
mem
<<
"
\n
"
;
}
}
...
...
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