profilingSysInfo.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "profilingSysInfo.H"
29#include "foamVersion.H"
30#include "clock.H"
31#include "Ostream.H"
32#include "OSspecific.H"
33
34// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
35
36namespace
37{
38
39// Write environment entry
40inline void printEnv
41(
43 const Foam::word& key,
44 const std::string& envName
45)
46{
47 const std::string value(Foam::getEnv(envName));
48 if (!value.empty())
49 {
50 os.writeEntry(key, value);
51 }
52}
53
54} // End anonymous namespace
55
56
57// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
58
60(
61 Ostream& os
62) const
63{
64 os.writeEntry("host", Foam::hostName()); // short name
66
67 // compile-time information
70
71 printEnv(os, "arch", "WM_ARCH");
72 printEnv(os, "compilerType", "WM_COMPILER_TYPE");
73 printEnv(os, "compiler", "WM_COMPILER");
74 printEnv(os, "mplib", "WM_MPLIB");
75 printEnv(os, "options", "WM_OPTIONS");
76
77 return os;
78}
79
80
81// ************************************************************************* //
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:239
static std::string dateTime()
Definition: clock.C:60
virtual bool write()
Write the output fields.
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
const std::string build
OpenFOAM build information as a std::string.
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
string getEnv(const std::string &envName)
Get environment value for given envName.
Definition: MSwindows.C:371
string hostName()
Return the system's host name, as per hostname(1)
Definition: MSwindows.C:410