ENH: handle 64-bit memory information (#3060)

- on large memory systems (eg, 6TB) the process information
  exceeds an 'int' range, so adjust parsing of the /proc/..
  to use int64

ENH: update/modernize OSspecific system information

ENH: minor update of profiling code

- std::string, noexcept, lazier evaluations

STYLE: use direct call of memInfo
This commit is contained in:
Mark Olesen
2023-12-15 14:05:32 +01:00
parent 2045de8345
commit 7e0acfa4ed
30 changed files with 391 additions and 354 deletions

View File

@ -1,3 +1,3 @@
Test-HashTable4.C
Test-HashTable4.cxx
EXE = $(FOAM_USER_APPBIN)/Test-HashTable4

View File

@ -159,7 +159,6 @@ int main(int argc, char *argv[])
cpuTime timer;
memInfo mem;
Info<< "insert " << nElem << " (int) elements";
if (optFnd)
@ -306,7 +305,8 @@ int main(int argc, char *argv[])
}
Info<< timer.cpuTimeIncrement() << " s\n";
Info<< "mem info: " << mem.update() << endl;
Foam::memInfo{}.writeEntry("mem-info", Info);
Info<< endl;
return 0;
}

View File

@ -1,3 +1,3 @@
Test-cpuInfo.C
Test-cpuInfo.cxx
EXE = $(FOAM_USER_APPBIN)/Test-cpuInfo

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,7 +39,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
cpuInfo().write(Info);
Foam::cpuInfo{}.writeEntry("cpu-info", Info);
Info<< endl;
return 0;

View File

@ -1,3 +1,3 @@
Test-memInfo.C
Test-memInfo.cxx
EXE = $(FOAM_USER_APPBIN)/Test-memInfo

View File

@ -47,14 +47,18 @@ int main(int argc, char *argv[])
memInfo mem;
Info<< memTags << mem << endl;
List<vector> lst(n, vector::one);
Info<< "allocate " << n << " vectors" << nl
<< memTags << mem.update() << endl;
List<vector> list(n, vector::one);
lst.clear();
Info<< "clear" << nl
<< memTags << mem.update() << endl;
Info<< "allocate " << n << " vectors" << nl;
Info<< memTags << mem.update() << endl;
list.clear();
Info<< "clear" << nl;
Info<< memTags << mem.update() << endl;
mem.writeEntry("memory", Info);
Info<< endl;
return 0;
}

View File

@ -1,3 +1,3 @@
Test-sysInfo.C
Test-sysInfo.cxx
EXE = $(FOAM_USER_APPBIN)/Test-sysInfo

View File

@ -43,9 +43,8 @@ using namespace Foam;
int main(int argc, char *argv[])
{
profilingSysInfo().write(Info);
cpuInfo().write(Info);
profilingSysInfo{}.writeEntry("sys-info", Info);
Foam::cpuInfo{}.writeEntry("cpu-info", Info);
#ifdef WM_BIG_ENDIAN
Info

View File

@ -64,7 +64,6 @@ SourceFiles
#include "fvMesh.H"
#include "labelPair.H"
#include "HashSet.H"
#include "memInfo.H"
#include "point.H"
#include "cellSet.H"
#include "wallPolyPatch.H"

View File

@ -38,6 +38,7 @@ License
#include "indexedVertexOps.H"
#include "DelaunayMeshTools.H"
#include "syncTools.H"
#include "memInfo.H"
#include "faceSet.H"
#include "OBJstream.H"

View File

@ -463,8 +463,7 @@ int main(int argc, char *argv[])
// ------------------------------------------------------------------------
cpuTime timer;
memInfo mem;
Info<< "Initial memory " << mem.update().size() << " kB" << endl;
Info<< "Initial memory " << Foam::memInfo{}.size() << " kB" << endl;
#include "createNamedMeshes.H"
#include "createMeshAccounting.H"
@ -496,7 +495,7 @@ int main(int argc, char *argv[])
Info<< "Startup in "
<< timer.cpuTimeIncrement() << " s, "
<< mem.update().size() << " kB" << nl << endl;
<< Foam::memInfo{}.size() << " kB" << nl << endl;
forAll(timeDirs, timei)
@ -587,7 +586,7 @@ int main(int argc, char *argv[])
Info<< "Wrote in "
<< timer.cpuTimeIncrement() << " s, "
<< mem.update().size() << " kB" << nl << nl;
<< Foam::memInfo{}.size() << " kB" << nl << nl;
}
// Write cases
@ -606,7 +605,7 @@ int main(int argc, char *argv[])
Info<< "\nEnd: "
<< timer.elapsedCpuTime() << " s, "
<< mem.update().peak() << " kB (peak)" << nl << endl;
<< Foam::memInfo{}.peak() << " kB (peak)" << nl << endl;
return 0;
}

View File

@ -712,15 +712,14 @@ int main(int argc, char *argv[])
// ------------------------------------------------------------------------
cpuTime timer;
memInfo mem;
Info<< "Initial memory " << mem.update().size() << " kB" << endl;
Info<< "Initial memory " << Foam::memInfo{}.size() << " kB" << endl;
#include "createNamedMeshes.H"
#include "createMeshAccounting.H"
Info<< "VTK mesh topology: "
<< timer.cpuTimeIncrement() << " s, "
<< mem.update().size() << " kB" << endl;
<< Foam::memInfo{}.size() << " kB" << endl;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -860,13 +859,13 @@ int main(int argc, char *argv[])
Info<< "Wrote in "
<< timer.cpuTimeIncrement() << " s, "
<< mem.update().size() << " kB" << endl;
<< Foam::memInfo{}.size() << " kB" << endl;
}
Info<< "\nEnd: "
<< timer.elapsedCpuTime() << " s, "
<< mem.update().peak() << " kB (peak)\n" << endl;
<< Foam::memInfo{}.peak() << " kB (peak)\n" << endl;
return 0;
}