| The Gaudi Framework v32r1 (f65d50dc)

Namespaces | Classes | Typedefs | Enumerations | Functions
System Namespace Reference

Note: OS specific details for environment resolution. More...

## Namespaces
| Linux
| Namespace holding Linux specific functions.
| MacOS
| Namespace holding MacOS specific functions.
| Win32
| Namespace holding Windows specific functions.

## Classes
struct | IO_COUNTERS
| Process I/O Counters NtQueryInformationProcess using ProcessIoCounters. More...
struct | KERNEL_USER_TIMES
| Process/Thread System and User Time NtQueryInformationProcess using ProcessTimes NtQueryInformationThread using ThreadTimes. More...
class | PathResolver
struct | POOLED_USAGE_AND_LIMITS
| Process Pooled Quota Usage and Limits NtQueryInformationProcess using ProcessPooledUsageAndLimits. More...
struct | PROCESS_BASIC_INFORMATION
class | ProcessDescriptor
| Provides access to process information. More...
class | ProcessTime
| Simple class to hold the time information of a process. More...
struct | QUOTA_LIMITS
| Process Quotas NtQueryInformationProcess using ProcessQuotaLimits NtQueryInformationProcess using ProcessPooledQuotaLimits NtSetInformationProcess using ProcessQuotaLimits. More...
struct | VM_COUNTERS
| Process Virtual Memory Counters NtQueryInformationProcess using ProcessVmCounters. More...

## Typedefs
typedef void * | ImageHandle
| Definition of an image handle. More...
typedef void * | ProcessHandle
| Definition of the process handle. More...
typedef unsigned long(* | EntryPoint) (const unsigned long iid, void **ppvObject)
| Definition of the "generic" DLL entry point function. More...
typedef void *(* | Creator) ()
| Definition of the "generic" DLL entry point function. More...
typedef void * | ThreadHandle
| A Thread handle. More...
typedef struct _PEB * | PPEB
| Basic Process Information NtQueryInformationProcess using ProcessBasicInfo. More...

## Enumerations
enum | MemoryUnit { Byte, kByte, MByte, GByte, TByte, PByte, EByte }
| Unit of memory. More...
enum | ModuleType { UNKNOWN, SHAREDLIB, EXECUTABLE }
enum | InfoType { NoFetch, RemainTime, Times, ProcessBasics, PriorityBoost, Memory, Quota, System, Modules, IO }
| Enumeration for fetching information. More...
enum | TimeType { Year, Month, Day, Hour, Min, Sec, milliSec, microSec, nanoSec, Native }
| Time type for conversion. More...
enum | PR_file_type { PR_regular_file, PR_directory }
enum | PR_search_type { PR_local, PR_recursive }
enum | ProcessInfoCommand { ProcessBasicInformation, ProcessQuotaLimits, ProcessIoCounters, ProcessVmCounters, ProcessTimes, ProcessBasePriority, ProcessRaisePriority, ProcessDebugPort, ProcessExceptionPort, ProcessAccessToken, ProcessLdtInformation, ProcessLdtSize, ProcessDefaultHardErrorMode, ProcessIoPortHandlers, ProcessPooledUsageAndLimits, ProcessWorkingSetWatch, ProcessUserModeIOPL, ProcessEnableAlignmentFaultFixup, ProcessPriorityClass, ProcessWx86Information, ProcessHandleCount, ProcessAffinityMask, ProcessPriorityBoost, MaxProcessInfoClass, ProcessEllapsedTime }

