| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Typedefs | Enumerations | Functions
System Namespace Reference

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

## 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 *)
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 longlong | adjustTime (TimeType typ, longlong 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 longlong | ellapsedTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| Elapsed time since start of process in milliseconds. More...
GAUDI_API longlong | kernelTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| CPU kernel mode time of process in milliseconds. More...
GAUDI_API longlong | userTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| CPU user mode time of process in milliseconds. More...
GAUDI_API longlong | cpuTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| Consumed CPU time of process in milliseconds. More...
GAUDI_API longlong | remainingTime (TimeType typ=milliSec, InfoType fetch=Quota, long pid=-1)
| Maximum processing time left for this process. More...
GAUDI_API longlong | creationTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| Process Creation time. More...
GAUDI_API longlong | systemStart (TimeType typ=Sec)
| Maximum processing time left for this process. More...
GAUDI_API longlong | upTime (TimeType typ=Hour)
| Maximum processing time left for this process. More...
template<TimeType T>
GAUDI_API longlong | currentTime ()
| Retrieve absolute system time. More...
GAUDI_API longlong | currentTime (TimeType typ=milliSec)
| Get current time in specificed units. More...
GAUDI_API longlong | 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>
longlong | currentTime ()
| Retrieve absolute system time. More...
template longlong | currentTime< Year > ()
template longlong | currentTime< Month > ()
template longlong | currentTime< Day > ()
template longlong | currentTime< Hour > ()
template longlong | currentTime< Min > ()
template longlong | currentTime< Sec > ()
template longlong | currentTime< milliSec > ()
template longlong | currentTime< microSec > ()
template longlong | currentTime< nanoSec > ()
template longlong | 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

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

Definition of the "generic" DLL entry point function.

Definition at line 37 of file System.h.

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.

typedef void * System::ImageHandle

Definition of an image handle.

Definition at line 30 of file ModuleInfo.h.

typedef struct _PEB* System::PPEB

Basic Process Information NtQueryInformationProcess using ProcessBasicInfo.

Definition at line 17 of file ProcessDescriptor.h.

typedef void * System::ProcessHandle

Definition of the process handle.

Definition at line 32 of file ModuleInfo.h.

typedef void* System::ThreadHandle

A Thread handle.

Definition at line 110 of file System.h.

## Enumeration Type Documentation

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,
19 RemainTime,
20 Times,
21 ProcessBasics,
22 PriorityBoost,
23 Memory,
24 Quota,
25 System,
26 Modules,
27 IO };
System::RemainTime
Definition: SystemBase.h:19
System::Memory
Definition: SystemBase.h:23
System::Times
Definition: SystemBase.h:20
System::Quota
Definition: SystemBase.h:24
System::Modules
Definition: SystemBase.h:26
System::NoFetch
Definition: SystemBase.h:18
System::IO
Definition: SystemBase.h:27
System::System
Definition: SystemBase.h:25
System::ProcessBasics
Definition: SystemBase.h:21
System::PriorityBoost
Definition: SystemBase.h:22

enum System::MemoryUnit

Unit of memory.

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

Definition at line 56 of file Memory.h.

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

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

enum System::PR_file_type

Enumerator
PR_regular_file |
PR_directory |

Definition at line 35 of file PathResolver.cpp.

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

enum System::PR_search_type

Enumerator
PR_local |
PR_recursive |

Definition at line 40 of file PathResolver.cpp.

40 {
41 PR_local,
42 PR_recursive
43 } PR_search_type;
System::PR_local
Definition: PathResolver.cpp:41
System::PR_recursive
Definition: PathResolver.cpp:42
System::PR_search_type
PR_search_type
Definition: PathResolver.cpp:40

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

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

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

User login name.

Definition at line 444 of file System.cpp.

444 {
445 static std::string account = "";
446 if ( account == "" ) {
447 #ifdef _WIN32
448 char buffer[512];
449 unsigned long buflen = sizeof(buffer);
450 ::GetUserName(buffer, &buflen);
451 account = buffer;
452 #else
453 const char* acct = ::getlogin();
454 if ( !acct ) acct = ::getenv("LOGNAME");
455 if ( !acct ) acct = ::getenv("USER");
456 account = (acct) ? acct : "Unknown";
457 #endif
458 }
459 return account;
460 }
std::string
STL class.

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: break;
38 case kByte: value = value/1024; break;
39 case MByte: value = (value/1024)/1024; break;
40 case GByte: value = ((value/1024)/1024)/1024; break;
41 case TByte: value = (((value/1024)/1024)/1024)/1024; break;
42 case PByte: value = ((((value/1024)/1024)/1024)/1024)/1024; break;
43 case EByte: value = (((((value/1024)/1024)/1024)/1024)/1024)/1024; break;
44 default: value = -1; break;
45 }
46 }
47 return value;
48 }
System::TByte
Definition: Memory.h:56
System::PByte
Definition: Memory.h:56
System::MByte
Definition: Memory.h:56
System::GByte
Definition: Memory.h:56
System::kByte
Definition: Memory.h:56
System::Byte
Definition: Memory.h:56
System::EByte
Definition: Memory.h:56

longlong System::adjustTime | ( | TimeType | typ,
|  | longlong | 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 : return adjustTime<Year >(t);
50 case Month : return adjustTime<Month >(t);
51 case Day : return adjustTime<Day >(t);
52 case Hour : return adjustTime<Hour >(t);
53 case Min : return adjustTime<Min >(t);
54 case Sec : return adjustTime<Sec >(t);
55 case milliSec: return adjustTime<milliSec>(t);
56 case microSec: return adjustTime<microSec>(t);
57 case nanoSec : return adjustTime<nanoSec >(t);
58 case Native : return adjustTime<Native >(t);
59 }
60 }
61 return t;
62 }
System::Min
Definition: Timing.h:57
System::adjustTime< Native >
long long adjustTime< Native >(long long t)
Definition: Timing.h:239
System::Hour
Definition: Timing.h:57
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:231
System::microSec
Definition: Timing.h:57
System::Native
Definition: Timing.h:57
System::adjustTime< milliSec >
long long adjustTime< milliSec >(long long t)
Definition: Timing.h:223
System::adjustTime< microSec >
long long adjustTime< microSec >(long long t)
Definition: Timing.h:227
System::Month
Definition: Timing.h:57
System::nanoSec
Definition: Timing.h:57
System::Year
Definition: Timing.h:57
System::Day
Definition: Timing.h:57
template<TimeType T>

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

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

template<>

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

Definition at line 207 of file Timing.h.

207 {
208 return (t==-1) ? t : t /= (1LL * 24 * 60 * 60 * 1000 * 1000 * 10);
209 }
template<>

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

Definition at line 211 of file Timing.h.

211 {
212 return (t==-1) ? t : t /= (1LL * 60 * 60 * 1000 * 1000 * 10);
213 }
template<>

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

Definition at line 227 of file Timing.h.

227 {
228 return (t==-1) ? t : t /= (10LL);
229 }
template<>

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

Definition at line 223 of file Timing.h.

223 {
224 return (t==-1) ? t : t /= (1000 * 10);
225 }
template<>

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

Definition at line 215 of file Timing.h.

215 {
216 return (t==-1) ? t : t /= (60 * 1000 * 1000 * 10);
217 }
template<>

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

Definition at line 235 of file Timing.h.

235 {
236 return (t==-1) ? t : t /= (1LL * 30 * 24 * 60 * 60 * 1000 * 1000 * 10);
237 }
template<>

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

Definition at line 231 of file Timing.h.

231 {
232 return (t==-1) ? t : t *= 100LL;
233 }
template<>

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

Definition at line 239 of file Timing.h.

239 {
240 return t;
241 }
template<>

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

Definition at line 219 of file Timing.h.

219 {
220 return (t==-1) ? t : t /= (1000 * 1000 * 10);
221 }
template<>

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

Definition at line 203 of file Timing.h.

203 {
204 return (t==-1) ? t : t /= (1LL * 365 * 24 * 60 * 60 * 1000 * 1000 * 10);
205 }

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

Basic Process Information: Affinity mask.

Definition at line 73 of file Memory.cpp.

73 {
74 PROCESS_BASIC_INFORMATION info;
75 if ( fetch != NoFetch && getProcess()->query(pid, ProcessBasics, &info) )
76 return info.AffinityMask;
77 return 0;
78 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:135
System::ProcessBasics
Definition: SystemBase.h:21

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 468 of file System.cpp.

468 {
469 return cmdLineArgs().size();
470 }
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:473

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].

added by I.B.

Definition at line 535 of file System.cpp.

535 {
537 if( s_argvChars.empty() ) { cmdLineArgs(); }
538 // We rely here on the fact that a vector's allocation table is contiguous
540 return (char**)&s_argvChars[0];
541 }
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:473

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

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

Definition at line 614 of file System.cpp.

615 {
616 try {
617 // Always hide the first two levels of the stack trace (that's us)
618 const int totalOffset = offset + 2;
619 const int totalDepth = depth + totalOffset;
620
621 std::string fnc, lib;
622
623 std::vector<void*> addresses( totalDepth, nullptr );
624 int count = System::backTrace(addresses.data(),totalDepth);
625 for (int i = totalOffset; i < count; ++i) {
626 void *addr = nullptr;
627
628 if (System::getStackLevel(addresses[i],addr,fnc,lib)) {
629 std::ostringstream ost;
630 ost << "#" << std::setw(3) << std::setiosflags( std::ios::left ) << i-totalOffset+1;
631 ost << std::hex << addr << std::dec << " " << fnc << " [" << lib << "]" << std::endl;
632 btrace += ost.str();
633 }
634 }
635 return true;
636 } catch ( const std::bad_alloc& e ) {
637 return false;
638 }
639 }
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)

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

Basic Process Information: Base priority.

Definition at line 51 of file Memory.cpp.

51 {
52 PROCESS_BASIC_INFORMATION info;
53 if ( fetch != NoFetch && getProcess()->query(pid, ProcessBasics, &info) )
54 return info.BasePriority;
55 return 0;
56 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:135
System::ProcessBasics
Definition: SystemBase.h:21

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
50 return 1;
51 #else
52 // I have no clue how to do this in linux
53 return 0;
54 #endif
55 }

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 58 of file Debugger.cpp.

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

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].

Definition at line 473 of file System.cpp.

