| The Gaudi Framework v27r1

- 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...
GAUDI_API longlong | currentTime (TimeType typ=milliSec)
| Retrieve absolute system time. 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)
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 20 of file ProcessDescriptor.cpp.

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

enum System::TimeType

Time type for conversion.

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

Definition at line 51 of file Timing.h.

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

## Function Documentation

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

User login name.

Definition at line 511 of file System.cpp.

511 {
512 static std::string account = "";
513 if ( account == "" ) {
514 #ifdef _WIN32
515 char buffer[512];
516 unsigned long buflen = sizeof(buffer);
517 ::GetUserName(buffer, &buflen);
518 account = buffer;
519 #else
520 const char* acct = ::getlogin();
521 if ( !acct ) acct = ::getenv("LOGNAME");
522 if ( !acct ) acct = ::getenv("USER");
523 account = (acct) ? acct : "Unknown";
524 #endif
525 }
526 return account;
527 }
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
dump_component_properties.value
list value
Definition: dump_component_properties.py:12
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:51
System::adjustTime< Native >
long long adjustTime< Native >(long long t)
Definition: Timing.h:226
System::Hour
Definition: Timing.h:51
System::adjustTime< Month >
long long adjustTime< Month >(long long t)
Definition: Timing.h:222
System::milliSec
Definition: Timing.h:51
System::Sec
Definition: Timing.h:51
System::adjustTime< nanoSec >
long long adjustTime< nanoSec >(long long t)
Definition: Timing.h:218
System::microSec
Definition: Timing.h:51
System::adjustTime< Day >
long long adjustTime< Day >(long long t)
Definition: Timing.h:194
System::Native
Definition: Timing.h:51
System::adjustTime< milliSec >
long long adjustTime< milliSec >(long long t)
Definition: Timing.h:210
System::adjustTime< Year >
long long adjustTime< Year >(long long t)
Definition: Timing.h:190
System::adjustTime< microSec >
long long adjustTime< microSec >(long long t)
Definition: Timing.h:214
System::adjustTime< Min >
long long adjustTime< Min >(long long t)
Definition: Timing.h:202
System::Month
Definition: Timing.h:51
System::nanoSec
Definition: Timing.h:51
System::adjustTime< Hour >
long long adjustTime< Hour >(long long t)
Definition: Timing.h:198
System::Year
Definition: Timing.h:51
System::adjustTime< Sec >
long long adjustTime< Sec >(long long t)
Definition: Timing.h:206
System::Day
Definition: Timing.h:51
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 194 of file Timing.h.

194 {
195 return (t==-1) ? t : t /= (1LL * 24 * 60 * 60 * 1000 * 1000 * 10);
196 }
template<>

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

Definition at line 198 of file Timing.h.

198 {
199 return (t==-1) ? t : t /= (1LL * 60 * 60 * 1000 * 1000 * 10);
200 }
template<>

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

Definition at line 214 of file Timing.h.

214 {
215 return (t==-1) ? t : t /= (10LL);
216 }
template<>

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

Definition at line 210 of file Timing.h.

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

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

Definition at line 202 of file Timing.h.

202 {
203 return (t==-1) ? t : t /= (60 * 1000 * 1000 * 10);
204 }
template<>

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

Definition at line 222 of file Timing.h.

222 {
223 return (t==-1) ? t : t /= (1LL * 30 * 24 * 60 * 60 * 1000 * 1000 * 10);
224 }
template<>

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

Definition at line 218 of file Timing.h.

218 {
219 return (t==-1) ? t : t *= 100LL;
220 }
template<>

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

Definition at line 226 of file Timing.h.

226 {
227 return t;
228 }
template<>

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

Definition at line 206 of file Timing.h.

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

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

Definition at line 190 of file Timing.h.

190 {
191 return (t==-1) ? t : t /= (1LL * 365 * 24 * 60 * 60 * 1000 * 1000 * 10);
192 }

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
System::NoFetch
Definition: SystemBase.h:18
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 535 of file System.cpp.

535 {
536 return cmdLineArgs().size();
537 }
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:540

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

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

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

682 {
683 try {
684 // Always hide the first two levels of the stack trace (that's us)
685 const int totalOffset = offset + 2;
686 const int totalDepth = depth + totalOffset;
687
688 std::string fnc, lib;
689
690 std::vector<void*> addresses( totalDepth, nullptr );
691 int count = System::backTrace(addresses.data(),totalDepth);
692 for (int i = totalOffset; i < count; ++i) {
693 void *addr = nullptr;
694
695 if (System::getStackLevel(addresses[i],addr,fnc,lib)) {
696 std::ostringstream ost;
697 ost << "#" << std::setw(3) << std::setiosflags( std::ios::left ) << i-totalOffset+1;
698 ost << std::hex << addr << std::dec << " " << fnc << " [" << lib << "]" << std::endl;
699 btrace += ost.str();
700 }
701 }
702 return true;
703 } catch ( const std::bad_alloc& e ) {
704 return false;
705 }
706 }
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)
ana.i
list i
Definition: ana.py:128

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
System::NoFetch
Definition: SystemBase.h:18
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
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 540 of file System.cpp.

540 {
541 if ( s_argvChars.size() == 0 ) {
542 char exe[1024];
543 #ifdef _WIN32
544 // Disable warning C4996 triggered by C standard library calls
546 #pragma warning(push)
547 #pragma warning(disable:4996)
548 // For compatibility with UNIX we CANNOT use strtok!
549 // If we would use strtok, options like -g="My world" at
550 // the command line level would result on NT in TWO options
551 // instead in one as in UNIX.
552 char *next, *tmp1, *tmp2;
553 for(LPTSTR cmd = ::GetCommandLine(); *cmd; cmd=next) {
554 memset(exe,0,sizeof(exe));
555 while ( *cmd == ' ' ) cmd++;
556 next=::strchr(cmd,' ');
557 if ( !next ) next = cmd + strlen(cmd);
558 if ( (tmp1=::strchr(cmd,'\"')) > 0 && tmp1 < next ) {
559 tmp2 = ::strchr(++tmp1,'\"');
560 if ( tmp2 > 0 ) {
561 next = ++tmp2;
562 if ( cmd < tmp1 ) strncpy(exe, cmd, tmp1-cmd-1);
563 strncpy(&exe[strlen(exe)], tmp1, tmp2-tmp1-1);
564 }
565 else {
566 std::cout << "Mismatched \" in command line arguments" << std::endl;
567 s_argvChars.erase(s_argvChars.begin(), s_argvChars.end());
568 s_argvStrings.erase(s_argvStrings.begin(), s_argvStrings.end());
569 return s_argvStrings;
570 }
571 }
572 else {
573 strncpy(exe, cmd, next-cmd);
574 }
575 s_argvStrings.push_back(exe);
576 s_argvChars.push_back( s_argvStrings.back().c_str());
577 }
578 #pragma warning(pop)
579 #elif defined(__linux) || defined(__APPLE__)
580 sprintf(exe, "/proc/%d/cmdline", ::getpid());
581 FILE *cmdLine = ::fopen(exe,"r");
582 char cmd[1024];
583 if ( cmdLine ) {
584 long len = fread(cmd, sizeof(char), sizeof(cmd), cmdLine);
585 if ( len > 0 ) {
586 cmd[len] = 0;
587 for ( char* token = cmd; token-cmd < len; token += strlen(token)+1 ) {
588 s_argvStrings.push_back(token);
589 s_argvChars.push_back( s_argvStrings.back().c_str());
590 }
591 s_argvStrings[0] = exeName();
592 s_argvChars[0] = s_argvStrings[0].c_str();
593 }
594 ::fclose(cmdLine);
595 }
596 #endif
597 }
598 return s_argvStrings;
599 }
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 168 of file Timing.cpp.

168 {
169 longlong cputime = 0;
170 KERNEL_USER_TIMES info;
171 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) ) {
172 cputime = adjustTime(typ, info.KernelTime+info.UserTime );
173 }
174 return cputime;
175 }
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
__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

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

114 {
115 longlong created = 0;
116 KERNEL_USER_TIMES info;
117 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) ) {
118 created = adjustTime(typ, info.CreateTime-UNIX_BASE_TIME);
119 }
120 return created;
121 }
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
__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

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

Retrieve absolute system time.

Retrieve current system time.

Parameters

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

Returns
  Requested value in the indicated units.

Definition at line 79 of file Timing.cpp.

79 {
80 longlong current = 0;
81 #ifdef _WIN32
82 ::GetSystemTimeAsFileTime((FILETIME*)&current);
83 current -= UNIX_BASE_TIME;
84 #else
85 struct timeval tv;
86 struct timezone tz;
87 ::gettimeofday(&tv, &tz);
88 current = tv.tv_sec;
89 current *= 1000000;
90 current += tv.tv_usec;
91 current *= 10;
92 #endif
93 return adjustTime(typ, current);
94 }
__longlong
Definition: Kernel.h:56
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::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 139 of file Timing.cpp.

139 {
140 KERNEL_USER_TIMES info;
141 longlong ellapsed = currentTime(microSec)*10;
142 getProcess()->query(pid, fetch, &info);
143 ellapsed = adjustTime(typ, ellapsed+UNIX_BASE_TIME-info.CreateTime);
144 return ellapsed;
145 }
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
ana.ellapsed
tuple ellapsed
Definition: ana.py:140
System::microSec
Definition: Timing.h:51
__longlong
Definition: Kernel.h:56
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::ProcessDescriptor::query
long query(long pid, InfoType info, PROCESS_BASIC_INFORMATION *buffer)
Definition: ProcessDescriptor.cpp:638
System::currentTime
GAUDI_API longlong currentTime(TimeType typ=milliSec)
Retrieve absolute system time.
Definition: Timing.cpp:79

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
tuple 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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
System::NoFetch
Definition: SystemBase.h:18
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 617 of file System.cpp.

617 {
618 char* env;
619 if ( (env = getenv(var)) != nullptr ) {
620 return env;
621 } else {
622 return "UNKNOWN";
623 }
624 }
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 627 of file System.cpp.

627 {
628 char* env;
629 if ( (env = getenv(var)) != nullptr ) {
630 value = env;
631 return true;
632 } else {
633 return false;
634 }
635 }
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:646
dump_component_properties.value
list value
Definition: dump_component_properties.py:12
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 646 of file System.cpp.

646 {
647 #if defined(_WIN32)
648 # define environ _environ
649 #elif defined(__APPLE__)
650 static char **environ = *_NSGetEnviron();
651 #endif
652 std::vector<std::string> vars;
653 for (int i=0; environ[i] != nullptr; ++i) {
654 vars.push_back(environ[i]);
655 }
656 return vars;
657 }
std::vector::push_back
T push_back(T...args)
std::vector< std::string >
ana.i
list i
Definition: ana.py:128

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

Retrieve error code as string for a given error.

Definition at line 260 of file System.cpp.

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

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

Get last system known error.

Retrieve last error code.

Definition at line 244 of file System.cpp.

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

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

Get last system error as string.

Retrieve last error code as string.

Definition at line 254 of file System.cpp.

254 {
255 const std::string errString = getErrorString(getLastError());
256 return errString;
257 }
System::getErrorString
GAUDI_API const std::string getErrorString(unsigned long error)
Retrieve error code as string for a given error.
Definition: System.cpp:260
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:244
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 189 of file System.cpp.