## Functions
GAUDI_API long | breakExecution ()
| Break the execution of the application and invoke the debugger. More...
GAUDI_API long | breakExecution (long pid)
| Break the execution of the application and invoke the debugger in a remote process. More...
GAUDI_API std::string | homeDirectory ()
GAUDI_API std::string | tempDirectory ()
GAUDI_API StatusCode | resolveEnv (const std::string &var, std::string &res, int recusions=124)
GAUDI_API long | adjustMemory (MemoryUnit typ, long value)
| Convert time from kByte to requested representation (Experts only) More...
GAUDI_API long | procID ()
| Basic Process Information: Process ID. More...
GAUDI_API long | parentID (InfoType fetch=ProcessBasics, long pid=-1)
| Basic Process Information: Parent's process ID. More...
GAUDI_API long | affinityMask (InfoType fetch=ProcessBasics, long pid=-1)
| Basic Process Information: Affinity mask. More...
GAUDI_API long | exitStatus (InfoType fetch=ProcessBasics, long pid=-1)
| Basic Process Information: Exit status (does not really make sense for the running process, but for others!) More...
GAUDI_API long | basePriority (InfoType fetch=ProcessBasics, long pid=-1)
| Basic Process Information: Base priority. More...
GAUDI_API long | priorityBoost (InfoType fetch=PriorityBoost, long pid=-1)
| Basic Process Information: priority boost. More...
GAUDI_API long | numPageFault (InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Number of page faults. More...
GAUDI_API long | pagefileUsage (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Current page file usage. More...
GAUDI_API long | pagefileUsagePeak (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Peak usage of page file. More...
GAUDI_API long | pagefileUsageLimit (MemoryUnit unit=kByte, InfoType fetch=Quota, long pid=-1)
| Basic Process Information: Peak usage of page file. More...
GAUDI_API long | nonPagedMemory (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Current usage of non paged memory. More...
GAUDI_API long | nonPagedMemoryPeak (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Peak usage of non paged memory. More...
GAUDI_API long | nonPagedMemoryLimit (MemoryUnit unit=kByte, InfoType fetch=Quota, long pid=-1)
| System Process Limits: Maximum amount of non-paged memory this process is allowed to use. More...
GAUDI_API long | pagedMemory (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Amount of paged memory currently occupied by the process 'pid'. More...
GAUDI_API long | pagedMemoryPeak (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Maximum of paged memory occupied by the process 'pid'. More...
GAUDI_API long | pagedMemoryLimit (MemoryUnit unit=kByte, InfoType fetch=Quota, long pid=-1)
| Basic Process Information: Amount of paged memory that can be occupied by the process 'pid'. More...
GAUDI_API long | minMemoryLimit (MemoryUnit unit=kByte, InfoType fetch=Quota, long pid=-1)
| System Process Limits: Minimum amount of virtual memory this process may use. More...
GAUDI_API long | maxMemoryLimit (MemoryUnit unit=kByte, InfoType fetch=Quota, long pid=-1)
| System Process Limits: Maximum amount of virtual memory this process is allowed to use. More...
GAUDI_API long | mappedMemory (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: priority boost. More...
GAUDI_API long | mappedMemoryPeak (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: priority boost. More...
GAUDI_API long | virtualMemory (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: priority boost. More...
GAUDI_API long | virtualMemoryPeak (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: priority boost. More...
GAUDI_API long | virtualMemoryLimit (MemoryUnit unit=kByte, InfoType fetch=Quota, long pid=-1)
| System Process Limits: Maximum amount of the page file this process is allowed to use. More...
GAUDI_API const std::string & | moduleName ()
| Get the name of the (executable/DLL) file without file-type. More...
GAUDI_API const std::string & | moduleNameFull ()
| Get the full name of the (executable/DLL) file. More...
GAUDI_API ModuleType | moduleType ()
| Get type of the module. More...
GAUDI_API ProcessHandle | processHandle ()
| Handle to running process. More...
GAUDI_API ImageHandle | moduleHandle ()
| Handle to currently executed module. More...
GAUDI_API ImageHandle | exeHandle ()
| Handle to the executable file running. More...
GAUDI_API const std::string & | exeName ()
| Name of the executable file running. More...
GAUDI_API const std::vector< std::string > | linkedModules ()
| Vector of names of linked modules. More...
GAUDI_API void | setModuleHandle (ImageHandle handle)
| Attach module handle. More...
GAUDI_API std::string | PathResolverFindXMLFile (const std::string &logical_file_name)
GAUDI_API std::string | PathResolverFindDataFile (const std::string &logical_file_name)
GAUDI_API unsigned long | loadDynamicLib (const std::string &name, ImageHandle *handle)
| Load dynamic link library. More...
GAUDI_API unsigned long | unloadDynamicLib (ImageHandle handle)
| unload dynamic link library More...
GAUDI_API unsigned long | getProcedureByName (ImageHandle handle, const std::string &name, EntryPoint *pFunction)
| Get a specific function defined in the DLL. More...
GAUDI_API unsigned long | getProcedureByName (ImageHandle handle, const std::string &name, Creator *pFunction)
| Get a specific function defined in the DLL. More...
GAUDI_API unsigned long | getLastError ()
| Get last system known error. More...
GAUDI_API const std::string | getLastErrorString ()
| Get last system error as string. More...
GAUDI_API const std::string | getErrorString (unsigned long error)
| Retrieve error code as string for a given error. More...
GAUDI_API const std::string | typeinfoName (const std::type_info &)
| Get platform independent information about the class type. More...
GAUDI_API const std::string | typeinfoName (const char *)
| Get the human readable type name from a typeinfo name. More...
GAUDI_API const std::string & | hostName ()
| Host name. More...
GAUDI_API const std::string & | osName ()
| OS name. More...
GAUDI_API const std::string & | osVersion ()
| OS version. More...
GAUDI_API const std::string & | machineType ()
| Machine type. More...
GAUDI_API int | instructionsetLevel ()
| Instruction Set "Level". More...
GAUDI_API const std::string & | accountName ()
| User login name. More...
GAUDI_API long | numCmdLineArgs ()
| Number of arguments passed to the commandline. More...
GAUDI_API long | argc ()
| Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call... More...
GAUDI_API const std::vector< std::string > | cmdLineArgs ()
| Command line arguments including executable name as arg[0] as vector of strings. More...
GAUDI_API char ** | argv ()
| char** command line arguments including executable name as arg[0]; You may not modify them! More...
GAUDI_API std::string | getEnv (const char *var)
| get a particular environment variable (returning "UNKNOWN" if not set) More...
GAUDI_API bool | getEnv (const char *var, std::string &value)
| get a particular environment variable, storing the value in the passed string if the variable is set. More...
bool | getEnv (const std::string &var, std::string &value)
GAUDI_API std::vector< std::string > | getEnv ()
| get all environment variables More...
GAUDI_API int | setEnv (const std::string &name, const std::string &value, int overwrite=1)
| Set an environment variables. More...
GAUDI_API bool | isEnvSet (const char *var)
| Check if an environment variable is set or not. More...
ThreadHandle | threadSelf ()
| thread handle "accessor" More...
GAUDI_API int | backTrace (void **addresses, const int depth)
GAUDI_API bool | backTrace (std::string &btrace, const int depth, const int offset=0)
GAUDI_API bool | getStackLevel (void *addresses, void *&addr, std::string &fnc, std::string &lib)
GAUDI_API long long | adjustTime (TimeType typ, long long timevalue)
| Convert time from OS native time to requested representation (Experts only) More...
template<TimeType T>
long long | adjustTime (long long timevalue)
| Convert the time from OS native time to requested representation (Experts only) More...
GAUDI_API long long | ellapsedTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| Elapsed time since start of process in milliseconds. More...
GAUDI_API long long | kernelTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| CPU kernel mode time of process in milliseconds. More...
GAUDI_API long long | userTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| CPU user mode time of process in milliseconds. More...
GAUDI_API long long | cpuTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| Consumed CPU time of process in milliseconds. More...
GAUDI_API long long | remainingTime (TimeType typ=milliSec, InfoType fetch=Quota, long pid=-1)
| Maximum processing time left for this process. More...
GAUDI_API long long | creationTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| Process Creation time. More...
GAUDI_API long long | systemStart (TimeType typ=Sec)
| Maximum processing time left for this process. More...
GAUDI_API long long | upTime (TimeType typ=Hour)
| Maximum processing time left for this process. More...
template<TimeType T>
GAUDI_API long long | currentTime ()
| Retrieve absolute system time. More...
GAUDI_API long long | currentTime (TimeType typ=milliSec)
| Get current time in specificed units. More...
GAUDI_API long long | tickCount ()
| Retrieve the number of ticks since system startup. More...
GAUDI_API ProcessTime | getProcessTime (long pid=-1)
| Retrieve the process time data for a process. More...
template<>
long long | adjustTime< Year > (long long t)
template<>
long long | adjustTime< Day > (long long t)
template<>
long long | adjustTime< Hour > (long long t)
template<>
long long | adjustTime< Min > (long long t)
template<>
long long | adjustTime< Sec > (long long t)
template<>
long long | adjustTime< milliSec > (long long t)
template<>
long long | adjustTime< microSec > (long long t)
template<>
long long | adjustTime< nanoSec > (long long t)
template<>
long long | adjustTime< Month > (long long t)
template<>
long long | adjustTime< Native > (long long t)
template<TimeType T>
long long | currentTime ()
| Retrieve absolute system time. More...
template long long | currentTime< Year > ()
template long long | currentTime< Month > ()
template long long | currentTime< Day > ()
template long long | currentTime< Hour > ()
template long long | currentTime< Min > ()
template long long | currentTime< Sec > ()
template long long | currentTime< milliSec > ()
template long long | currentTime< microSec > ()
template long long | currentTime< nanoSec > ()
template long long | currentTime< Native > ()
ProcessDescriptor * | getProcess ()
| Retrieve Process structure. More...

## Detailed Description

Note: OS specific details for environment resolution.

Note: OS specific details for process timing.

Note: OS specific details as well as Gaudi details may not occur in this definition file, because this header is the used by both, the OS specific implementations and the gaudi specific implementation.

ModuleInfo: OS specific details to access at run-time the module configuration of the process.

Note: OS specific details for memory usage.

Entrypoints:

Author
  : M.Frank

Version
  : 1.0

Entrypoints:

- basePriority Base priority
- procID Process ID
- parentID Parent's process ID
- affinityMask Affinity mask
- exitStatus Exit status
- priorityBoost Priority boost
- numPageFault Number of page faults
- pagefileUsage Current page file usage
- pagefileUsagePeak Peak usage of page file
- nonPagedMemory Current usage of non paged memory
- nonPagedMemoryPeak Peak usage of non paged memory
- nonPagedMemoryLimit Maximum amount of non-paged memory this process is allowed to use
- pagedMemory Amount of paged memory currently occupied
- pagedMemoryPeak Maximum of paged memory occupied by the process
- pagedMemoryLimit paged memory that can be occupied by the process
- memorySize Size of currently occupied memory
- memorySizePeak Maximum memory occupied by the process
- memoryLimit Amount of memory that can be occupied by the process
- virtualMemorySize Virtual memory size currenly occupied
- peakVirtualMemorySize Maximum amount of virtual memory occupied
- virtualMemoryLimit Amount of virtual memory that can be occupied by the process
- minMemoryLimit Minimum amount of virtual memory this process may use
- maxMemoryLimit Maximum amount of virtual memory this process is allowed to use
- mappedMemorySize Currenly mapped virtual memory size
- mappedMemorySizePeak Peak mapped virtual memory size

Author
  : M.Frank

Version
  : 1.0

M.Frank

Since e.g. IID is defined in both, this would lead automatically to complete comilation failures.....

Author
  M.Frank

Entrypoints:

- remainingTime returns the time the process could still execute
- ellapsedTime: returns elapsed time since program start
- kernelTime: returns the amount of time the process has spent in kernel mode
- userTime: returns the amount of time the process has spent in user mode
- cpuTime: returns kernel+user time

On Windows NT Time is expressed as the amount of time that has elapsed since midnight on January 1, 1601 at Greenwich, England.

On Unix time is expressed as the amount of time that has elapsed since midnight on January 1, 1970 at Greenwich, England.

History :

    +---------+----------------------------------------------+--------+
    |    Date |                 Comment                      | Who    |
    +---------+----------------------------------------------+--------+
    | 11/11/00| Initial version.                             | MF     |
    +---------+----------------------------------------------+--------+

Author
  : M.Frank

Version
  : 1.0

## Typedef Documentation

## ◆ Creator

typedef void*( * System::Creator) ()

Definition of the "generic" DLL entry point function.

Definition at line 37 of file System.h.

## ◆ EntryPoint

typedef unsigned long( * System::EntryPoint) (const unsigned long iid, void **ppvObject)

Definition of the "generic" DLL entry point function.

Definition at line 35 of file System.h.

## ◆ ImageHandle

typedef void * System::ImageHandle

Definition of an image handle.

Definition at line 30 of file ModuleInfo.h.

## ◆ PPEB

typedef struct _PEB* System::PPEB

Basic Process Information NtQueryInformationProcess using ProcessBasicInfo.

Definition at line 17 of file ProcessDescriptor.h.

## ◆ ProcessHandle

typedef void * System::ProcessHandle

Definition of the process handle.

Definition at line 32 of file ModuleInfo.h.

## ◆ ThreadHandle

typedef void* System::ThreadHandle

A Thread handle.

Definition at line 108 of file System.h.

## Enumeration Type Documentation

## ◆ InfoType

enum System::InfoType

Enumeration for fetching information.

Enumerator
NoFetch |
RemainTime |
Times |
ProcessBasics |
PriorityBoost |
Memory |
Quota |
System |
Modules |
IO |

Definition at line 18 of file SystemBase.h.

18 { NoFetch, RemainTime, Times, ProcessBasics, PriorityBoost, Memory, Quota, System, Modules, IO };
System::RemainTime
Definition: SystemBase.h:18
System::Memory
Definition: SystemBase.h:18
System::Times
Definition: SystemBase.h:18
System::Quota
Definition: SystemBase.h:18
System::Modules
Definition: SystemBase.h:18
System::NoFetch
Definition: SystemBase.h:18
System::IO
Definition: SystemBase.h:18
System::System
Definition: SystemBase.h:18
System::ProcessBasics
Definition: SystemBase.h:18
System::PriorityBoost
Definition: SystemBase.h:18

## ◆ MemoryUnit

enum System::MemoryUnit

Unit of memory.

Enumerator
Byte |
kByte |
MByte |
GByte |
TByte |
PByte |
EByte |

Definition at line 55 of file Memory.h.

55 { Byte, kByte, MByte, GByte, TByte, PByte, EByte };
System::TByte
Definition: Memory.h:55
System::PByte
Definition: Memory.h:55
System::MByte
Definition: Memory.h:55
System::GByte
Definition: Memory.h:55
System::kByte
Definition: Memory.h:55
System::Byte
Definition: Memory.h:55
System::EByte
Definition: Memory.h:55

## ◆ ModuleType

enum System::ModuleType

Enumerator
UNKNOWN |
SHAREDLIB |
EXECUTABLE |

Definition at line 28 of file ModuleInfo.h.

28 { UNKNOWN, SHAREDLIB, EXECUTABLE };
System::SHAREDLIB
Definition: ModuleInfo.h:28
System::UNKNOWN
Definition: ModuleInfo.h:28
System::EXECUTABLE
Definition: ModuleInfo.h:28

## ◆ PR_file_type

enum System::PR_file_type

Enumerator
PR_regular_file |
PR_directory |

Definition at line 35 of file PathResolver.cpp.

35 { PR_regular_file, PR_directory } PR_file_type;
System::PR_directory
Definition: PathResolver.cpp:35
System::PR_file_type
PR_file_type
Definition: PathResolver.cpp:35
System::PR_regular_file
Definition: PathResolver.cpp:35

## ◆ PR_search_type

enum System::PR_search_type

Enumerator
PR_local |
PR_recursive |

Definition at line 37 of file PathResolver.cpp.

37 { PR_local, PR_recursive } PR_search_type;
System::PR_local
Definition: PathResolver.cpp:37
System::PR_recursive
Definition: PathResolver.cpp:37
System::PR_search_type
PR_search_type
Definition: PathResolver.cpp:37

## ◆ ProcessInfoCommand

enum System::ProcessInfoCommand

Enumerator
ProcessBasicInformation |
ProcessQuotaLimits |
ProcessIoCounters |
ProcessVmCounters |
ProcessTimes |
ProcessBasePriority |
ProcessRaisePriority |
ProcessDebugPort |
ProcessExceptionPort |
ProcessAccessToken |
ProcessLdtInformation |
ProcessLdtSize |
ProcessDefaultHardErrorMode |
ProcessIoPortHandlers |
ProcessPooledUsageAndLimits |
ProcessWorkingSetWatch |
ProcessUserModeIOPL |
ProcessEnableAlignmentFaultFixup |
ProcessPriorityClass |
ProcessWx86Information |
ProcessHandleCount |
ProcessAffinityMask |
ProcessPriorityBoost |
MaxProcessInfoClass |
ProcessEllapsedTime |

Definition at line 22 of file ProcessDescriptor.cpp.

22 {
23 ProcessBasicInformation,
24 ProcessQuotaLimits,
25 ProcessIoCounters,
26 ProcessVmCounters,
27 ProcessTimes,
28 ProcessBasePriority,
29 ProcessRaisePriority,
30 ProcessDebugPort,
31 ProcessExceptionPort,
32 ProcessAccessToken,
33 ProcessLdtInformation,
34 ProcessLdtSize,
35 ProcessDefaultHardErrorMode,
36 ProcessIoPortHandlers, // Note: this is kernel mode only
37 ProcessPooledUsageAndLimits,
38 ProcessWorkingSetWatch,
39 ProcessUserModeIOPL,
40 ProcessEnableAlignmentFaultFixup,
41 ProcessPriorityClass,
42 ProcessWx86Information,
43 ProcessHandleCount,
44 ProcessAffinityMask,
45 ProcessPriorityBoost,
46 MaxProcessInfoClass, //
47 ProcessEllapsedTime
48 };
System::ProcessDebugPort
Definition: ProcessDescriptor.cpp:30
System::ProcessIoPortHandlers
Definition: ProcessDescriptor.cpp:36
System::ProcessWx86Information
Definition: ProcessDescriptor.cpp:42
System::ProcessUserModeIOPL
Definition: ProcessDescriptor.cpp:39
System::ProcessBasicInformation
Definition: ProcessDescriptor.cpp:23
System::ProcessEllapsedTime
Definition: ProcessDescriptor.cpp:47
System::ProcessAccessToken
Definition: ProcessDescriptor.cpp:32
System::ProcessPriorityClass
Definition: ProcessDescriptor.cpp:41
System::ProcessHandleCount
Definition: ProcessDescriptor.cpp:43
System::ProcessLdtSize
Definition: ProcessDescriptor.cpp:34
System::ProcessBasePriority
Definition: ProcessDescriptor.cpp:28
System::ProcessLdtInformation
Definition: ProcessDescriptor.cpp:33
System::ProcessIoCounters
Definition: ProcessDescriptor.cpp:25
System::MaxProcessInfoClass
Definition: ProcessDescriptor.cpp:46
System::ProcessQuotaLimits
Definition: ProcessDescriptor.cpp:24
System::ProcessPriorityBoost
Definition: ProcessDescriptor.cpp:45
System::ProcessExceptionPort
Definition: ProcessDescriptor.cpp:31
System::ProcessWorkingSetWatch
Definition: ProcessDescriptor.cpp:38
System::ProcessAffinityMask
Definition: ProcessDescriptor.cpp:44
System::ProcessEnableAlignmentFaultFixup
Definition: ProcessDescriptor.cpp:40
System::ProcessRaisePriority
Definition: ProcessDescriptor.cpp:29
System::ProcessDefaultHardErrorMode
Definition: ProcessDescriptor.cpp:35
System::ProcessTimes
Definition: ProcessDescriptor.cpp:27
System::ProcessPooledUsageAndLimits
Definition: ProcessDescriptor.cpp:37
System::ProcessVmCounters
Definition: ProcessDescriptor.cpp:26

## ◆ TimeType

enum System::TimeType

Time type for conversion.

Enumerator
Year |
Month |
Day |
Hour |
Min |
Sec |
milliSec |
microSec |
nanoSec |
Native |

Definition at line 57 of file Timing.h.

57 { Year, Month, Day, Hour, Min, Sec, milliSec, microSec, nanoSec, Native };
System::Min
Definition: Timing.h:57
System::Hour
Definition: Timing.h:57
System::milliSec
Definition: Timing.h:57
System::Sec
Definition: Timing.h:57
System::microSec
Definition: Timing.h:57
System::Native
Definition: Timing.h:57
System::Month
Definition: Timing.h:57
System::nanoSec
Definition: Timing.h:57
System::Year
Definition: Timing.h:57
System::Day
Definition: Timing.h:57

## Function Documentation

## ◆ accountName()

const std::string & System::accountName | ( |  | ) |

User login name.

User login name.

Definition at line 332 of file System.cpp.

332 {
333 static const std::string account = Platform::accountName();
334 return account;
335 }
System::accountName
GAUDI_API const std::string & accountName()
User login name.
Definition: System.cpp:332
std::string
STL class.

## ◆ adjustMemory()

long System::adjustMemory | ( | MemoryUnit | typ,
|  | long | value
| ) |  |

Convert time from kByte to requested representation (Experts only)

Convert requested memory value from kByte to requested value.

Definition at line 34 of file Memory.cpp.

34 {
35 if ( value != -1 ) {
36 switch ( unit ) {
37 case Byte:
38 break;
39 case kByte:
40 value = value / 1024;
41 break;
42 case MByte:
43 value = ( value / 1024 ) / 1024;
44 break;
45 case GByte:
46 value = ( ( value / 1024 ) / 1024 ) / 1024;
47 break;
48 case TByte:
49 value = ( ( ( value / 1024 ) / 1024 ) / 1024 ) / 1024;
50 break;
51 case PByte:
52 value = ( ( ( ( value / 1024 ) / 1024 ) / 1024 ) / 1024 ) / 1024;
53 break;
54 case EByte:
55 value = ( ( ( ( ( value / 1024 ) / 1024 ) / 1024 ) / 1024 ) / 1024 ) / 1024;
56 break;
57 default:
58 value = -1;
59 break;
60 }
61 }
62 return value;
63 }
System::TByte
Definition: Memory.h:55
System::PByte
Definition: Memory.h:55
System::MByte
Definition: Memory.h:55
System::GByte
Definition: Memory.h:55
System::kByte
Definition: Memory.h:55
System::Byte
Definition: Memory.h:55
System::EByte
Definition: Memory.h:55

## ◆ adjustTime() [1/2]

long long System::adjustTime | ( | TimeType | typ,
|  | long long | timevalue
| ) |  |

Convert time from OS native time to requested representation (Experts only)

unfortunately "-ansi" flag turn off the correct definition of CLK_TCK and forces it to be equal CLOCKS_PER_SEC, it is wrong!

t /= CLOCKS_PER_SEC; // needs division by clock tick unit

Definition at line 37 of file Timing.cpp.

37 {
38 if ( t != -1 ) {
39 #ifndef _WIN32
40 // t /= CLK_TCK ; // needs division by clock tick unit
45
47 #endif
48 switch ( typ ) {
49 case Year:
50 return adjustTime<Year>( t );
51 case Month:
52 return adjustTime<Month>( t );
53 case Day:
54 return adjustTime<Day>( t );
55 case Hour:
56 return adjustTime<Hour>( t );
57 case Min:
58 return adjustTime<Min>( t );
59 case Sec:
60 return adjustTime<Sec>( t );
61 case milliSec:
62 return adjustTime<milliSec>( t );
63 case microSec:
64 return adjustTime<microSec>( t );
65 case nanoSec:
66 return adjustTime<nanoSec>( t );
67 case Native:
68 return adjustTime<Native>( t );
69 default:
70 return t;
71 }
72 }
73 return t;
74 }
System::Min
Definition: Timing.h:57
System::adjustTime< Native >
long long adjustTime< Native >(long long t)
Definition: Timing.h:244
System::Hour
Definition: Timing.h:57
System::adjustTime< Month >
long long adjustTime< Month >(long long t)
Definition: Timing.h:240
System::milliSec
Definition: Timing.h:57
System::Sec
Definition: Timing.h:57
System::adjustTime< nanoSec >
long long adjustTime< nanoSec >(long long t)
Definition: Timing.h:236
System::microSec
Definition: Timing.h:57
System::adjustTime< Day >
long long adjustTime< Day >(long long t)
Definition: Timing.h:212
System::Native
Definition: Timing.h:57
System::adjustTime< milliSec >
long long adjustTime< milliSec >(long long t)
Definition: Timing.h:228
System::adjustTime< Year >
long long adjustTime< Year >(long long t)
Definition: Timing.h:208
System::adjustTime< microSec >
long long adjustTime< microSec >(long long t)
Definition: Timing.h:232
System::adjustTime< Min >
long long adjustTime< Min >(long long t)
Definition: Timing.h:220
System::Month
Definition: Timing.h:57
System::nanoSec
Definition: Timing.h:57
System::adjustTime< Hour >
long long adjustTime< Hour >(long long t)
Definition: Timing.h:216
System::Year
Definition: Timing.h:57
System::adjustTime< Sec >
long long adjustTime< Sec >(long long t)
Definition: Timing.h:224
System::Day
Definition: Timing.h:57

## ◆ adjustTime() [2/2]

template<TimeType T>

long long System::adjustTime | ( | long long | timevalue | ) |
| inline

Convert the time from OS native time to requested representation (Experts only)

## ◆ adjustTime< Day >()

template<>

long long System::adjustTime< Day > | ( | long long | t | ) |
| inline

Definition at line 212 of file Timing.h.

212 {
213 return ( t == -1 ) ? t : t /= ( 1LL * 24 * 60 * 60 * 1000 * 1000 * 10 );
214 }

## ◆ adjustTime< Hour >()

template<>

long long System::adjustTime< Hour > | ( | long long | t | ) |
| inline

Definition at line 216 of file Timing.h.

216 {
217 return ( t == -1 ) ? t : t /= ( 1LL * 60 * 60 * 1000 * 1000 * 10 );
218 }

## ◆ adjustTime< microSec >()

template<>

long long System::adjustTime< microSec > | ( | long long | t | ) |
| inline

Definition at line 232 of file Timing.h.

232 {
233 return ( t == -1 ) ? t : t /= ( 10LL );
234 }

## ◆ adjustTime< milliSec >()

template<>

long long System::adjustTime< milliSec > | ( | long long | t | ) |
| inline

Definition at line 228 of file Timing.h.

228 {
229 return ( t == -1 ) ? t : t /= ( 1000 * 10 );
230 }

## ◆ adjustTime< Min >()

template<>

long long System::adjustTime< Min > | ( | long long | t | ) |
| inline

Definition at line 220 of file Timing.h.

220 {
221 return ( t == -1 ) ? t : t /= ( 60 * 1000 * 1000 * 10 );
222 }

## ◆ adjustTime< Month >()

template<>

long long System::adjustTime< Month > | ( | long long | t | ) |
| inline

Definition at line 240 of file Timing.h.

240 {
241 return ( t == -1 ) ? t : t /= ( 1LL * 30 * 24 * 60 * 60 * 1000 * 1000 * 10 );
242 }

## ◆ adjustTime< nanoSec >()

template<>

long long System::adjustTime< nanoSec > | ( | long long | t | ) |
| inline

Definition at line 236 of file Timing.h.

236 {
237 return ( t == -1 ) ? t : t *= 100LL;
238 }

## ◆ adjustTime< Native >()

template<>

long long System::adjustTime< Native > | ( | long long | t | ) |
| inline

Definition at line 244 of file Timing.h.

244 {
245 return t;
246 }

## ◆ adjustTime< Sec >()

template<>

long long System::adjustTime< Sec > | ( | long long | t | ) |
| inline

Definition at line 224 of file Timing.h.

224 {
225 return ( t == -1 ) ? t : t /= ( 1000 * 1000 * 10 );
226 }

## ◆ adjustTime< Year >()

template<>

long long System::adjustTime< Year > | ( | long long | t | ) |
| inline

Definition at line 208 of file Timing.h.

208 {
209 return ( t == -1 ) ? t : t /= ( 1LL * 365 * 24 * 60 * 60 * 1000 * 1000 * 10 );
210 }

## ◆ affinityMask()

long System::affinityMask | ( | InfoType | fetch = `ProcessBasics`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Affinity mask.

Definition at line 86 of file Memory.cpp.

86 {
87 PROCESS_BASIC_INFORMATION info;
88 if ( fetch != NoFetch && getProcess()->query( pid, ProcessBasics, &info ) ) return info.AffinityMask;
89 return 0;
90 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132
System::ProcessBasics
Definition: SystemBase.h:18

## ◆ argc()

long System::argc | ( |  | ) |

Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call...

Number of arguments passed to the commandline.

Definition at line 341 of file System.cpp.

341 { return cmdLineArgs().size(); }
std::vector::size
T size(T... args)
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:344

## ◆ argv()

char ** System::argv | ( |  | ) |

char** command line arguments including executable name as arg[0]; You may not modify them!

Const char** command line arguments including executable name as arg[0].

Definition at line 350 of file System.cpp.

350 {
351 auto helperFunc = []( const std::vector<std::string>& args ) -> std::vector<const char*> {
352 std::vector<const char*> result;
353 std::transform( args.begin(), args.end(), std::back_inserter( result ),
354 []( const std::string& s ) { return s.c_str(); } );
355 return result;
356 };
357 static const std::vector<const char*> args = helperFunc( cmdLineArgs() );
358 // We rely here on the fact that a vector's allocation table is contiguous
359 return (char**)&( args[0] );
360 }
std::string
STL class.
gaudirun.args
args
Definition: gaudirun.py:307
std::vector< std::string >
std::back_inserter
T back_inserter(T... args)
gaudirun.s
string s
Definition: gaudirun.py:316
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:344
std::transform
T transform(T... args)

## ◆ backTrace() [1/2]

GAUDI_API int System::backTrace | ( | void ** | addresses,
|  | const int | depth
| ) |  |

## ◆ backTrace() [2/2]

bool System::backTrace | ( | std::string & | btrace,
|  | const int | depth,
|  | const int | offset = `0`
| ) |  |

Definition at line 426 of file System.cpp.

426 {
427 try {
428 // Always hide the first two levels of the stack trace (that's us)
429 const int totalOffset = offset + 2;
430 const int totalDepth = depth + totalOffset;
431
432 std::string fnc, lib;
433
434 std::vector<void*> addresses( totalDepth, nullptr );
435 int count = System::backTrace( addresses.data(), totalDepth );
436 for ( int i = totalOffset; i < count; ++i ) {
437 void* addr = nullptr;
438
439 if ( System::getStackLevel( addresses[i], addr, fnc, lib ) ) {
440 std::ostringstream ost;
441 ost << "#" << std::setw( 3 ) << std::setiosflags( std::ios::left ) << i - totalOffset + 1;
442 ost << std::hex << addr << std::dec << " " << fnc << " [" << lib << "]" << std::endl;
443 btrace += ost.str();
444 }
445 }
446 return true;
447 } catch ( const std::bad_alloc& e ) { return false; }
448 }
System::getStackLevel
GAUDI_API bool getStackLevel(void *addresses, void *&addr, std::string &fnc, std::string &lib)
std::endl
T endl(T... args)
std::setiosflags
T setiosflags(T... args)
System::backTrace
GAUDI_API int backTrace(void **addresses, const int depth)
std::setw
T setw(T... args)
std::string
STL class.
std::ostringstream
STL class.
std::ostringstream::str
T str(T... args)
std::count
T count(T... args)
std::vector< void * >
std::bad_alloc
STL class.
std::hex
T hex(T... args)

## ◆ basePriority()

long System::basePriority | ( | InfoType | fetch = `ProcessBasics`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Base priority.

Definition at line 66 of file Memory.cpp.

66 {
67 PROCESS_BASIC_INFORMATION info;
68 if ( fetch != NoFetch && getProcess()->query( pid, ProcessBasics, &info ) ) return info.BasePriority;
69 return 0;
70 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132
System::ProcessBasics
Definition: SystemBase.h:18

## ◆ breakExecution() [1/2]

long System::breakExecution | ( |  | ) |

Break the execution of the application and invoke the debugger.

Definition at line 47 of file Debugger.cpp.

47 {
48 #ifdef _WIN32
49 _asm int 3 return 1;
50 #else
51 // I have no clue how to do this in linux
52 return 0;
53 #endif
54 }

## ◆ breakExecution() [2/2]

long System::breakExecution | ( | long | pid | ) |

Break the execution of the application and invoke the debugger in a remote process.

Break the execution of the application and invoke the debugger on a possibly remote process.

Definition at line 57 of file Debugger.cpp.

57 {
58 #ifdef _WIN32
59 long result = 0;
60 if ( pid == Win::_getpid() ) {
61 _asm int 3 return 1;
62 } else {
63 Win::LPTHREAD_START_ROUTINE fun;
64 Win::HANDLE th, ph;
65 Win::HINSTANCE mh;
66 Win::DWORD id;
67 mh = Win::LoadLibrary( "Kernel32" );
68 if ( 0 != mh ) {
69 fun = (Win::LPTHREAD_START_ROUTINE)Win::GetProcAddress( mh, "DebugBreak" );
70 if ( 0 != fun ) {
71 ph = Win::OpenProcess( PROCESS_ALL_ACCESS, TRUE, pid );
72 if ( 0 != ph ) {
73 th = Win::CreateRemoteThread( ph, NULL, 0, fun, 0, 0, &id );
74 if ( 0 != th ) {
75 Win::CloseHandle( th );
76 result = 1;
77 }
78 Win::CloseHandle( ph );
79 }
80 }
81 Win::FreeLibrary( mh );
82 }
83 }
84 if ( result != 1 ) result = Win::GetLastError();
85 return result;
86 #else
87 // I have no clue how to do this in linux
88 return pid;
89 #endif
90 }
GaudiKernel.Constants.TRUE
bool TRUE
Definition: Constants.py:20

## ◆ cmdLineArgs()

const std::vector< std::string > System::cmdLineArgs | ( |  | ) |

Command line arguments including executable name as arg[0] as vector of strings.

Const char** command line arguments including executable name as arg[0].

Command line arguments including executable name as arg[0] as vector of strings.

Definition at line 344 of file System.cpp.

344 {
345 static const std::vector<std::string> args = Platform::cmdLineArgs();
346 return args;
347 }
gaudirun.args
args
Definition: gaudirun.py:307
std::vector< std::string >
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:344

## ◆ cpuTime()

long long System::cpuTime | ( | TimeType | typ = `milliSec`,
|  | InfoType | fetch = `Times`,
|  | long | pid = `-1`
| ) |  |

Consumed CPU time of process in milliseconds.

CPU kernel time of process in milliseconds.

Parameters

  typ | Indicator or the unit the time will be returned.
  fetch | Indicator of the information to be fetched. If Fetch_None, the information will not be updated.
  pid | Process ID of which the information will be returned

Returns
  Requested value in the indicated units.

Definition at line 186 of file Timing.cpp.

186 {
187 long long cputime = 0;
188 KERNEL_USER_TIMES info;
189 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) {
190 cputime = adjustTime( typ, info.KernelTime + info.UserTime );
191 }
192 return cputime;
193 }
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API long long adjustTime(TimeType typ, long long timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ creationTime()

long long System::creationTime | ( | TimeType | typ = `milliSec`,
|  | InfoType | fetch = `Times`,
|  | long | pid = `-1`
| ) |  |

Process Creation time.

Units of time between process creation and begin of epoche.

Parameters

  typ | Indicator or the unit the time will be returned.
  fetch | Indicator of the information to be fetched. If Fetch_None, the information will not be updated.
  pid | Process ID of which the information will be returned

Returns
  Requested value in the indicated units.

Definition at line 135 of file Timing.cpp.

135 {
136 long long created = 0;
137 KERNEL_USER_TIMES info;
138 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) {
139 created = adjustTime( typ, info.CreateTime - UNIX_BASE_TIME );
140 }
141 return created;
142 }
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API long long adjustTime(TimeType typ, long long timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ currentTime() [1/3]

template<TimeType T>

GAUDI_API long long System::currentTime | ( |  | ) |
| inline

Retrieve absolute system time.

Parameters

  typ | Indicator or the unit the time will be returned.

Returns
  Requested value in the indicated units.Get current time in specificed units via template parameter (inlined)

Definition at line 250 of file Timing.h.

250 {
251 #ifdef _WIN32
252 long long current = 0;
253 ::GetSystemTimeAsFileTime( (FILETIME*)&current );
254 return adjustTime<T>( current - UNIX_BASE_TIME );
255 #else
256 struct timeval tv;
257 ::gettimeofday( &tv, 0 );
258 return adjustTime<T>( ( tv.tv_sec * 1000000 + tv.tv_usec ) * 10 );
259 #endif
260 }

## ◆ currentTime() [2/3]

long long System::currentTime | ( | TimeType | typ = `milliSec` | ) |

Get current time in specificed units.

Retrieve current system time.

Definition at line 91 of file Timing.cpp.

91 {
92 switch ( typ ) {
93 case Year:
94 return currentTime<Year>();
95 case Month:
96 return currentTime<Month>();
97 case Day:
98 return currentTime<Day>();
99 case Hour:
100 return currentTime<Hour>();
101 case Min:
102 return currentTime<Min>();
103 case Sec:
104 return currentTime<Sec>();
105 case milliSec:
106 return currentTime<milliSec>();
107 case microSec:
108 return currentTime<microSec>();
109 case nanoSec:
110 return currentTime<nanoSec>();
111 case Native:
112 return currentTime<Native>();
113 }
114 return currentTime<Native>();
115 }
System::currentTime< Month >
template long long currentTime< Month >()
System::Min
Definition: Timing.h:57
System::currentTime< Year >
template long long currentTime< Year >()
System::Hour
Definition: Timing.h:57
System::milliSec
Definition: Timing.h:57
System::currentTime< Hour >
template long long currentTime< Hour >()
System::Sec
Definition: Timing.h:57
System::microSec
Definition: Timing.h:57
System::Native
Definition: Timing.h:57
System::currentTime< Sec >
template long long currentTime< Sec >()
System::Month
Definition: Timing.h:57
System::currentTime< Min >
template long long currentTime< Min >()
System::currentTime< Native >
template long long currentTime< Native >()
System::currentTime< milliSec >
template long long currentTime< milliSec >()
System::currentTime< Day >
template long long currentTime< Day >()
System::nanoSec
Definition: Timing.h:57
System::currentTime< nanoSec >
template long long currentTime< nanoSec >()
System::Year
Definition: Timing.h:57
System::currentTime< microSec >
template long long currentTime< microSec >()
System::Day
Definition: Timing.h:57

## ◆ currentTime() [3/3]

template<TimeType T>

long long System::currentTime | ( |  | ) |
| inline

Retrieve absolute system time.

Parameters

  typ | Indicator or the unit the time will be returned.

Returns
  Requested value in the indicated units.Get current time in specificed units via template parameter (inlined)

Definition at line 250 of file Timing.h.

250 {
251 #ifdef _WIN32
252 long long current = 0;
253 ::GetSystemTimeAsFileTime( (FILETIME*)&current );
254 return adjustTime<T>( current - UNIX_BASE_TIME );
255 #else
256 struct timeval tv;
257 ::gettimeofday( &tv, 0 );
258 return adjustTime<T>( ( tv.tv_sec * 1000000 + tv.tv_usec ) * 10 );
259 #endif
260 }

## ◆ currentTime< Day >()

template long long System::currentTime< Day > | ( |  | ) |

## ◆ currentTime< Hour >()

template long long System::currentTime< Hour > | ( |  | ) |

## ◆ currentTime< microSec >()

template long long System::currentTime< microSec > | ( |  | ) |

## ◆ currentTime< milliSec >()

template long long System::currentTime< milliSec > | ( |  | ) |

## ◆ currentTime< Min >()

template long long System::currentTime< Min > | ( |  | ) |

## ◆ currentTime< Month >()

template long long System::currentTime< Month > | ( |  | ) |

## ◆ currentTime< nanoSec >()

template long long System::currentTime< nanoSec > | ( |  | ) |

## ◆ currentTime< Native >()

template long long System::currentTime< Native > | ( |  | ) |

## ◆ currentTime< Sec >()

template long long System::currentTime< Sec > | ( |  | ) |

## ◆ currentTime< Year >()

template long long System::currentTime< Year > | ( |  | ) |

## ◆ ellapsedTime()

long long System::ellapsedTime | ( | TimeType | typ = `milliSec`,
|  | InfoType | fetch = `Times`,
|  | long | pid = `-1`
| ) |  |

Elapsed time since start of process in milliseconds.

Ellapsed time since start of process in milliseconds.

Parameters

  typ | Indicator or the unit the time will be returned.
  timevalue | Time value to be converted.

Returns
  Requested value in the indicated units.

Definition at line 159 of file Timing.cpp.

159 {
160 KERNEL_USER_TIMES info;
161 long long ellapsed = currentTime( microSec ) * 10;
162 getProcess()->query( pid, fetch, &info );
163 ellapsed = adjustTime( typ, ellapsed + UNIX_BASE_TIME - info.CreateTime );
164 return ellapsed;
165 }
System::currentTime
GAUDI_API long long currentTime()
Retrieve absolute system time.
Definition: Timing.h:250
System::microSec
Definition: Timing.h:57
System::adjustTime
GAUDI_API long long adjustTime(TimeType typ, long long timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132
System::ProcessDescriptor::query
long query(long pid, InfoType info, PROCESS_BASIC_INFORMATION *buffer)
Definition: ProcessDescriptor.cpp:584

## ◆ exeHandle()

System::ImageHandle System::exeHandle | ( |  | ) |

Handle to the executable file running.

Definition at line 158 of file ModuleInfo.cpp.

158 {
159 #ifdef _WIN32
160 if ( processHandle() ) {
161 static HINSTANCE handle = 0;
162 DWORD cbNeeded;
163 if ( 0 == handle && _psApi ) {
164 if ( _psApi.EnumProcessModules( processHandle(), &handle, sizeof( ModuleHandle ), &cbNeeded ) ) {}
165 }
166 return handle;
167 }
168 return 0;
169 #elif defined( __linux ) || defined( __APPLE__ )
170 // This does NOT work!
171 static Dl_info infoBuf, *info = &infoBuf;
172 if ( !info ) {
173 void* handle = ::dlopen( nullptr, RTLD_LAZY );
174 // printf("Exe handle:%X\n", handle);
175 if ( handle ) {
176 void* func = ::dlsym( handle, "main" );
177 // printf("Exe:Func handle:%X\n", func);
178 if ( func ) {
179 if ( 0 != ::dladdr( func, &infoBuf ) ) {
180 // std::cout << "All OK" << std::endl;
181 info = &infoBuf;
182 }
183 }
184 }
185 }
186 return info;
187 #elif __hpux
188 // Don't know how to solve this .....
189 return 0;
190 #endif
191 }
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:125
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:211

## ◆ exeName()

const std::string & System::exeName | ( |  | ) |

Name of the executable file running.

Definition at line 193 of file ModuleInfo.cpp.

193 {
194 static std::string module( "" );
195 if ( module.length() == 0 ) {
196 char name[PATH_MAX] = {"Unknown.module"};
197 name[0] = 0;
198 #ifdef _WIN32
199 if ( _psApi && processHandle() ) {
200 _psApi.GetModuleFileNameExA( processHandle(), (HINSTANCE)exeHandle(), name, sizeof( name ) );
201 module = name;
202 }
203 #elif defined( __linux ) || defined( __APPLE__ )
204 char cmd[512];
205 ::sprintf( cmd, "/proc/%d/exe", ::getpid() );
206 module = "Unknown";
207 if ( ::readlink( cmd, name, sizeof( name ) ) >= 0 ) module = name;
208 #elif __hpux
209 if ( ::realpath( ( (HMODULE*)exeHandle() )->dsc.filename, name ) ) module = name;
210 #endif
211 }
212 return module;
213 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:125
std::string
STL class.
System::exeHandle
GAUDI_API ImageHandle exeHandle()
Handle to the executable file running.
Definition: ModuleInfo.cpp:158

## ◆ exitStatus()

long System::exitStatus | ( | InfoType | fetch = `ProcessBasics`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Exit status (does not really make sense for the running process, but for others!)

Definition at line 93 of file Memory.cpp.

93 {
94 PROCESS_BASIC_INFORMATION info;
95 if ( fetch != NoFetch && getProcess()->query( pid, ProcessBasics, &info ) ) return info.ExitStatus;
96 return -2;
97 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132
System::ProcessBasics
Definition: SystemBase.h:18

## ◆ getEnv() [1/4]

std::string System::getEnv | ( | const char * | var | ) |

get a particular environment variable (returning "UNKNOWN" if not set)

get a particular env var, return "UNKNOWN" if not defined

Definition at line 369 of file System.cpp.

369 {
370 char* env;
371 if ( ( env = getenv( var ) ) != nullptr ) {
372 return env;
373 } else {
374 return "UNKNOWN";
375 }
376 }
std::getenv
T getenv(T... args)

## ◆ getEnv() [2/4]

bool System::getEnv | ( | const char * | var,
|  | std::string & | value
| ) |  |

get a particular environment variable, storing the value in the passed string if the variable is set.

get a particular env var, storing the value in the passed string (if set)

Returns true if the variable is set, false otherwise.

Definition at line 379 of file System.cpp.

379 {
380 char* env;
381 if ( ( env = getenv( var ) ) != nullptr ) {
382 value = env;
383 return true;
384 } else {
385 return false;
386 }
387 }
std::getenv
T getenv(T... args)

## ◆ getEnv() [3/4]

bool System::getEnv | ( | const std::string & | var,
|  | std::string & | value
| ) |  |
| inline

Definition at line 90 of file System.h.

90 { return getEnv( var.c_str(), value ); }
System::getEnv
GAUDI_API std::vector< std::string > getEnv()
get all environment variables
Definition: System.cpp:396
std::string::c_str
T c_str(T... args)

## ◆ getEnv() [4/4]

std::vector< std::string > System::getEnv | ( |  | ) |

get all environment variables

get all defined environment vars

Definition at line 396 of file System.cpp.

396 {
397 #if defined( _WIN32 )
398 # define environ _environ
399 #elif defined( __APPLE__ )
400 static char** environ = *_NSGetEnviron();
401 #endif
402 std::vector<std::string> vars;
403 for ( int i = 0; environ[i] != nullptr; ++i ) { vars.push_back( environ[i] ); }
404 return vars;
405 }
std::vector::push_back
T push_back(T... args)
std::vector< std::string >

## ◆ getErrorString()

const std::string System::getErrorString | ( | unsigned long | error | ) |

Retrieve error code as string for a given error.

Definition at line 268 of file System.cpp.

268 {
269 std::string errString = "";
270 #ifdef _WIN32
271 LPVOID lpMessageBuffer;
272 ::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,
273 MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // The user default language
274 (LPTSTR)&lpMessageBuffer, 0, NULL );
275 errString = (const char*)lpMessageBuffer;
276 // Free the buffer allocated by the system
277 ::LocalFree( lpMessageBuffer );
278 #else
279 char* cerrString( nullptr );
280 // Remember: for linux dl* routines must be handled differently!
281 if ( error == 0xAFFEDEAD ) {
282 cerrString = ::dlerror();
283 if ( !cerrString ) cerrString = ::strerror( error );
284 if ( !cerrString ) {
285 cerrString = (char*)"Unknown error. No information found in strerror()!";
286 } else {
287 errString = std::string( cerrString );
288 }
289 errno = 0;
290 } else {
291 cerrString = ::strerror( error );
292 errString = std::string( cerrString );
293 }
294 #endif
295 return errString;
296 }
std::string
STL class.

## ◆ getLastError()

unsigned long System::getLastError | ( |  | ) |

Get last system known error.

Retrieve last error code.

Definition at line 252 of file System.cpp.

252 {
253 #ifdef _WIN32
254 return ::GetLastError();
255 #else
256 // convert errno (int) to unsigned long
257 return static_cast<unsigned long>( static_cast<unsigned int>( errno ) );
258 #endif
259 }

## ◆ getLastErrorString()

const std::string System::getLastErrorString | ( |  | ) |

Get last system error as string.

Retrieve last error code as string.

Definition at line 262 of file System.cpp.

262 {
263 const std::string errString = getErrorString( getLastError() );
264 return errString;
265 }
System::getErrorString
GAUDI_API const std::string getErrorString(unsigned long error)
Retrieve error code as string for a given error.
Definition: System.cpp:268
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:252
std::string
STL class.

## ◆ getProcedureByName() [1/2]

unsigned long System::getProcedureByName | ( | ImageHandle | handle,
|  | const std::string & | name,
|  | EntryPoint * | pFunction
| ) |  |

Get a specific function defined in the DLL.

Definition at line 203 of file System.cpp.

203 {
204 #ifdef _WIN32
205 *pFunction = ( EntryPoint )::GetProcAddress( (HINSTANCE)handle, name.data() );
206 if ( 0 == *pFunction ) { return System::getLastError(); }
207 return 1;
208 #elif defined( __linux )
209 *pFunction = reinterpret_cast<EntryPoint>( ::dlsym( handle, name.c_str() ) );
210 if ( !*pFunction ) {
211 errno = 0xAFFEDEAD;
212 // std::cout << "System::getProcedureByName>" << getLastErrorString() << std::endl;
213 return 0;
214 }
215 return 1;
216 #elif defined( __APPLE__ )
217 *pFunction = ( EntryPoint )::dlsym( handle, name.c_str() );
218 if ( !( *pFunction ) ) {
219 // Try with an underscore :
220 std::string sname = "_" + name;
221 *pFunction = ( EntryPoint )::dlsym( handle, sname.c_str() );
222 }
223 if ( 0 == *pFunction ) {
224 errno = 0xAFFEDEAD;
225 std::cout << "System::getProcedureByName>" << getLastErrorString() << std::endl;
226 // std::cout << "System::getProcedureByName> failure" << std::endl;
227 return 0;
228 }
229 return 1;
230 #elif __hpux
231 HMODULE* mod = (HMODULE*)handle;
232 if ( 0 != mod ) {
233 long ll1 = name.length();
234 for ( int i = 0; i < mod->numSym; i++ ) {
235 long ll2 = strlen( mod->sym[i].name );
236 if ( 0 != ::strncmp( mod->sym[i].name, name.c_str(), ( ll1 > ll2 ) ? ll1 : ll2 ) == 0 ) {
237 *pFunction = (EntryPoint)mod->sym[i].value;
238 return 1;
239 }
240 }
241 }
242 return 0;
243 #endif
244 }
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:252
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
compareOutputFiles.sname
string sname
Definition: compareOutputFiles.py:471
Gaudi.CommonGaudiConfigurables.mod
mod
Definition: CommonGaudiConfigurables.py:22
std::endl
T endl(T... args)
std::string
STL class.
std::strlen
T strlen(T... args)
std::strncmp
T strncmp(T... args)
System::getLastErrorString
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
Definition: System.cpp:262
std::cout
System::EntryPoint
unsigned long(* EntryPoint)(const unsigned long iid, void **ppvObject)
Definition of the "generic" DLL entry point function.
Definition: System.h:35

## ◆ getProcedureByName() [2/2]

unsigned long System::getProcedureByName | ( | ImageHandle | handle,
|  | const std::string & | name,
|  | Creator * | pFunction
| ) |  |

Get a specific function defined in the DLL.

Definition at line 247 of file System.cpp.

247 {
248 return getProcedureByName( handle, name, (EntryPoint*)pFunction );
249 }
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:203
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
System::EntryPoint
unsigned long(* EntryPoint)(const unsigned long iid, void **ppvObject)
Definition of the "generic" DLL entry point function.
Definition: System.h:35

## ◆ getProcess()

ProcessDescriptor * System::getProcess | ( |  | ) |
| inline

Retrieve Process structure.

Definition at line 132 of file ProcessDescriptor.h.

132 {
133 static ProcessDescriptor p;
134 return &p;
135 }

## ◆ getProcessTime()

ProcessTime System::getProcessTime | ( | long | pid = `-1` | ) |

Retrieve the process time data for a process.

Get the process time data for a process (by default the current) as a `ProcessTime` object.

Definition at line 196 of file Timing.cpp.

196 {
197 KERNEL_USER_TIMES info;
198 if ( getProcess()->query( pid, Times, &info ) ) {
199 return ProcessTime( info.KernelTime, info.UserTime, currentTime<Native>() - info.CreateTime );
200 }
201 return ProcessTime(); // return 0s in case of problems
202 }
System::Times
Definition: SystemBase.h:18
System::currentTime< Native >
template long long currentTime< Native >()
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ getStackLevel()

GAUDI_API bool System::getStackLevel | ( | void * | addresses,
|  | void *& | addr,
|  | std::string & | fnc,
|  | std::string & | lib
| ) |  |

## ◆ homeDirectory()

std::string System::homeDirectory | ( |  | ) |

Definition at line 54 of file Environment.cpp.

54 {
55 // Return the user's home directory.
56 std::string home_dir = "./";
57 // Try to replace the current value with the content of several
58 // environment variables
59 if ( !( System::getEnv( "home", home_dir ) || System::getEnv( "HOME", home_dir ) ) ) {
60 // for Windows NT HOME might be defined as either $(HOMESHARE)/$(HOMEPATH)
61 // or $(HOMEDRIVE)/$(HOMEPATH)
62 if ( System::getEnv( "HOMESHARE", home_dir ) || System::getEnv( "HOMEDRIVE", home_dir ) ) {
63 std::string path;
64 if ( System::getEnv( "HOMEPATH", path ) ) home_dir += path;
65 }
66 }
67 return home_dir;
68 }
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:369
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
std::string
STL class.

## ◆ hostName()

const std::string & System::hostName | ( |  | ) |

Host name.

Host name.

Definition at line 303 of file System.cpp.

303 {
304 static const std::string host = Platform::hostName();
305 return host;
306 }
std::string
STL class.
System::hostName
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:303

## ◆ instructionsetLevel()

int System::instructionsetLevel | ( |  | ) |

Instruction Set "Level".

Definition at line 326 of file System.cpp.

326 {
327 using namespace Gaudi;
328 return instrset_detect();
329 }
instrset_detect
int instrset_detect(void)
Definition: instrset_detect.cpp:98
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1

## ◆ isEnvSet()

bool System::isEnvSet | ( | const char * | var | ) |

Check if an environment variable is set or not.

Definition at line 389 of file System.cpp.

389 { return getenv( var ) != nullptr; }
std::getenv
T getenv(T... args)

## ◆ kernelTime()

long long System::kernelTime | ( | TimeType | typ = `milliSec`,
|  | InfoType | fetch = `Times`,
|  | long | pid = `-1`
| ) |  |

CPU kernel mode time of process in milliseconds.

CPU kernel time of process in milliseconds.

Parameters

  typ | Indicator or the unit the time will be returned.
  fetch | Indicator of the information to be fetched. If Fetch_None, the information will not be updated.
  pid | Process ID of which the information will be returned

Returns
  Requested value in the indicated units.

Definition at line 168 of file Timing.cpp.

168 {
169 KERNEL_USER_TIMES info;
170 long long kerneltime = 0;
171 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) {
172 kerneltime = adjustTime( typ, info.KernelTime );
173 }
174 return kerneltime;
175 }
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API long long adjustTime(TimeType typ, long long timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ linkedModules()

const std::vector< std::string > System::linkedModules | ( |  | ) |

Vector of names of linked modules.

Definition at line 215 of file ModuleInfo.cpp.

215 {
216 if ( s_linkedModules.size() == 0 ) {
217 #ifdef _WIN32
218 char name[255]; // Maximum file name length on NT 4.0
219 DWORD cbNeeded;
220 HINSTANCE handle[1024];
221 if ( _psApi ) {
222 if ( _psApi.EnumProcessModules( processHandle(), handle, sizeof( handle ), &cbNeeded ) ) {
223 for ( size_t i = 0; i < cbNeeded / sizeof( HANDLE ); i++ ) {
224 if ( 0 < _psApi.GetModuleFileNameExA( processHandle(), handle[i], name, sizeof( name ) ) ) {
225 s_linkedModules.push_back( name );
226 }
227 }
228 }
229 }
230 #elif defined( __linux ) || defined( __APPLE__ )
231 char ff[512], cmd[1024], fname[1024], buf1[64], buf2[64], buf3[64], buf4[64];
232 ::sprintf( ff, "/proc/%d/maps", ::getpid() );
233 FILE* maps = ::fopen( ff, "r" );
234 while ( ::fgets( cmd, sizeof( cmd ), maps ) ) {
235 int len;
236 sscanf( cmd, "%s %s %s %s %d %s", buf1, buf2, buf3, buf4, &len, fname );
237 if ( len > 0 && strncmp( buf2, "r-xp", strlen( "r-xp" ) ) == 0 ) { s_linkedModules.push_back( fname ); }
238 }
239 ::fclose( maps );
240 #endif
241 }
242 return s_linkedModules;
243 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
std::sscanf
T sscanf(T... args)
std::fgets
T fgets(T... args)
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:125
std::vector::push_back
T push_back(T... args)
std::strlen
T strlen(T... args)
root_map_dump.maps
maps
Definition: root_map_dump.py:57
std::vector::size
T size(T... args)
std::strncmp
T strncmp(T... args)

## ◆ loadDynamicLib()

unsigned long System::loadDynamicLib | ( | const std::string & | name,
|  | ImageHandle * | handle
| ) |  |

Load dynamic link library.

Definition at line 135 of file System.cpp.

135 {
136 unsigned long res = 0;
137 // if name is empty, just load it
138 if ( name.length() == 0 ) {
139 res = loadWithoutEnvironment( name, handle );
140 } else {
141 // If the name is a logical name (environment variable), the try
142 // to load the corresponding library from there.
143 std::string imgName;
144 if ( getEnv( name, imgName ) ) {
145 res = loadWithoutEnvironment( imgName, handle );
146 } else {
147 // build the dll name
148 std::string dllName = name;
149 // Add a possible "lib" prefix to the name on unix platforms. But only if
150 // it's not an absolute path name.
151 #if defined( __linux ) || defined( __APPLE__ )
152 if ( ( dllName.find( '/' ) == std::string::npos ) && ( dllName.compare( 0, 3, "lib" ) != 0 ) ) {
153 dllName = "lib" + dllName;
154 }
155 #endif // unix
156 // Now try loading the library with all possible suffixes supported by the
157 // platform.
158 for ( const char* suffix : SHLIB_SUFFIXES ) {
159 // Add the suffix if necessary.
160 std::string libName = dllName;
161 const size_t len = strlen( suffix );
162 if ( dllName.compare( dllName.length() - len, len, suffix ) != 0 ) { libName += suffix; }
163 // Try to load the library.
164 res = loadWithoutEnvironment( libName, handle );
165 // If the load succeeded, stop here.
166 if ( res == 1 ) { break; }
167 }
168 }
169 if ( res != 1 ) {
170 #if defined( __linux ) || defined( __APPLE__ )
171 errno = 0xAFFEDEAD;
172 #endif
173 // std::cout << "System::loadDynamicLib>" << getLastErrorString() << std::endl;
174 }
175 }
176 return res;
177 }
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:369
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
std::string
STL class.
std::strlen
T strlen(T... args)
std::string::find
T find(T... args)
std::string::length
T length(T... args)
std::string::compare
T compare(T... args)

## ◆ machineType()

const std::string & System::machineType | ( |  | ) |

Machine type.

Machine type.

Definition at line 321 of file System.cpp.

321 {
322 static const std::string mach = Platform::machineType();
323 return mach;
324 }
std::string
STL class.
System::machineType
GAUDI_API const std::string & machineType()
Machine type.
Definition: System.cpp:321

## ◆ mappedMemory()

long System::mappedMemory | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: priority boost.

Definition at line 187 of file Memory.cpp.

187 {
188 VM_COUNTERS info;
189 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) return adjustMemory( unit, info.WorkingSetSize );
190 return -2;
191 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ mappedMemoryPeak()

long System::mappedMemoryPeak | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: priority boost.

Definition at line 194 of file Memory.cpp.

194 {
195 VM_COUNTERS info;
196 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) )
197 return adjustMemory( unit, info.PeakWorkingSetSize );
198 return -2;
199 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ maxMemoryLimit()

long System::maxMemoryLimit | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Quota`,
|  | long | pid = `-1`
| ) |  |

System Process Limits: Maximum amount of virtual memory this process is allowed to use.

Definition at line 210 of file Memory.cpp.

210 {
211 QUOTA_LIMITS quota;
212 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &quota ) )
213 return adjustMemory( unit, quota.MaximumWorkingSetSize );
214 return 0;
215 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ minMemoryLimit()

long System::minMemoryLimit | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Quota`,
|  | long | pid = `-1`
| ) |  |

System Process Limits: Minimum amount of virtual memory this process may use.

Definition at line 202 of file Memory.cpp.

202 {
203 QUOTA_LIMITS quota;
204 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &quota ) )
205 return adjustMemory( unit, quota.MinimumWorkingSetSize );
206 return 0;
207 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ moduleHandle()

System::ImageHandle System::moduleHandle | ( |  | ) |

Handle to currently executed module.

Definition at line 137 of file ModuleInfo.cpp.

137 {
138 if ( !ModuleHandle ) {
139 if ( processHandle() ) {
140 #ifdef _WIN32
141 static HINSTANCE handle = 0;
142 DWORD cbNeeded;
143 if ( 0 == handle && _psApi ) {
144 if ( _psApi.EnumProcessModules( processHandle(), &handle, sizeof( ModuleHandle ), &cbNeeded ) ) {}
145 }
146 return handle;
147 #elif defined( __linux ) || defined( __APPLE__ )
148 static Dl_info info;
149 if ( ::dladdr( reinterpret_cast<void*>( System::moduleHandle ), &info ) ) return &info;
150 #elif __hpux
151 return 0; // Don't know how to solve this .....
152 #endif
153 }
154 }
155 return ModuleHandle;
156 }
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:125
System::moduleHandle
GAUDI_API ImageHandle moduleHandle()
Handle to currently executed module.
Definition: ModuleInfo.cpp:137

## ◆ moduleName()

const std::string & System::moduleName | ( |  | ) |

Get the name of the (executable/DLL) file without file-type.

Retrieve base name of module.

Definition at line 54 of file ModuleInfo.cpp.

54 {
55 static std::string module( "" );
56 if ( module == "" ) {
57 if ( processHandle() && moduleHandle() ) {
58 #ifdef _WIN32
59 char moduleName[256] = {"Unknown.module"};
60 moduleName[0] = 0;
61 if ( _psApi ) {
62 _psApi.GetModuleBaseNameA( processHandle(), (HINSTANCE)moduleHandle(), moduleName, sizeof( moduleName ) );
63 }
64 std::string mod = moduleName;
65 #elif defined( __linux ) || defined( __APPLE__ )
66 std::string mod = ::basename( (char*)( (Dl_info*)moduleHandle() )->dli_fname );
67 #elif __hpux
68 std::string mod = ::basename( ( (HMODULE*)moduleHandle() )->dsc.filename );
69 #endif
70 module = mod.substr( 0, mod.rfind( '.' ) );
71 }
72 }
73 return module;
74 }
Gaudi.CommonGaudiConfigurables.mod
mod
Definition: CommonGaudiConfigurables.py:22
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:125
std::string
STL class.
System::moduleHandle
GAUDI_API ImageHandle moduleHandle()
Handle to currently executed module.
Definition: ModuleInfo.cpp:137
System::moduleName
GAUDI_API const std::string & moduleName()
Get the name of the (executable/DLL) file without file-type.
Definition: ModuleInfo.cpp:54
svn_tag_release.basename
def basename(url)
Definition: svn_tag_release.py:28

## ◆ moduleNameFull()

const std::string & System::moduleNameFull | ( |  | ) |

Get the full name of the (executable/DLL) file.

Retrieve full name of module.

Definition at line 77 of file ModuleInfo.cpp.

77 {
78 static std::string module( "" );
79 if ( module == "" ) {
80 if ( processHandle() && moduleHandle() ) {
81 char name[PATH_MAX] = {"Unknown.module"};
82 name[0] = 0;
83 #ifdef _WIN32
84 if ( _psApi ) {
85 _psApi.GetModuleFileNameExA( processHandle(), (HINSTANCE)moduleHandle(), name, sizeof( name ) );
86 module = name;
87 }
88 #else
89 const char* path =
90 # if defined( __linux ) || defined( __APPLE__ )
91 ( (Dl_info*)moduleHandle() )->dli_fname;
92 # elif __hpux
93 ( (HMODULE*)moduleHandle() )->dsc.filename;
94 # endif
95 if ( ::realpath( path, name ) ) module = name;
96 #endif
97 }
98 }
99 return module;
100 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:125
std::string
STL class.
System::moduleHandle
GAUDI_API ImageHandle moduleHandle()
Handle to currently executed module.
Definition: ModuleInfo.cpp:137

## ◆ moduleType()

System::ModuleType System::moduleType | ( |  | ) |

Get type of the module.

Definition at line 103 of file ModuleInfo.cpp.

103 {
104 static ModuleType type = UNKNOWN;
105 if ( type == UNKNOWN ) {
106 const std::string& module = moduleNameFull();
107 int loc = module.rfind( '.' ) + 1;
108 if ( loc == 0 )
109 type = EXECUTABLE;
110 else if ( module[loc] == 'e' || module[loc] == 'E' )
111 type = EXECUTABLE;
112 #ifdef _WIN32
113 else if ( module[loc] == 'd' || module[loc] == 'D' )
114 #else
115 else if ( module[loc] == 's' && module[loc + 1] == 'o' )
116 #endif
117 type = SHAREDLIB;
118 else
119 type = UNKNOWN;
120 }
121 return type;
122 }
System::SHAREDLIB
Definition: ModuleInfo.h:28
System::moduleNameFull
GAUDI_API const std::string & moduleNameFull()
Get the full name of the (executable/DLL) file.
Definition: ModuleInfo.cpp:77
std::string::rfind
T rfind(T... args)
std::string
STL class.
gaudirun.type
type
Definition: gaudirun.py:142
System::ModuleType
ModuleType
Definition: ModuleInfo.h:28
System::EXECUTABLE
Definition: ModuleInfo.h:28
Io::UNKNOWN
Definition: IFileMgr.h:146

## ◆ nonPagedMemory()

long System::nonPagedMemory | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Current usage of non paged memory.

Basic Process Information: priority boost.

Definition at line 115 of file Memory.cpp.

115 {
116 VM_COUNTERS info;
117 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) )
118 return adjustMemory( unit, info.QuotaNonPagedPoolUsage );
119 return -2;
120 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ nonPagedMemoryLimit()

long System::nonPagedMemoryLimit | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Quota`,
|  | long | pid = `-1`
| ) |  |

System Process Limits: Maximum amount of non-paged memory this process is allowed to use.

Definition at line 123 of file Memory.cpp.

123 {
124 POOLED_USAGE_AND_LIMITS quota;
125 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &quota ) )
126 return adjustMemory( unit, quota.NonPagedPoolLimit );
127 return 0;
128 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ nonPagedMemoryPeak()

long System::nonPagedMemoryPeak | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Peak usage of non paged memory.

Basic Process Information: priority boost.

Definition at line 107 of file Memory.cpp.

107 {
108 VM_COUNTERS info;
109 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) )
110 return adjustMemory( unit, info.QuotaPeakNonPagedPoolUsage );
111 return -2;
112 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ numCmdLineArgs()

long System::numCmdLineArgs | ( |  | ) |

Number of arguments passed to the commandline.

Definition at line 338 of file System.cpp.

338 { return cmdLineArgs().size(); }
std::vector::size
T size(T... args)
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:344

## ◆ numPageFault()

long System::numPageFault | ( | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Number of page faults.

Basic Process Information: priority boost.

Definition at line 155 of file Memory.cpp.

155 {
156 VM_COUNTERS info;
157 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) return info.PageFaultCount;
158 return -2;
159 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ osName()

const std::string & System::osName | ( |  | ) |

OS name.

OS name.

Definition at line 309 of file System.cpp.

309 {
310 static const std::string osname = Platform::osName();
311 return osname;
312 }
std::string
STL class.
System::osName
GAUDI_API const std::string & osName()
OS name.
Definition: System.cpp:309

## ◆ osVersion()

const std::string & System::osVersion | ( |  | ) |

OS version.

OS version.

Definition at line 315 of file System.cpp.

315 {
316 static const std::string osver = Platform::osVersion();
317 return osver;
318 }
std::string
STL class.
System::osVersion
GAUDI_API const std::string & osVersion()
OS version.
Definition: System.cpp:315

## ◆ pagedMemory()

long System::pagedMemory | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Amount of paged memory currently occupied by the process 'pid'.

Definition at line 131 of file Memory.cpp.

131 {
132 VM_COUNTERS info;
133 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) )
134 return adjustMemory( unit, info.QuotaPagedPoolUsage );
135 return -2;
136 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ pagedMemoryLimit()

long System::pagedMemoryLimit | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Quota`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Amount of paged memory that can be occupied by the process 'pid'.

Definition at line 147 of file Memory.cpp.

147 {
148 POOLED_USAGE_AND_LIMITS quota;
149 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &quota ) )
150 return adjustMemory( unit, quota.PagedPoolLimit );
151 return 0;
152 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ pagedMemoryPeak()

long System::pagedMemoryPeak | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Maximum of paged memory occupied by the process 'pid'.

Definition at line 139 of file Memory.cpp.

139 {
140 VM_COUNTERS info;
141 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) )
142 return adjustMemory( unit, info.QuotaPeakPagedPoolUsage );
143 return -2;
144 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ pagefileUsage()

long System::pagefileUsage | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Current page file usage.

Basic Process Information: priority boost.

Definition at line 162 of file Memory.cpp.

162 {
163 VM_COUNTERS info;
164 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) return adjustMemory( unit, info.PagefileUsage );
165 return -2;
166 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ pagefileUsageLimit()

long System::pagefileUsageLimit | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Quota`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Peak usage of page file.

Basic Process Information: priority boost.

Definition at line 177 of file Memory.cpp.

177 {
178 POOLED_USAGE_AND_LIMITS quota;
179 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &quota ) ) {
180 if ( long( quota.PagefileLimit ) < 0 ) return -1; // LONG_MAX;
181 return adjustMemory( unit, quota.PagefileLimit );
182 }
183 return -2;
184 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ pagefileUsagePeak()

long System::pagefileUsagePeak | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Peak usage of page file.

Basic Process Information: priority boost.

Definition at line 169 of file Memory.cpp.

169 {
170 VM_COUNTERS info;
171 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) )
172 return adjustMemory( unit, info.PeakPagefileUsage );
173 return -2;
174 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ parentID()

long System::parentID | ( | InfoType | fetch = `ProcessBasics`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: Parent's process ID.

Definition at line 79 of file Memory.cpp.

79 {
80 PROCESS_BASIC_INFORMATION info;
81 if ( fetch != NoFetch && getProcess()->query( pid, ProcessBasics, &info ) ) return info.InheritedFromUniqueProcessId;
82 return 0;
83 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132
System::ProcessBasics
Definition: SystemBase.h:18

## ◆ PathResolverFindDataFile()

std::string System::PathResolverFindDataFile | ( | const std::string & | logical_file_name | ) |

Definition at line 187 of file PathResolver.cpp.

187 {
188 return PathResolver::find_file( logical_file_name, "DATAPATH" );
189 }

## ◆ PathResolverFindXMLFile()

std::string System::PathResolverFindXMLFile | ( | const std::string & | logical_file_name | ) |

Definition at line 183 of file PathResolver.cpp.

183 {
184 return PathResolver::find_file( logical_file_name, "XMLPATH" );
185 }

## ◆ priorityBoost()

long System::priorityBoost | ( | InfoType | fetch = `PriorityBoost`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: priority boost.

Definition at line 100 of file Memory.cpp.

100 {
101 long info;
102 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) return info;
103 return -2;
104 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ processHandle()

void * System::processHandle | ( |  | ) |

Handle to running process.

Retrieve processhandle.

Definition at line 125 of file ModuleInfo.cpp.

125 {
126 static long pid = ::getpid();
127 #ifdef _WIN32
128 static HANDLE hP = ::OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid );
129 #else
130 static void* hP = (void*)pid;
131 #endif
132 return hP;
133 }
GaudiKernel.Constants.FALSE
bool FALSE
Definition: Constants.py:21

## ◆ procID()

long System::procID | ( |  | ) |

Basic Process Information: Process ID.

Definition at line 73 of file Memory.cpp.

73 {
74 static const long s_pid = ::getpid();
75 return s_pid;
76 }

## ◆ remainingTime()

long long System::remainingTime | ( | TimeType | typ = `milliSec`,
|  | InfoType | fetch = `Quota`,
|  | long | pid = `-1`
| ) |  |

Maximum processing time left for this process.

System Process Limits: Maximum processing time left for this process.

Parameters

  typ | Indicator or the unit the time will be returned.
  fetch | Indicator of the information to be fetched. If Fetch_None, the information will not be updated.
  pid | Process ID of which the information will be returned

Returns
  Requested value in the indicated units.

Definition at line 145 of file Timing.cpp.

145 {
146 long long left = 0;
147 QUOTA_LIMITS quota;
148 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &quota ) ) {
149 if ( left == -1 ) {
150 // left = _I64_MAX;
151 } else {
152 left = adjustTime( typ, quota.TimeLimit );
153 }
154 }
155 return left;
156 }
std::left
T left(T... args)
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API long long adjustTime(TimeType typ, long long timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ resolveEnv()

StatusCode System::resolveEnv | ( | const std::string & | var,
|  | std::string & | res,
|  | int | recusions = `124`
| ) |  |

Definition at line 47 of file Environment.cpp.

47 {
48 std::string source = var;
49 res = i_resolve( source, recursions );
50 if ( res.find( "${" ) == std::string::npos ) { return StatusCode::SUCCESS; }
51 return StatusCode::FAILURE;
52 }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::string
STL class.
std::string::find
T find(T... args)
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86

## ◆ setEnv()

int System::setEnv | ( | const std::string & | name,
|  | const std::string & | value,
|  | int | overwrite = `1`
| ) |  |

Set an environment variables.

set an environment variables.

If value is empty, the variable is removed from the environment. When overwrite is 0, the variable is not set if already present. Returns 0 on success, -1 on failure. See man 3 setenv.

Returns
  0 if successful, -1 if not

Definition at line 482 of file System.cpp.

482 {
483 #ifndef WIN32
484 // UNIX version
485 return value.empty() ?
486 // remove if set to nothing (and return success)
487 ::unsetenv( name.c_str() ),
488 0 :
489 // set the value
490 ::setenv( name.c_str(), value.c_str(), overwrite );
491 #else
492 // Windows version
493 if ( value.empty() ) {
494 // equivalent to unsetenv
495 return ::_putenv( ( name + "=" ).c_str() );
496 } else {
497 if ( !getenv( name.c_str() ) || overwrite ) {
498 // set if not yet present or overwrite is set (force)
499 return ::_putenv( ( name + "=" + value ).c_str() );
500 }
501 }
502 return 0; // if we get here, we are trying to set a variable already set, but
503 // not to overwrite.
504 // It is considered a success on Linux (man P setenv)
505 #endif
506 }
std::string::empty
T empty(T... args)
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
std::getenv
T getenv(T... args)
std::string::c_str
T c_str(T... args)

## ◆ setModuleHandle()

void System::setModuleHandle | ( | System::ImageHandle | handle | ) |

Attach module handle.

Definition at line 135 of file ModuleInfo.cpp.

135 { ModuleHandle = handle; }

## ◆ systemStart()

long long System::systemStart | ( | TimeType | typ = `Sec` | ) |

Maximum processing time left for this process.

Units of time since system startup and begin of epoche.

Parameters

  typ | Indicator or the unit the time will be returned.

Returns
  Requested value in the indicated units.

Definition at line 118 of file Timing.cpp.

118 {
119 static long long sys_start = 0;
120 if ( 0 == sys_start ) {
121 long long c = currentTime( microSec );
122 long long t = tickCount();
123 sys_start = 10 * c - t;
124 }
125 return adjustTime( typ, sys_start );
126 }
gaudirun.c
c
Definition: gaudirun.py:487
System::currentTime
GAUDI_API long long currentTime()
Retrieve absolute system time.
Definition: Timing.h:250
System::microSec
Definition: Timing.h:57
System::tickCount
GAUDI_API long long tickCount()
Retrieve the number of ticks since system startup.
Definition: Timing.cpp:77
System::adjustTime
GAUDI_API long long adjustTime(TimeType typ, long long timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37

## ◆ tempDirectory()

std::string System::tempDirectory | ( |  | ) |

Definition at line 70 of file Environment.cpp.

70 {
71 // Return a user configured or systemwide directory to create
72 // temporary files in.
73 std::string dir;
74 if ( System::getEnv( "TEMP", dir ) || System::getEnv( "TEMPDIR", dir ) || System::getEnv( "TEMP_DIR", dir ) ||
75 System::getEnv( "TMP", dir ) || System::getEnv( "TMPDIR", dir ) || System::getEnv( "TMP_DIR", dir ) )
76 return dir;
77 else
78 return homeDirectory();
79 }
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:369
System::homeDirectory
GAUDI_API std::string homeDirectory()
Definition: Environment.cpp:54
std::string
STL class.

## ◆ threadSelf()

ThreadHandle System::threadSelf | ( |  | ) |
| inline

thread handle "accessor"

Definition at line 110 of file System.h.

110 { return (void*)0; }

## ◆ tickCount()

long long System::tickCount | ( |  | ) |

Retrieve the number of ticks since system startup.

Returns
  Requested value in the indicated units.

Definition at line 77 of file Timing.cpp.

77 {
78 long long count = 10000;
79 #ifdef _WIN32
80 count *= ::GetTickCount(); // Number of milliSec since system startup
81 #else
82 struct tms buf;
83 count *= 10 * times( &buf );
84 #endif
85 return count;
86 }
std::count
T count(T... args)

## ◆ typeinfoName() [1/2]

const std::string System::typeinfoName | ( | const std::type_info & | tinfo | ) |

Get platform independent information about the class type.

Definition at line 298 of file System.cpp.

298 { return typeinfoName( tinfo.name() ); }
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
std::type_info::name
T name(T... args)

## ◆ typeinfoName() [2/2]

const std::string System::typeinfoName | ( | const char * | class_name | ) |

Get the human readable type name from a typeinfo name.

Definition at line 300 of file System.cpp.

300 { return Platform::typeinfoName( class_name ); }
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298

## ◆ unloadDynamicLib()

unsigned long System::unloadDynamicLib | ( | ImageHandle | handle | ) |

unload dynamic link library

Definition at line 180 of file System.cpp.

180 {
181 #ifdef _WIN32
182 if ( !::FreeLibrary( (HINSTANCE)handle ) ) {
183 #elif defined( __linux ) || defined( __APPLE__ )
184 ::dlclose( handle );
185 if ( 0 ) {
186 #elif __hpux
187 // On HP we have to run finalization ourselves.....
188 Creator pFinalize = 0;
189 if ( getProcedureByName( handle, "_fini", &pFinalize ) ) { pFinalize(); }
190 HMODULE* mod = (HMODULE*)handle;
191 if ( 0 == ::shl_unload( mod->dsc.handle ) ) {
192 delete mod;
193 } else {
194 #else
195 if ( false ) {
196 #endif
197 return getLastError();
198 }
199 return 1;
200 }
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:252
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:203
Gaudi.CommonGaudiConfigurables.mod
mod
Definition: CommonGaudiConfigurables.py:22
System::Creator
void *(* Creator)()
Definition of the "generic" DLL entry point function.
Definition: System.h:37

## ◆ upTime()

long long System::upTime | ( | TimeType | typ = `Hour` | ) |

Maximum processing time left for this process.

Units of time since system startup in requested units.

Parameters

  typ | Indicator or the unit the time will be returned.

Returns
  Requested value in the indicated units.

Definition at line 129 of file Timing.cpp.

129 {
130 static long long sys_start = 10 * systemStart( microSec );
131 return adjustTime( typ, 10 * currentTime( microSec ) - sys_start );
132 }
System::currentTime
GAUDI_API long long currentTime()
Retrieve absolute system time.
Definition: Timing.h:250
System::microSec
Definition: Timing.h:57
System::adjustTime
GAUDI_API long long adjustTime(TimeType typ, long long timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37
System::systemStart
GAUDI_API long long systemStart(TimeType typ=Sec)
Maximum processing time left for this process.
Definition: Timing.cpp:118

## ◆ userTime()

long long System::userTime | ( | TimeType | typ = `milliSec`,
|  | InfoType | fetch = `Times`,
|  | long | pid = `-1`
| ) |  |

CPU user mode time of process in milliseconds.

CPU kernel time of process in milliseconds.

Parameters

  typ | Indicator or the unit the time will be returned.
  fetch | Indicator of the information to be fetched. If Fetch_None, the information will not be updated.
  pid | Process ID of which the information will be returned

Returns
  Requested value in the indicated units.

Definition at line 178 of file Timing.cpp.

178 {
179 long long usertime = 0;
180 KERNEL_USER_TIMES info;
181 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) { usertime = adjustTime( typ, info.UserTime ); }
182 return usertime;
183 }
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API long long adjustTime(TimeType typ, long long timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ virtualMemory()

long System::virtualMemory | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: priority boost.

Definition at line 218 of file Memory.cpp.

218 {
219 VM_COUNTERS info;
220 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) return adjustMemory( unit, info.VirtualSize );
221 return -2;
222 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ virtualMemoryLimit()

long System::virtualMemoryLimit | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Quota`,
|  | long | pid = `-1`
| ) |  |

System Process Limits: Maximum amount of the page file this process is allowed to use.

Definition at line 232 of file Memory.cpp.

232 {
233 QUOTA_LIMITS quota;
234 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &quota ) ) {
235 if ( long( quota.PagefileLimit ) == -1 ) return -1; // LONG_MAX;
236 return adjustMemory( unit, quota.PagefileLimit );
237 }
238 return 0;
239 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132

## ◆ virtualMemoryPeak()

long System::virtualMemoryPeak | ( | MemoryUnit | unit = `kByte`,
|  | InfoType | fetch = `Memory`,
|  | long | pid = `-1`
| ) |  |

Basic Process Information: priority boost.

Definition at line 225 of file Memory.cpp.

225 {
226 VM_COUNTERS info;
227 if ( fetch != NoFetch && getProcess()->query( pid, fetch, &info ) ) return adjustMemory( unit, info.PeakVirtualSize );
228 return -2;
229 }
System::adjustMemory
GAUDI_API long adjustMemory(MemoryUnit typ, long value)
Convert time from kByte to requested representation (Experts only)
Definition: Memory.cpp:34
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:132