473 {
474 if ( s_argvChars.size() == 0 ) {
475 char exe[1024];
476 #ifdef _WIN32
477 // Disable warning C4996 triggered by C standard library calls
479 #pragma warning(push)
480 #pragma warning(disable:4996)
481 // For compatibility with UNIX we CANNOT use strtok!
482 // If we would use strtok, options like -g="My world" at
483 // the command line level would result on NT in TWO options
484 // instead in one as in UNIX.
485 char *next, *tmp1, *tmp2;
486 for(LPTSTR cmd = ::GetCommandLine(); *cmd; cmd=next) {
487 memset(exe,0,sizeof(exe));
488 while ( *cmd == ' ' ) cmd++;
489 next=::strchr(cmd,' ');
490 if ( !next ) next = cmd + strlen(cmd);
491 if ( (tmp1=::strchr(cmd,'\"')) > 0 && tmp1 < next ) {
492 tmp2 = ::strchr(++tmp1,'\"');
493 if ( tmp2 > 0 ) {
494 next = ++tmp2;
495 if ( cmd < tmp1 ) strncpy(exe, cmd, tmp1-cmd-1);
496 strncpy(&exe[strlen(exe)], tmp1, tmp2-tmp1-1);
497 }
498 else {
499 std::cout << "Mismatched \" in command line arguments" << std::endl;
500 s_argvChars.erase(s_argvChars.begin(), s_argvChars.end());
501 s_argvStrings.erase(s_argvStrings.begin(), s_argvStrings.end());
502 return s_argvStrings;
503 }
504 }
505 else {
506 strncpy(exe, cmd, next-cmd);
507 }
508 s_argvStrings.push_back(exe);
509 s_argvChars.push_back( s_argvStrings.back().c_str());
510 }
511 #pragma warning(pop)
512 #elif defined(__linux) || defined(__APPLE__)
513 sprintf(exe, "/proc/%d/cmdline", ::getpid());
514 FILE *cmdLine = ::fopen(exe,"r");
515 char cmd[1024];
516 if ( cmdLine ) {
517 long len = fread(cmd, sizeof(char), sizeof(cmd), cmdLine);
518 if ( len > 0 ) {
519 cmd[len] = 0;
520 for ( char* token = cmd; token-cmd < len; token += strlen(token)+1 ) {
521 s_argvStrings.push_back(token);
522 s_argvChars.push_back( s_argvStrings.back().c_str());
523 }
524 s_argvStrings[0] = exeName();
525 s_argvChars[0] = s_argvStrings[0].c_str();
526 }
527 ::fclose(cmdLine);
528 }
529 #endif
530 }
531 return s_argvStrings;
532 }
std::endl
T endl(T...args)
std::fread
T fread(T...args)
std::memset
T memset(T...args)
std::vector::end
T end(T...args)
System::exeName
GAUDI_API const std::string & exeName()
Name of the executable file running.
Definition: ModuleInfo.cpp:207
std::vector::push_back
T push_back(T...args)
std::strncpy
T strncpy(T...args)
std::strlen
T strlen(T...args)
std::next
T next(T...args)
std::vector::erase
T erase(T...args)
std::vector::begin
T begin(T...args)
std::string::c_str
T c_str(T...args)
std::vector::back
T back(T...args)
std::sprintf
T sprintf(T...args)
std::cout
std::strchr
T strchr(T...args)

longlong 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 167 of file Timing.cpp.

