|
||||
File indexing completed on 2025-01-18 09:57:44
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 #ifndef GAUDIKERNEL_SYSTEM_H 0012 #define GAUDIKERNEL_SYSTEM_H 0013 0014 // Framework include files 0015 #include "GaudiKernel/Kernel.h" 0016 // STL include files 0017 #include <string> 0018 #include <typeinfo> 0019 #include <vector> 0020 0021 #include "GaudiKernel/ModuleInfo.h" 0022 #include "GaudiKernel/Timing.h" 0023 0024 #ifdef __linux 0025 # include <pthread.h> 0026 # ifndef __APPLE__ 0027 # include <execinfo.h> 0028 # endif 0029 #endif 0030 0031 /** Note: OS specific details as well as Gaudi details may not occur 0032 in this definition file, because this header is the used by both, the 0033 OS specific implementations and the gaudi specific implementation. 0034 Since e.g. IID is defined in both, this would lead automatically to 0035 complete comilation failures..... 0036 0037 @author M.Frank 0038 */ 0039 namespace System { 0040 /// Definition of an image handle 0041 typedef void* ImageHandle; 0042 /// Definition of the process handle 0043 typedef void* ProcessHandle; 0044 /// Definition of the "generic" DLL entry point function 0045 typedef unsigned long ( *EntryPoint )( const unsigned long iid, void** ppvObject ); 0046 /// Definition of the "generic" DLL entry point function 0047 typedef void* ( *Creator )(); 0048 /// Load dynamic link library 0049 GAUDI_API unsigned long loadDynamicLib( const std::string& name, ImageHandle* handle ); 0050 /// unload dynamic link library 0051 GAUDI_API unsigned long unloadDynamicLib( ImageHandle handle ); 0052 /// Get a specific function defined in the DLL 0053 GAUDI_API unsigned long getProcedureByName( ImageHandle handle, const std::string& name, EntryPoint* pFunction ); 0054 /// Get a specific function defined in the DLL 0055 GAUDI_API unsigned long getProcedureByName( ImageHandle handle, const std::string& name, Creator* pFunction ); 0056 /// Get last system known error 0057 GAUDI_API unsigned long getLastError(); 0058 /// Get last system error as string 0059 GAUDI_API const std::string getLastErrorString(); 0060 /// Retrieve error code as string for a given error 0061 GAUDI_API const std::string getErrorString( unsigned long error ); 0062 /// Get platform independent information about the class type 0063 GAUDI_API const std::string typeinfoName( const std::type_info& ); 0064 GAUDI_API const std::string typeinfoName( const char* ); 0065 /// Host name 0066 GAUDI_API const std::string& hostName(); 0067 /// OS name 0068 GAUDI_API const std::string& osName(); 0069 /// OS version 0070 GAUDI_API const std::string& osVersion(); 0071 /// Machine type 0072 GAUDI_API const std::string& machineType(); 0073 /// Instruction Set "Level" 0074 // 0 = 80386 instruction set 0075 // 1 or above = SSE (XMM) supported by CPU (not testing for O.S. support) 0076 // 2 or above = SSE2 0077 // 3 or above = SSE3 0078 // 4 or above = Supplementary SSE3 (SSSE3) 0079 // 5 or above = SSE4.1 0080 // 6 or above = SSE4.2 0081 // 7 or above = AVX supported by CPU and operating system 0082 // 8 or above = AVX2 0083 // 9 or above = AVX512F 0084 GAUDI_API int instructionsetLevel(); 0085 /// User login name 0086 GAUDI_API const std::string& accountName(); 0087 /// Number of arguments passed to the commandline 0088 GAUDI_API long numCmdLineArgs(); 0089 /// Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call... 0090 GAUDI_API long argc(); 0091 /// Command line arguments including executable name as arg[0] as vector of strings 0092 GAUDI_API const std::vector<std::string> cmdLineArgs(); 0093 /// char** command line arguments including executable name as arg[0]; You may not modify them! 0094 GAUDI_API char** argv(); 0095 /// get a particular environment variable (returning "UNKNOWN" if not set) 0096 GAUDI_API std::string getEnv( const char* var ); 0097 /// get a particular environment variable, storing the value in the passed string if the 0098 /// variable is set. Returns true if the variable is set, false otherwise. 0099 GAUDI_API bool getEnv( const char* var, std::string& value ); 0100 inline bool getEnv( const std::string& var, std::string& value ) { return getEnv( var.c_str(), value ); } 0101 /// get all environment variables 0102 GAUDI_API std::vector<std::string> getEnv(); 0103 /// Set an environment variables. 0104 /// If value is empty, the variable is removed from the environment. 0105 /// When overwrite is 0, the variable is not set if already present. 0106 /// Returns 0 on success, -1 on failure. 0107 /// See man 3 setenv. 0108 GAUDI_API int setEnv( const std::string& name, const std::string& value, int overwrite = 1 ); 0109 /// Check if an environment variable is set or not. 0110 GAUDI_API bool isEnvSet( const char* var ); 0111 #ifdef __linux 0112 /// A Thread handle 0113 typedef pthread_t ThreadHandle; 0114 /// thread handle "accessor" 0115 inline ThreadHandle threadSelf() { return pthread_self(); } 0116 #else 0117 /// A Thread handle 0118 typedef void* ThreadHandle; 0119 /// thread handle "accessor" 0120 inline ThreadHandle threadSelf() { return (void*)0; } 0121 #endif 0122 GAUDI_API int backTrace( void** addresses, const int depth ); 0123 GAUDI_API bool backTrace( std::string& btrace, const int depth, const int offset = 0 ); 0124 GAUDI_API bool getStackLevel( void* addresses, void*& addr, std::string& fnc, std::string& lib ); 0125 } // namespace System 0126 #endif // SYSTEM_SYSTEM_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |