Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (f31105fd)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
System.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIKERNEL_SYSTEM_H
12 #define GAUDIKERNEL_SYSTEM_H
13 
14 // Framework include files
15 #include <GaudiKernel/Kernel.h>
16 // STL include files
17 #include <string>
18 #include <typeinfo>
19 #include <vector>
20 
21 #include <GaudiKernel/ModuleInfo.h>
22 #include <GaudiKernel/Timing.h>
23 
24 #ifdef __linux
25 # include <pthread.h>
26 # ifndef __APPLE__
27 # include <execinfo.h>
28 # endif
29 #endif
30 
39 namespace System {
41  typedef void* ImageHandle;
43  typedef void* ProcessHandle;
45  typedef unsigned long ( *EntryPoint )( const unsigned long iid, void** ppvObject );
47  typedef void* ( *Creator )();
49  GAUDI_API unsigned long loadDynamicLib( const std::string& name, ImageHandle* handle );
51  GAUDI_API unsigned long unloadDynamicLib( ImageHandle handle );
53  GAUDI_API unsigned long getProcedureByName( ImageHandle handle, const std::string& name, EntryPoint* pFunction );
55  GAUDI_API unsigned long getProcedureByName( ImageHandle handle, const std::string& name, Creator* pFunction );
57  GAUDI_API unsigned long getLastError();
61  GAUDI_API const std::string getErrorString( unsigned long error );
64  GAUDI_API const std::string typeinfoName( const char* );
68  GAUDI_API const std::string& osName();
74  // 0 = 80386 instruction set
75  // 1 or above = SSE (XMM) supported by CPU (not testing for O.S. support)
76  // 2 or above = SSE2
77  // 3 or above = SSE3
78  // 4 or above = Supplementary SSE3 (SSSE3)
79  // 5 or above = SSE4.1
80  // 6 or above = SSE4.2
81  // 7 or above = AVX supported by CPU and operating system
82  // 8 or above = AVX2
83  // 9 or above = AVX512F
90  GAUDI_API long argc();
94  GAUDI_API char** argv();
96  GAUDI_API std::string getEnv( const char* var );
99  GAUDI_API bool getEnv( const char* var, std::string& value );
100  inline bool getEnv( const std::string& var, std::string& value ) { return getEnv( var.c_str(), value ); }
108  GAUDI_API int setEnv( const std::string& name, const std::string& value, int overwrite = 1 );
110  GAUDI_API bool isEnvSet( const char* var );
111 #ifdef __linux
112  typedef pthread_t ThreadHandle;
115  inline ThreadHandle threadSelf() { return pthread_self(); }
116 #else
117  typedef void* ThreadHandle;
120  inline ThreadHandle threadSelf() { return (void*)0; }
121 #endif
122  GAUDI_API int backTrace( void** addresses, const int depth );
123  GAUDI_API bool backTrace( std::string& btrace, const int depth, const int offset = 0 );
124  GAUDI_API bool getStackLevel( void* addresses, void*& addr, std::string& fnc, std::string& lib );
125 } // namespace System
126 #endif // SYSTEM_SYSTEM_H
System::getErrorString
GAUDI_API const std::string getErrorString(unsigned long error)
Retrieve error code as string for a given error.
Definition: System.cpp:285
System::loadDynamicLib
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
Definition: System.cpp:150
std::string
STL class.
System::argc
GAUDI_API long argc()
Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call....
Definition: System.cpp:362
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:269
System::EntryPoint
unsigned long(* EntryPoint)(const unsigned long iid, void **ppvObject)
Definition of the "generic" DLL entry point function.
Definition: System.h:45
System::ThreadHandle
void * ThreadHandle
A Thread handle.
Definition: System.h:118
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:390
std::vector< std::string >
std::type_info
System::setEnv
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:503
System::instructionsetLevel
GAUDI_API int instructionsetLevel()
Instruction Set "Level".
Definition: System.cpp:343
System::ImageHandle
void * ImageHandle
Definition of an image handle.
Definition: ModuleInfo.h:40
System::getProcedureByName
GAUDI_API unsigned long getProcedureByName(ImageHandle handle, const std::string &name, EntryPoint *pFunction)
Get a specific function defined in the DLL.
Definition: System.cpp:218
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:315
System::getStackLevel
GAUDI_API bool getStackLevel(void *addresses, void *&addr, std::string &fnc, std::string &lib)
System::backTrace
GAUDI_API int backTrace(void **addresses, const int depth)
System::osName
GAUDI_API const std::string & osName()
OS name.
Definition: System.cpp:326
ModuleInfo.h
System::accountName
GAUDI_API const std::string & accountName()
User login name.
Definition: System.cpp:353
std::string::c_str
T c_str(T... args)
System::numCmdLineArgs
GAUDI_API long numCmdLineArgs()
Number of arguments passed to the commandline.
Definition: System.cpp:359
System::isEnvSet
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:410
Timing.h
System::Creator
void *(* Creator)()
Definition of the "generic" DLL entry point function.
Definition: System.h:47
System::unloadDynamicLib
GAUDI_API unsigned long unloadDynamicLib(ImageHandle handle)
unload dynamic link library
Definition: System.cpp:195
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
System::threadSelf
ThreadHandle threadSelf()
thread handle "accessor"
Definition: System.h:120
System::cmdLineArgs
GAUDI_API const std::vector< std::string > cmdLineArgs()
Command line arguments including executable name as arg[0] as vector of strings.
Definition: System.cpp:365
Kernel.h
System
Note: OS specific details for environment resolution.
Definition: Debugger.h:29
System::machineType
GAUDI_API const std::string & machineType()
Machine type.
Definition: System.cpp:338
System::ProcessHandle
void * ProcessHandle
Definition of the process handle.
Definition: ModuleInfo.h:42
System::hostName
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:320
System::getLastErrorString
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
Definition: System.cpp:279
System::osVersion
GAUDI_API const std::string & osVersion()
OS version.
Definition: System.cpp:332
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
System::argv
GAUDI_API char ** argv()
char** command line arguments including executable name as arg[0]; You may not modify them!
Definition: System.cpp:371