167 {
168 longlong cputime = 0;
169 KERNEL_USER_TIMES info;
170 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) ) {
171 cputime = adjustTime(typ, info.KernelTime+info.UserTime );
172 }
173 return cputime;
174 }
__longlong
Definition: Kernel.h:56
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API longlong adjustTime(TimeType typ, longlong 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:135

longlong 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 113 of file Timing.cpp.

113 {
114 longlong created = 0;
115 KERNEL_USER_TIMES info;
116 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) ) {
117 created = adjustTime(typ, info.CreateTime-UNIX_BASE_TIME);
118 }
119 return created;
120 }
__longlong
Definition: Kernel.h:56
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API longlong adjustTime(TimeType typ, longlong 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:135
template<TimeType T>

GAUDI_API longlong 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 245 of file Timing.h.

245 {
246 #ifdef _WIN32
247 longlong current = 0;
248 ::GetSystemTimeAsFileTime((FILETIME*)&current);
249 return adjustTime<T>(current - UNIX_BASE_TIME);
250 #else
251 struct timeval tv;
252 ::gettimeofday(&tv, 0);
253 return adjustTime<T>((tv.tv_sec*1000000 + tv.tv_usec)*10);
254 #endif
255 }
__longlong
Definition: Kernel.h:56

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

Get current time in specificed units.

Retrieve current system time.

Definition at line 79 of file Timing.cpp.

79 {
80 switch( typ ) {
81 case Year : return currentTime<Year >();
82 case Month : return currentTime<Month >();
83 case Day : return currentTime<Day >();
84 case Hour : return currentTime<Hour >();
85 case Min : return currentTime<Min >();
86 case Sec : return currentTime<Sec >();
87 case milliSec: return currentTime<milliSec>();
88 case microSec: return currentTime<microSec>();
89 case nanoSec : return currentTime<nanoSec >();
90 case Native : return currentTime<Native >();
91 }
92 return currentTime<Native>();
93 }
System::currentTime< milliSec >
template longlong currentTime< milliSec >()
System::currentTime< microSec >
template longlong currentTime< microSec >()
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::currentTime< Native >
template longlong currentTime< Native >()
System::Native
Definition: Timing.h:57
System::currentTime< nanoSec >
template longlong currentTime< nanoSec >()
System::Month
Definition: Timing.h:57
System::nanoSec
Definition: Timing.h:57
System::Year
Definition: Timing.h:57
System::Day
Definition: Timing.h:57
template<TimeType T>

longlong 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 245 of file Timing.h.

245 {
246 #ifdef _WIN32
247 longlong current = 0;
248 ::GetSystemTimeAsFileTime((FILETIME*)&current);
249 return adjustTime<T>(current - UNIX_BASE_TIME);
250 #else
251 struct timeval tv;
252 ::gettimeofday(&tv, 0);
253 return adjustTime<T>((tv.tv_sec*1000000 + tv.tv_usec)*10);
254 #endif
255 }
__longlong
Definition: Kernel.h:56

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

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

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

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

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

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

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

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

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

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

longlong 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 138 of file Timing.cpp.

138 {
139 KERNEL_USER_TIMES info;
140 longlong ellapsed = currentTime(microSec)*10;
141 getProcess()->query(pid, fetch, &info);
142 ellapsed = adjustTime(typ, ellapsed+UNIX_BASE_TIME-info.CreateTime);
143 return ellapsed;
144 }
System::microSec
Definition: Timing.h:57
__longlong
Definition: Kernel.h:56
System::currentTime
GAUDI_API longlong currentTime()
Retrieve absolute system time.
Definition: Timing.h:245
System::adjustTime
GAUDI_API longlong adjustTime(TimeType typ, longlong 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:135
System::ProcessDescriptor::query
long query(long pid, InfoType info, PROCESS_BASIC_INFORMATION *buffer)
Definition: ProcessDescriptor.cpp:642

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

Handle to the executable file running.

Definition at line 171 of file ModuleInfo.cpp.

171 {
172 #ifdef _WIN32
173 if ( processHandle() ) {
174 static HINSTANCE handle = 0;
175 DWORD cbNeeded;
176 if ( 0 == handle && _psApi ) {
177 if ( _psApi.EnumProcessModules( processHandle(), &handle, sizeof(ModuleHandle), &cbNeeded) ) {
178 }
179 }
180 return handle;
181 }
182 return 0;
183 #elif defined(__linux) || defined(__APPLE__)
184 // This does NOT work!
185 static Dl_info infoBuf, *info = &infoBuf;
186 if ( !info ) {
187 void* handle = ::dlopen(nullptr, RTLD_LAZY);
188 //printf("Exe handle:%X\n", handle);
189 if ( handle ) {
190 void* func = ::dlsym(handle, "main");
191 //printf("Exe:Func handle:%X\n", func);
192 if ( func ) {
193 if ( 0 != ::dladdr(func, &infoBuf) ) {
194 //std::cout << "All OK" << std::endl;
195 info = &infoBuf;
196 }
197 }
198 }
199 }
200 return info;
201 #elif __hpux
202 // Don't know how to solve this .....
203 return 0;
204 #endif
205 }
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:126
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:218

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

Name of the executable file running.

Definition at line 207 of file ModuleInfo.cpp.

207 {
208 static std::string module("");
209 if ( module.length() == 0 ) {
210 char name[PATH_MAX] = {"Unknown.module"};
211 name[0] = 0;
212 #ifdef _WIN32
213 if ( _psApi && processHandle() ) {
214 _psApi.GetModuleFileNameExA( processHandle(), (HINSTANCE)exeHandle(), name,sizeof(name) );
215 module = name;
216 }
217 #elif defined(__linux) || defined(__APPLE__)
218 char cmd[512];
219 ::sprintf(cmd, "/proc/%d/exe", ::getpid());
220 module = "Unknown";
221 if (::readlink(cmd, name, sizeof(name)) >= 0)
222 module = name;
223 #elif __hpux
224 if (::realpath(((HMODULE*)exeHandle())->dsc.filename, name))
225 module = name;
226 #endif
227 }
228 return module;
229 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:126
std::string
STL class.
System::exeHandle
GAUDI_API ImageHandle exeHandle()
Handle to the executable file running.
Definition: ModuleInfo.cpp:171

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 81 of file Memory.cpp.

81 {
82 PROCESS_BASIC_INFORMATION info;
83 if ( fetch != NoFetch && getProcess()->query(pid, ProcessBasics, &info) )
84 return info.ExitStatus;
85 return -2;
86 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:135
System::ProcessBasics
Definition: SystemBase.h:21

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 550 of file System.cpp.

550 {
551 char* env;
552 if ( (env = getenv(var)) != nullptr ) {
553 return env;
554 } else {
555 return "UNKNOWN";
556 }
557 }
std::getenv
T getenv(T...args)

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 560 of file System.cpp.

560 {
561 char* env;
562 if ( (env = getenv(var)) != nullptr ) {
563 value = env;
564 return true;
565 } else {
566 return false;
567 }
568 }
std::getenv
T getenv(T...args)

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

Definition at line 90 of file System.h.

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

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

get all environment variables

get all defined environment vars

Definition at line 579 of file System.cpp.

579 {
580 #if defined(_WIN32)
581 # define environ _environ
582 #elif defined(__APPLE__)
583 static char **environ = *_NSGetEnviron();
584 #endif
585 std::vector<std::string> vars;
586 for (int i=0; environ[i] != nullptr; ++i) {
587 vars.push_back(environ[i]);
588 }
589 return vars;
590 }
std::vector::push_back
T push_back(T...args)
std::vector< std::string >

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

Retrieve error code as string for a given error.

Definition at line 262 of file System.cpp.

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

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

Get last system known error.

Retrieve last error code.

Definition at line 246 of file System.cpp.

246 {
247 #ifdef _WIN32
248 return ::GetLastError();
249 #else
250 // convert errno (int) to unsigned long
251 return static_cast<unsigned long>(static_cast<unsigned int>(errno));
252 #endif
253 }

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

Get last system error as string.

Retrieve last error code as string.

Definition at line 256 of file System.cpp.

256 {
257 const std::string errString = getErrorString(getLastError());
258 return errString;
259 }
System::getErrorString
GAUDI_API const std::string getErrorString(unsigned long error)
Retrieve error code as string for a given error.
Definition: System.cpp:262
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:246
std::string
STL class.

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

Get a specific function defined in the DLL.

Definition at line 191 of file System.cpp.

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

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

Get a specific function defined in the DLL.

Definition at line 241 of file System.cpp.

241 {
242 return getProcedureByName(handle, name, (EntryPoint*)pFunction);
243 }
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:191
System::EntryPoint
unsigned long(* EntryPoint)(const unsigned long iid, void **ppvObject)
Definition of the "generic" DLL entry point function.
Definition: System.h:35

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

Retrieve Process structure.

Definition at line 135 of file ProcessDescriptor.h.

136 {
137 static ProcessDescriptor p;
138 return &p;
139 }

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 177 of file Timing.cpp.

177 {
178 KERNEL_USER_TIMES info;
179 if (getProcess()->query(pid, Times, &info)) {
180 return ProcessTime(info.KernelTime,
181 info.UserTime,
182 currentTime<Native>() - info.CreateTime);
183 }
184 return ProcessTime(); // return 0s in case of problems
185 }
System::Times
Definition: SystemBase.h:20
System::currentTime< Native >
template longlong currentTime< Native >()
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:135

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

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

Definition at line 60 of file Environment.cpp.

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

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

Host name.

Definition at line 371 of file System.cpp.

371 {
372 static const std::string host = init_hostName();
373 return host;
374 }
std::string
STL class.

int System::instructionsetLevel | ( |  | ) |

Instruction Set "Level".

Definition at line 434 of file System.cpp.

434 {
435 return instrset_detect();
436 }
instrset_detect
int instrset_detect(void)
Definition: instrset_detect.cpp:91

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

Check if an environment variable is set or not.

Definition at line 570 of file System.cpp.

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

longlong 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 147 of file Timing.cpp.

147 {
148 KERNEL_USER_TIMES info;
149 longlong kerneltime = 0;
150 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) ) {
151 kerneltime = adjustTime(typ, info.KernelTime );
152 }
153 return kerneltime;
154 }
__longlong
Definition: Kernel.h:56
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API longlong adjustTime(TimeType typ, longlong 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:135

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

Vector of names of linked modules.

Definition at line 231 of file ModuleInfo.cpp.

231 {
232 if ( s_linkedModules.size() == 0 ) {
233 #ifdef _WIN32
234 char name[255]; // Maximum file name length on NT 4.0
235 DWORD cbNeeded;
236 HINSTANCE handle[1024];
237 if ( _psApi ) {
238 if ( _psApi.EnumProcessModules(processHandle(),handle,sizeof(handle),&cbNeeded) ) {
239 for (size_t i = 0; i < cbNeeded/sizeof(HANDLE); i++ ) {
240 if ( 0 < _psApi.GetModuleFileNameExA( processHandle(), handle[i], name, sizeof(name)) ) {
241 s_linkedModules.push_back(name);
242 }
243 }
244 }
245 }
246 #elif defined(__linux) || defined(__APPLE__)
247 char ff[512], cmd[1024], fname[1024], buf1[64], buf2[64], buf3[64], buf4[64];
248 ::sprintf(ff, "/proc/%d/maps", ::getpid());
249 FILE* maps = ::fopen(ff, "r");
250 while( ::fgets(cmd, sizeof(cmd), maps) ) {
251 int len;
252 sscanf(cmd, "%s %s %s %s %d %s", buf1, buf2, buf3, buf4, &len, fname);
253 if ( len > 0 && strncmp(buf2,"r-xp",strlen("r-xp")) == 0 ) {
254 s_linkedModules.push_back(fname);
255 }
256 }
257 ::fclose(maps);
258 #endif
259 }
260 return s_linkedModules;
261 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
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:126
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:54
std::vector::size
T size(T...args)
std::strncmp
T strncmp(T...args)

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

Load dynamic link library.

Definition at line 126 of file System.cpp.

126 {
127 unsigned long res;
128 // if name is empty, just load it
129 if (name.length() == 0) {
130 res = loadWithoutEnvironment(name, handle);
131 } else {
132 // If the name is a logical name (environment variable), the try
133 // to load the corresponding library from there.
134 std::string imgName;
135 if ( getEnv(name, imgName) ) {
136 res = loadWithoutEnvironment(imgName, handle);
137 } else {
138 // build the dll name
139 std::string dllName = name;
140 // if the lib name contains '/' we can assume is the path to a file
141 // (relative or absolute), otherwise it might be a logical library name
142 // (i.e. without 'lib' and '.so')
143 if (dllName.find('/') == std::string::npos) {
144 #if defined(__linux) || defined(__APPLE__)
145 if (dllName.compare(0, 3, "lib") != 0)
146 dllName = "lib" + dllName;
147 #endif
148 if (dllName.find(SHLIB_SUFFIX) == std::string::npos)
149 dllName += SHLIB_SUFFIX;
150 }
151 // try to locate the dll using the standard PATH
152 res = loadWithoutEnvironment(dllName, handle);
153 }
154 if ( res != 1 ) {
155 #if defined(__linux) || defined(__APPLE__)
156 errno = 0xAFFEDEAD;
157 #endif
158 // std::cout << "System::loadDynamicLib>" << getLastErrorString() << std::endl;
159 }
160 }
161 return res;
162 }
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:550
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
std::string
STL class.
std::string::find
T find(T...args)
std::string::length
T length(T...args)
std::string::compare
T compare(T...args)

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

Machine type.

Definition at line 415 of file System.cpp.

415 {
416 static std::string mach = "";
417 #ifdef _WIN32
418 SYSTEM_INFO ut;
419 ::GetSystemInfo(&ut);
420 std::ostringstream arch;
421 arch << ut.wProcessorArchitecture;
422 mach = arch.str();
423 #else
424 struct utsname ut;
425 if (uname(&ut) == 0) {
426 mach = ut.machine;
427 } else {
428 mach = "UNKNOWN";
429 }
430 #endif
431 return mach;
432 }
std::string
STL class.
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)

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

Basic Process Information: priority boost.

Definition at line 180 of file Memory.cpp.

180 {
181 VM_COUNTERS info;
182 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
183 return adjustMemory(unit, info.WorkingSetSize);
184 return -2;
185 }
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:135

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

Basic Process Information: priority boost.

Definition at line 188 of file Memory.cpp.

188 {
189 VM_COUNTERS info;
190 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
191 return adjustMemory(unit, info.PeakWorkingSetSize);
192 return -2;
193 }
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:135

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 204 of file Memory.cpp.

204 {
205 QUOTA_LIMITS quota;
206 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )
207 return adjustMemory(unit, quota.MaximumWorkingSetSize);
208 return 0;
209 }
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:135

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 196 of file Memory.cpp.

196 {
197 QUOTA_LIMITS quota;
198 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )
199 return adjustMemory(unit, quota.MinimumWorkingSetSize);
200 return 0;
201 }
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:135

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

Handle to currently executed module.

Definition at line 140 of file ModuleInfo.cpp.

140 {
141 if ( !ModuleHandle ) {
142 if ( processHandle() ) {
143 #ifdef _WIN32
144 static HINSTANCE handle = 0;
145 DWORD cbNeeded;
146 if ( 0 == handle && _psApi ) {
147 if ( _psApi.EnumProcessModules( processHandle(), &handle, sizeof(ModuleHandle), &cbNeeded) ) {
148 }
149 }
150 return handle;
151 #elif defined(__linux) || defined(__APPLE__)
152 static Dl_info info;
153 if ( 0 !=
154 ::dladdr(
155 #if __GNUC__ < 4
156 (void*)System::moduleHandle
157 #else
158 FuncPtrCast<void*>(System::moduleHandle)
159 #endif
160 , &info) ) {
161 return &info;
162 }
163 #elif __hpux
164 return 0; // Don't know how to solve this .....
165 #endif
166 }
167 }
168 return ModuleHandle;
169 }
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:126
System::moduleHandle
GAUDI_API ImageHandle moduleHandle()
Handle to currently executed module.
Definition: ModuleInfo.cpp:140

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 }
std::string::rfind
T rfind(T...args)
Gaudi.CommonGaudiConfigurables.mod
mod
Definition: CommonGaudiConfigurables.py:22
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:126
std::string
STL class.
System::moduleHandle
GAUDI_API ImageHandle moduleHandle()
Handle to currently executed module.
Definition: ModuleInfo.cpp:140
System::moduleName
GAUDI_API const std::string & moduleName()
Get the name of the (executable/DLL) file without file-type.
Definition: ModuleInfo.cpp:54
std::string::substr
T substr(T...args)
svn_tag_release.basename
def basename(url)
Definition: svn_tag_release.py:21

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))
96 module = name;
97 #endif
98 }
99 }
100 return module;
101 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:772
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:126
std::string
STL class.
System::moduleHandle
GAUDI_API ImageHandle moduleHandle()
Handle to currently executed module.
Definition: ModuleInfo.cpp:140

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