189 {
190 #ifdef _WIN32
191 *pFunction = (EntryPoint)::GetProcAddress((HINSTANCE)handle, name.data());
192 if ( 0 == *pFunction ) {
193 return System::getLastError();
194 }
195 return 1;
196 #elif defined(__linux)
197 #if __GNUC__ < 4
198 *pFunction = (EntryPoint)::dlsym(handle, name.c_str());
199 #else
200 *pFunction = FuncPtrCast<EntryPoint>(::dlsym(handle, name.c_str()));
201 #endif
202 if ( ! *pFunction ) {
203 errno = 0xAFFEDEAD;
204 // std::cout << "System::getProcedureByName>" << getLastErrorString() << std::endl;
205 return 0;
206 }
207 return 1;
208 #elif defined(__APPLE__)
209 *pFunction = (EntryPoint)::dlsym(handle, name.c_str());
210 if(!(*pFunction)) {
211 // Try with an underscore :
212 std::string sname = "_" + name;
213 *pFunction = (EntryPoint)::dlsym(handle, sname.c_str());
214 }
215 if ( 0 == *pFunction ) {
216 errno = 0xAFFEDEAD;
217 std::cout << "System::getProcedureByName>" << getLastErrorString() << std::endl;
218 //std::cout << "System::getProcedureByName> failure" << std::endl;
219 return 0;
220 }
221 return 1;
222 #elif __hpux
223 HMODULE* mod = (HMODULE*)handle;
224 if ( 0 != mod ) {
225 long ll1 = name.length();
226 for ( int i = 0; i < mod->numSym; i++ ) {
227 long ll2 = strlen(mod->sym[i].name);
228 if ( 0 != ::strncmp(mod->sym[i].name, name.c_str(), (ll1>ll2) ? ll1 : ll2)==0 ) {
229 *pFunction = (EntryPoint) mod->sym[i].value;
230 return 1;
231 }
232 }
233 }
234 return 0;
235 #endif
236 }
Gaudi.CommonGaudiConfigurables.mod
tuple mod
Definition: CommonGaudiConfigurables.py:22
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:244
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
compareOutputFiles.sname
list sname
Definition: compareOutputFiles.py:393
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)
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:254
ana.i
list i
Definition: ana.py:128
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 239 of file System.cpp.

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

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

Retrieve Process structure.

Definition at line 384 of file ProcessDescriptor.cpp.

384 {
385 static ProcessDescriptor p;
386 #ifdef _WIN32
387 static bool first = true;
388 if ( first ) {
389 first = false;
390 void* mh = ::LoadLibrary("NTDll.dll");
391 if ( mh ) {
392 NtApi::NtQueryInformationProcess = (NtApi::__NtQueryInformationProcess)
393 ::GetProcAddress((HINSTANCE)mh, "NtQueryInformationProcess");
394 }
395 }
396 #endif
397 return &p;
398 }

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

178 {
179 KERNEL_USER_TIMES info;
180 if (getProcess()->query(pid, Times, &info)) {
181 return ProcessTime(info.KernelTime,
182 info.UserTime,
183 currentTime(Native) - info.CreateTime);
184 }
185 return ProcessTime(); // return 0s in case of problems
186 }
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
System::Times
Definition: SystemBase.h:20
System::Native
Definition: Timing.h:51
System::currentTime
GAUDI_API longlong currentTime(TimeType typ=milliSec)
Retrieve absolute system time.
Definition: Timing.cpp:79

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:617
std::string
STL class.
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191

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

Host name.

Definition at line 438 of file System.cpp.

438 {
439 static const std::string host = init_hostName();
440 return host;
441 }
std::string
STL class.

int System::instructionsetLevel | ( |  | ) |

Instruction Set "Level".

Definition at line 501 of file System.cpp.

501 {
502 return instrset_detect();
503 }
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 637 of file System.cpp.

637 {
638 return getenv(var) != nullptr;
639 }
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 148 of file Timing.cpp.

148 {
149 KERNEL_USER_TIMES info;
150 longlong kerneltime = 0;
151 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) ) {
152 kerneltime = adjustTime(typ, info.KernelTime );
153 }
154 return kerneltime;
155 }
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
__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

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
root_map_dump.maps
tuple maps
Definition: root_map_dump.py:54
std::vector::push_back
T push_back(T...args)
std::strlen
T strlen(T...args)
std::vector::size
T size(T...args)
std::strncmp
T strncmp(T...args)
ana.i
list i
Definition: ana.py:128

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

Load dynamic link library.

Definition at line 124 of file System.cpp.

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