Get type of the module.

Definition at line 104 of file ModuleInfo.cpp.

104 {
105 static ModuleType type = UNKNOWN;
106 if ( type == UNKNOWN ) {
107 const std::string& module = moduleNameFull();
108 int loc = module.rfind('.')+1;
109 if ( loc == 0 )
110 type = EXECUTABLE;
111 else if ( module[loc] == 'e' || module[loc] == 'E' )
112 type = EXECUTABLE;
113 #ifdef _WIN32
114 else if ( module[loc] == 'd' || module[loc] == 'D' )
115 #else
116 else if ( module[loc] == 's' && module[loc+1] == 'o' )
117 #endif
118 type = SHAREDLIB;
119 else
120 type = UNKNOWN;
121 }
122 return type;
123 }
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:125
System::ModuleType
ModuleType
Definition: ModuleInfo.h:28
System::EXECUTABLE
Definition: ModuleInfo.h:28
Io::UNKNOWN
Definition: IFileMgr.h:151

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 105 of file Memory.cpp.

105 {
106 VM_COUNTERS info;
107 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
108 return adjustMemory(unit, info.QuotaNonPagedPoolUsage);
109 return -2;
110 }
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:135

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 113 of file Memory.cpp.

113 {
114 POOLED_USAGE_AND_LIMITS quota;
115 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )
116 return adjustMemory(unit, quota.NonPagedPoolLimit);
117 return 0;
118 }
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:135

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 97 of file Memory.cpp.

97 {
98 VM_COUNTERS info;
99 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
100 return adjustMemory(unit, info.QuotaPeakNonPagedPoolUsage);
101 return -2;
102 }
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:135

long System::numCmdLineArgs | ( |  | ) |

Number of arguments passed to the commandline.

Definition at line 463 of file System.cpp.

463 {
464 return cmdLineArgs().size();
465 }
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:473

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

Basic Process Information: Number of page faults.

Basic Process Information: priority boost.

Definition at line 145 of file Memory.cpp.

145 {
146 VM_COUNTERS info;
147 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
148 return info.PageFaultCount;
149 return -2;
150 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:135

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

OS name.

Definition at line 377 of file System.cpp.

377 {
378 static std::string osname = "";
379 #ifdef _WIN32
380 osname = "Windows";
381 #else
382 struct utsname ut;
383 if (uname(&ut) == 0) {
384 osname = ut.sysname;
385 } else {
386 osname = "UNKNOWN";
387 }
388 #endif
389 return osname;
390 }
std::string
STL class.

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

OS version.

Definition at line 394 of file System.cpp.

394 {
395 static std::string osver = "";
396 #ifdef _WIN32
397 OSVERSIONINFO ut;
398 ut.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
399 ::GetVersionEx(&ut);
400 std::ostringstream ver;
401 ver << ut.dwMajorVersion << '.' << ut.dwMinorVersion;
402 osver = ver.str();
403 #else
404 struct utsname ut;
405 if (uname(&ut) == 0) {
406 osver = ut.release;
407 } else {
408 osver = "UNKNOWN";
409 }
410 #endif
411 return osver;
412 }
std::string
STL class.
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)

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 121 of file Memory.cpp.

121 {
122 VM_COUNTERS info;
123 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
124 return adjustMemory(unit, info.QuotaPagedPoolUsage);
125 return -2;
126 }
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:135

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 137 of file Memory.cpp.