482 {
483 static std::string mach = "";
484 #ifdef _WIN32
485 SYSTEM_INFO ut;
486 ::GetSystemInfo(&ut);
487 std::ostringstream arch;
488 arch << ut.wProcessorArchitecture;
489 mach = arch.str();
490 #else
491 struct utsname ut;
492 if (uname(&ut) == 0) {
493 mach = ut.machine;
494 } else {
495 mach = "UNKNOWN";
496 }
497 #endif
498 return mach;
499 }
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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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::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 }
Gaudi.CommonGaudiConfigurables.mod
tuple mod
Definition: CommonGaudiConfigurables.py:22
std::string::rfind
T rfind(T...args)
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
finalize_tags.basename
def basename(url)
Definition: finalize_tags.py:47
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)

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 }
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
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191

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
string type
Definition: gaudirun.py:151
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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

long System::numCmdLineArgs | ( |  | ) |

Number of arguments passed to the commandline.

Definition at line 530 of file System.cpp.

530 {
531 return cmdLineArgs().size();
532 }
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:540

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
System::NoFetch
Definition: SystemBase.h:18

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

OS name.

Definition at line 444 of file System.cpp.

444 {
445 static std::string osname = "";
446 #ifdef _WIN32
447 osname = "Windows";
448 #else
449 struct utsname ut;
450 if (uname(&ut) == 0) {
451 osname = ut.sysname;
452 } else {
453 osname = "UNKNOWN";
454 }
455 #endif
456 return osname;
457 }
std::string
STL class.

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

OS version.

Definition at line 461 of file System.cpp.

461 {
462 static std::string osver = "";
463 #ifdef _WIN32
464 OSVERSIONINFO ut;
465 ut.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
466 ::GetVersionEx(&ut);
467 std::ostringstream ver;
468 ver << ut.dwMajorVersion << '.' << ut.dwMinorVersion;
469 osver = ver.str();
470 #else
471 struct utsname ut;
472 if (uname(&ut) == 0) {
473 osver = ut.release;
474 } else {
475 osver = "UNKNOWN";
476 }
477 #endif
478 return osver;
479 }
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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
System::NoFetch
Definition: SystemBase.h:18
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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
System::NoFetch
Definition: SystemBase.h:18

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

124 {
125 longlong left = 0;
126 QUOTA_LIMITS quota;
127 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) ) {
128 if ( left == -1 ) {
129 //left = _I64_MAX;
130 }
131 else {
132 left = adjustTime(typ, quota.TimeLimit);
133 }
134 }
135 return left;
136 }
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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 }
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
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 745 of file System.cpp.

746 {
747 #ifndef WIN32
748 // UNIX version
749 return value.empty() ?
750 // remove if set to nothing (and return success)
751 ::unsetenv(name.c_str()) , 0 :
752 // set the value
753 ::setenv(name.c_str(),value.c_str(), overwrite);
754 #else
755 // Windows version
756 if ( value.empty() ) {
757 // equivalent to unsetenv
758 return ::_putenv((name+"=").c_str());
759 }
760 else {
761 if ( !getenv(name.c_str()) || overwrite ) {
762 // set if not yet present or overwrite is set (force)
763 return ::_putenv((name+"="+value).c_str());
764 }
765 }
766 return 0; // if we get here, we are trying to set a variable already set, but
767 // not to overwrite.
768 // It is considered a success on Linux (man P setenv)
769 #endif
770
771 }
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 97 of file Timing.cpp.

97 {
98 static longlong sys_start = 0;
99 if ( 0 == sys_start ) {
100 longlong c = currentTime(microSec);
101 longlong t = tickCount();
102 sys_start = 10*c - t;
103 }
104 return adjustTime(typ, sys_start);
105 }
gaudirun.c
tuple 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:51
__longlong
Definition: Kernel.h:56
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::currentTime
GAUDI_API longlong currentTime(TimeType typ=milliSec)
Retrieve absolute system time.
Definition: Timing.cpp:79

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:617
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 297 of file System.cpp.

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

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

Definition at line 301 of file System.cpp.

301 {
302 std::string result;
303 #ifdef _WIN32
304 long off = 0;
305 if ( ::strncmp(class_name, "class ", 6) == 0 ) {
306 // The returned name is prefixed with "class "
307 off = 6;
308 }
309 if ( ::strncmp(class_name, "struct ", 7) == 0 ) {
310 // The returned name is prefixed with "struct "
311 off = 7;
312 }
313 if ( off > 0 ) {
314 std::string tmp = class_name + off;
315 long loc = 0;
316 while( (loc = tmp.find("class ")) > 0 ) {
317 tmp.erase(loc, 6);
318 }
319 loc = 0;
320 while( (loc = tmp.find("struct ")) > 0 ) {
321 tmp.erase(loc, 7);
322 }
323 result = tmp;
324 }
325 else {
326 result = class_name;
327 }
328 // Change any " *" to "*"
329 while ( (off=result.find(" *")) != std::string::npos ) {
330 result.replace(off, 2, "*");
331 }
332 // Change any " &" to "&"
333 while ( (off=result.find(" &")) != std::string::npos ) {
334 result.replace(off, 2, "&");
335 }
336
337 #elif defined(__linux) || defined(__APPLE__)
338 if ( ::strlen(class_name) == 1 ) {
339 // See http://www.realitydiluted.com/mirrors/reality.sgi.com/dehnert_engr/cxx/abi.pdf
340 // for details
341 switch(class_name[0]) {
342 case 'v':
343 result = "void";
344 break;
345 case 'w':
346 result = "wchar_t";
347 break;
348 case 'b':
349 result = "bool";
350 break;
351 case 'c':
352 result = "char";
353 break;
354 case 'a':
355 result = "signed char";
356 break;
357 case 'h':
358 result = "unsigned char";
359 break;
360 case 's':
361 result = "short";
362 break;
363 case 't':
364 result = "unsigned short";
365 break;
366 case 'i':
367 result = "int";
368 break;
369 case 'j':
370 result = "unsigned int";
371 break;
372 case 'l':
373 result = "long";
374 break;
375 case 'm':
376 result = "unsigned long";
377 break;
378 case 'x':
379 result = "long long";
380 break;
381 case 'y':
382 result = "unsigned long long";
383 break;
384 case 'n':
385 result = "__int128";
386 break;
387 case 'o':
388 result = "unsigned __int128";
389 break;
390 case 'f':
391 result = "float";
392 break;
393 case 'd':
394 result = "double";
395 break;
396 case 'e':
397 result = "long double";
398 break;
399 case 'g':
400 result = "__float128";
401 break;
402 case 'z':
403 result = "ellipsis";
404 break;
405 }
406 }
407 else {
408 int status;
409 auto realname = std::unique_ptr<char,decltype(free)*>( abi::__cxa_demangle(class_name, nullptr, nullptr, &status), std::free );
410 if (!realname) return class_name;
411 result = std::string{realname.get()};
413 std::string::size_type pos = result.find(", ");
414 while( std::string::npos != pos ) {
415 result.replace( pos , 2 , "," ) ;
416 pos = result.find(", ");
417 }
418 }
419 #endif
420 return result;
421 }
std::free
T free(T...args)
std::string
STL class.
std::strlen
T strlen(T...args)
std::string::replace
T replace(T...args)
std::string::erase
T erase(T...args)
std::string::find
T find(T...args)
std::unique_ptr
STL class.
std::strncmp
T strncmp(T...args)

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

unload dynamic link library

Definition at line 163 of file System.cpp.

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

108 {
109 static longlong sys_start = 10*systemStart(microSec);
110 return adjustTime(typ, 10*currentTime(microSec)-sys_start);
111 }
System::systemStart
GAUDI_API longlong systemStart(TimeType typ=Sec)
Maximum processing time left for this process.
Definition: Timing.cpp:97
System::microSec
Definition: Timing.h:51
__longlong
Definition: Kernel.h:56
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::currentTime
GAUDI_API longlong currentTime(TimeType typ=milliSec)
Retrieve absolute system time.
Definition: Timing.cpp:79

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

158 {
159 longlong usertime = 0;
160 KERNEL_USER_TIMES info;
161 if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) ) {
162 usertime = adjustTime(typ, info.UserTime );
163 }
164 return usertime;
165 }
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
__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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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

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::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.cpp:384
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