137 {
138 POOLED_USAGE_AND_LIMITS quota;
139 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )
140 return adjustMemory(unit, quota.PagedPoolLimit);
141 return 0;
142 }
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:135

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 129 of file Memory.cpp.

129 {
130 VM_COUNTERS info;
131 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
132 return adjustMemory(unit, info.QuotaPeakPagedPoolUsage);
133 return -2;
134 }
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:135

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 153 of file Memory.cpp.

153 {
154 VM_COUNTERS info;
155 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
156 return adjustMemory(unit, info.PagefileUsage);
157 return -2;
158 }
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:135

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 169 of file Memory.cpp.

169 {
170 POOLED_USAGE_AND_LIMITS quota;
171 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) ) {
172 if ( long(quota.PagefileLimit) < 0 )
173 return -1;//LONG_MAX;
174 return adjustMemory(unit, quota.PagefileLimit);
175 }
176 return -2;
177 }
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:135

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 161 of file Memory.cpp.

161 {
162 VM_COUNTERS info;
163 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
164 return adjustMemory(unit, info.PeakPagefileUsage);
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:135

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

Basic Process Information: Parent's process ID.

Definition at line 65 of file Memory.cpp.

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

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

Definition at line 226 of file PathResolver.cpp.

227 {
228 return PathResolver::find_file (logical_file_name, "DATAPATH");
229 }

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

Definition at line 221 of file PathResolver.cpp.

222 {
223 return PathResolver::find_file (logical_file_name, "XMLPATH");
224 }

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

Basic Process Information: priority boost.

Definition at line 89 of file Memory.cpp.

89 {
90 long info;
91 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
92 return info;
93 return -2;
94 }
System::NoFetch
Definition: SystemBase.h:18
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:135

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

Handle to running process.

Retrieve processhandle.

Definition at line 126 of file ModuleInfo.cpp.

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

long System::procID | ( |  | ) |

Basic Process Information: Process ID.

Definition at line 59 of file Memory.cpp.

59 {
60 static const long s_pid = ::getpid();
61 return s_pid;
62 }

longlong 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 123 of file Timing.cpp.

123 {
124 longlong left = 0;
125 QUOTA_LIMITS quota;
126 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) ) {
127 if ( left == -1 ) {
128 //left = _I64_MAX;
129 }
130 else {
131 left = adjustTime(typ, quota.TimeLimit);
132 }
133 }
134 return left;
135 }
std::left
T left(T...args)
__longlong
Definition: Kernel.h:56
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API longlong adjustTime(TimeType typ, longlong 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:135

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

Definition at line 51 of file Environment.cpp.

51 {
52 std::string source = var;
53 res = i_resolve(source, recursions);
54 if ( res.find("${") == std::string::npos ) {
55 return StatusCode::SUCCESS;
56 }
57 return StatusCode::FAILURE;
58 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
std::string
STL class.
std::string::find
T find(T...args)

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 678 of file System.cpp.

679 {
680 #ifndef WIN32
681 // UNIX version
682 return value.empty() ?
683 // remove if set to nothing (and return success)
684 ::unsetenv(name.c_str()) , 0 :
685 // set the value
686 ::setenv(name.c_str(),value.c_str(), overwrite);
687 #else
688 // Windows version
689 if ( value.empty() ) {
690 // equivalent to unsetenv
691 return ::_putenv((name+"=").c_str());
692 }
693 else {
694 if ( !getenv(name.c_str()) || overwrite ) {
695 // set if not yet present or overwrite is set (force)
696 return ::_putenv((name+"="+value).c_str());
697 }
698 }
699 return 0; // if we get here, we are trying to set a variable already set, but
700 // not to overwrite.
701 // It is considered a success on Linux (man P setenv)
702 #endif
703
704 }
std::string::empty
T empty(T...args)
std::getenv
T getenv(T...args)
std::string::c_str
T c_str(T...args)

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

Attach module handle.

Definition at line 136 of file ModuleInfo.cpp.

136 {
137 ModuleHandle = handle;
138 }

longlong 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 96 of file Timing.cpp.

96 {
97 static longlong sys_start = 0;
98 if ( 0 == sys_start ) {
99 longlong c = currentTime(microSec);
100 longlong t = tickCount();
101 sys_start = 10*c - t;
102 }
103 return adjustTime(typ, sys_start);
104 }
gaudirun.c
c
Definition: gaudirun.py:391
System::tickCount
GAUDI_API longlong tickCount()
Retrieve the number of ticks since system startup.
Definition: Timing.cpp:65
System::microSec
Definition: Timing.h:57
__longlong
Definition: Kernel.h:56
System::currentTime
GAUDI_API longlong currentTime()
Retrieve absolute system time.
Definition: Timing.h:245
System::adjustTime
GAUDI_API longlong adjustTime(TimeType typ, longlong timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37

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

Definition at line 79 of file Environment.cpp.

79 {
80 // Return a user configured or systemwide directory to create
81 // temporary files in.
82 std::string dir;
83 if ( System::getEnv("TEMP", dir) ||
84 System::getEnv("TEMPDIR", dir) ||
85 System::getEnv("TEMP_DIR", dir) ||
86 System::getEnv("TMP", dir) ||
87 System::getEnv("TMPDIR", dir) ||
88 System::getEnv("TMP_DIR", dir)
89 )
90 return dir;
91 else
92 return homeDirectory();
93 }
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:550
System::homeDirectory
GAUDI_API std::string homeDirectory()
Definition: Environment.cpp:60
std::string
STL class.

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

thread handle "accessor"

Definition at line 112 of file System.h.

112 { return (void*)0; }

longlong System::tickCount | ( |  | ) |

Retrieve the number of ticks since system startup.

Returns
  Requested value in the indicated units.

Definition at line 65 of file Timing.cpp.

65 {
66 longlong count = 10000;
67 #ifdef _WIN32
68 count *= ::GetTickCount(); // Number of milliSec since system startup
69 #else
70 struct tms buf;
71 count *= 10*times(&buf);
72 #endif
73 return count;
74 }
__longlong
Definition: Kernel.h:56
std::count
T count(T...args)

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

Get platform independent information about the class type.

Definition at line 299 of file System.cpp.

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

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

Definition at line 303 of file System.cpp.

303 {
304 std::string result;
305 #ifdef _WIN32
306 long off = 0;
307 if ( ::strncmp(class_name, "class ", 6) == 0 ) {
308 // The returned name is prefixed with "class "
309 off = 6;
310 }
311 if ( ::strncmp(class_name, "struct ", 7) == 0 ) {
312 // The returned name is prefixed with "struct "
313 off = 7;
314 }
315 if ( off > 0 ) {
316 std::string tmp = class_name + off;
317 long loc = 0;
318 while( (loc = tmp.find("class ")) > 0 ) {
319 tmp.erase(loc, 6);
320 }
321 loc = 0;
322 while( (loc = tmp.find("struct ")) > 0 ) {
323 tmp.erase(loc, 7);
324 }
325 result = tmp;
326 }
327 else {
328 result = class_name;
329 }
330 // Change any " *" to "*"
331 while ( (off=result.find(" *")) != std::string::npos ) {
332 result.replace(off, 2, "*");
333 }
334 // Change any " &" to "&"
335 while ( (off=result.find(" &")) != std::string::npos ) {
336 result.replace(off, 2, "&");
337 }
338
339 #elif defined(__linux) || defined(__APPLE__)
340 int status;
341 auto realname = std::unique_ptr<char,decltype(free)*>( abi::__cxa_demangle(class_name, nullptr, nullptr, &status), std::free );
342 if (!realname) return class_name;
343 #if _GLIBCXX_USE_CXX11_ABI
344 static const std::regex cxx11_string{"std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > ?"};
345 result = std::regex_replace( realname.get(), cxx11_string, "std::string" );
346 #else
347 result = std::string{realname.get()};
348 #endif
349 // substitute ', ' with ','
350 static const std::regex comma_space{", "};
351 result = std::regex_replace( result, comma_space, "," );
352 #endif
353 return result;
354 }
std::free
T free(T...args)
std::string
STL class.
std::string::replace
T replace(T...args)
std::regex_replace
T regex_replace(T...args)
std::string::erase
T erase(T...args)
std::string::find
T find(T...args)
std::unique_ptr
STL class.
std::regex
std::strncmp
T strncmp(T...args)

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

unload dynamic link library

Definition at line 165 of file System.cpp.

165 {
166 #ifdef _WIN32
167 if ( !::FreeLibrary((HINSTANCE)handle) ) {
168 #elif defined(__linux) || defined(__APPLE__)
169 ::dlclose( handle );
170 if ( 0 ) {
171 #elif __hpux
172 // On HP we have to run finalization ourselves.....
173 Creator pFinalize = 0;
174 if ( getProcedureByName(handle, "_fini", &pFinalize) ) {
175 pFinalize();
176 }
177 HMODULE* mod = (HMODULE*)handle;
178 if ( 0 == ::shl_unload( mod->dsc.handle ) ) {
179 delete mod;
180 }
181 else {
182 #else
183 if (false){
184 #endif
185 return getLastError();
186 }
187 return 1;
188 }
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:246
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:191
Gaudi.CommonGaudiConfigurables.mod
mod
Definition: CommonGaudiConfigurables.py:22
System::Creator
void *(* Creator)()
Definition of the "generic" DLL entry point function.
Definition: System.h:37

longlong 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 107 of file Timing.cpp.

107 {
108 static longlong sys_start = 10*systemStart(microSec);
109 return adjustTime(typ, 10*currentTime(microSec)-sys_start);
110 }
System::systemStart
GAUDI_API longlong systemStart(TimeType typ=Sec)
Maximum processing time left for this process.
Definition: Timing.cpp:96
System::microSec
Definition: Timing.h:57
__longlong
Definition: Kernel.h:56
System::currentTime
GAUDI_API longlong currentTime()
Retrieve absolute system time.
Definition: Timing.h:245
System::adjustTime
GAUDI_API longlong adjustTime(TimeType typ, longlong timevalue)
Convert time from OS native time to requested representation (Experts only)
Definition: Timing.cpp:37

longlong 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 157 of file Timing.cpp.

157 {
158 longlong usertime = 0;
159 KERNEL_USER_TIMES info;
160 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) ) {
161 usertime = adjustTime(typ, info.UserTime );
162 }
163 return usertime;
164 }
__longlong
Definition: Kernel.h:56
System::NoFetch
Definition: SystemBase.h:18
System::adjustTime
GAUDI_API longlong adjustTime(TimeType typ, longlong 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:135

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

Basic Process Information: priority boost.

Definition at line 212 of file Memory.cpp.

212 {
213 VM_COUNTERS info;
214 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
215 return adjustMemory(unit, info.VirtualSize);
216 return -2;
217 }
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:135

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 228 of file Memory.cpp.

228 {
229 QUOTA_LIMITS quota;
230 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) ) {
231 if ( long(quota.PagefileLimit) == -1 )
232 return -1;//LONG_MAX;
233 return adjustMemory(unit, quota.PagefileLimit);
234 }
235 return 0;
236 }
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:135

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

Basic Process Information: priority boost.

Definition at line 220 of file Memory.cpp.

220 {
221 VM_COUNTERS info;
222 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
223 return adjustMemory(unit, info.PeakVirtualSize);
224 return -2;
225 }
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:135