| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Classes | Typedefs | Enumerations | Functions

# System Namespace Reference

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

## Classes
class | PathResolver
class | ProcessTime
| Simple class to hold the time information of a process. More...
struct | PROCESS_BASIC_INFORMATION
struct | QUOTA_LIMITS
| Process Quotas NtQueryInformationProcess using ProcessQuotaLimits NtQueryInformationProcess using ProcessPooledQuotaLimits NtSetInformationProcess using ProcessQuotaLimits. More...
struct | IO_COUNTERS
| Process I/O Counters NtQueryInformationProcess using ProcessIoCounters. More...
struct | VM_COUNTERS
| Process Virtual Memory Counters NtQueryInformationProcess using ProcessVmCounters. More...
struct | POOLED_USAGE_AND_LIMITS
| Process Pooled Quota Usage and Limits NtQueryInformationProcess using ProcessPooledUsageAndLimits. More...
struct | KERNEL_USER_TIMES
| Process/Thread System and User Time NtQueryInformationProcess using ProcessTimes NtQueryInformationThread using ThreadTimes. More...
class | ProcessDescriptor
| Provides access to process information. More...
## Typedefs
typedef void * | ImageHandle
| Definition of an image handle.
typedef void * | ProcessHandle
| Definition of the process handle.
typedef unsigned long(* | EntryPoint )(const unsigned long iid, void **ppvObject)
| Definition of the "generic" DLL entry point function.
typedef void *(* | Creator )()
| Definition of the "generic" DLL entry point function.
typedef void * | ThreadHandle
| A Thread handle.
typedef struct _PEB * | PPEB
| Basic Process Information NtQueryInformationProcess using ProcessBasicInfo.
## 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.
GAUDI_API long | breakExecution (long pid)
| Break the execution of the application and invoke the debugger in a remote process.
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)
GAUDI_API long | procID ()
| Basic Process Information: Process ID.
GAUDI_API long | parentID (InfoType fetch=ProcessBasics, long pid=-1)
| Basic Process Information: Parent's process ID.
GAUDI_API long | affinityMask (InfoType fetch=ProcessBasics, long pid=-1)
| Basic Process Information: Affinity mask.
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!)
GAUDI_API long | basePriority (InfoType fetch=ProcessBasics, long pid=-1)
| Basic Process Information: Base priority.
GAUDI_API long | priorityBoost (InfoType fetch=PriorityBoost, long pid=-1)
| Basic Process Information: priority boost.
GAUDI_API long | numPageFault (InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Number of page faults.
GAUDI_API long | pagefileUsage (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Current page file usage.
GAUDI_API long | pagefileUsagePeak (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Peak usage of page file.
GAUDI_API long | pagefileUsageLimit (MemoryUnit unit=kByte, InfoType fetch=Quota, long pid=-1)
| Basic Process Information: Peak usage of page file.
GAUDI_API long | nonPagedMemory (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Current usage of non paged memory.
GAUDI_API long | nonPagedMemoryPeak (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: Peak usage of non paged memory.
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.
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'.
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'.
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'.
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.
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.
GAUDI_API long | mappedMemory (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: priority boost.
GAUDI_API long | mappedMemoryPeak (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: priority boost.
GAUDI_API long | virtualMemory (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: priority boost.
GAUDI_API long | virtualMemoryPeak (MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
| Basic Process Information: priority boost.
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.
GAUDI_API const std::string & | moduleName ()
| Get the name of the (executable/DLL) file without file-type.
GAUDI_API const std::string & | moduleNameFull ()
| Get the full name of the (executable/DLL) file.
GAUDI_API ModuleType | moduleType ()
| Get type of the module.
GAUDI_API ProcessHandle | processHandle ()
| Handle to running process.
GAUDI_API ImageHandle | moduleHandle ()
| Handle to currently executed module.
GAUDI_API ImageHandle | exeHandle ()
| Handle to the executable file running.
GAUDI_API const std::string & | exeName ()
| Name of the executable file running.
GAUDI_API const std::vector < std::string > | linkedModules ()
| Vector of names of linked modules.
GAUDI_API void | setModuleHandle (ImageHandle handle)
| Attach module handle.
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.
GAUDI_API unsigned long | unloadDynamicLib (ImageHandle handle)
| unload dynamic link library
GAUDI_API unsigned long | getProcedureByName (ImageHandle handle, const std::string &name, EntryPoint *pFunction)
| Get a specific function defined in the DLL.
GAUDI_API unsigned long | getProcedureByName (ImageHandle handle, const std::string &name, Creator *pFunction)
| Get a specific function defined in the DLL.
GAUDI_API unsigned long | getLastError ()
| Get last system known error.
GAUDI_API const std::string | getLastErrorString ()
| Get last system error as string.
GAUDI_API const std::string | getErrorString (unsigned long error)
| Retrieve error code as string for a given error.
GAUDI_API const std::string | typeinfoName (const std::type_info &)
| Get platform independent information about the class type.
GAUDI_API const std::string | typeinfoName (const char *)
GAUDI_API const std::string & | hostName ()
| Host name.
GAUDI_API const std::string & | osName ()
| OS name.
GAUDI_API const std::string & | osVersion ()
| OS version.
GAUDI_API const std::string & | machineType ()
| Machine type.
GAUDI_API const std::string & | accountName ()
| User login name.
GAUDI_API long | numCmdLineArgs ()
| Number of arguments passed to the commandline.
GAUDI_API long | argc ()
| Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call...
GAUDI_API const std::vector < std::string > | cmdLineArgs ()
| Command line arguments including executable name as arg[0] as vector of strings.
GAUDI_API char ** | argv ()
| char** command line arguments including executable name as arg[0]; You may not modify them!
GAUDI_API std::string | getEnv (const char *var)
| get a particular environment variable (returning "UNKNOWN" if not set)
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.
bool | getEnv (const std::string &var, std::string &value)
GAUDI_API std::vector < std::string > | getEnv ()
| get all environment variables
GAUDI_API int | setEnv (const std::string &name, const std::string &value, int overwrite=1)
| Set an environment variables.
GAUDI_API bool | isEnvSet (const char *var)
| Check if an environment variable is set or not.
ThreadHandle | threadSelf ()
| thread handle "accessor"
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)
template<TimeType T>
long long | adjustTime (long long timevalue)
| Convert the time from OS native time to requested representation (Experts only)
GAUDI_API longlong | ellapsedTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| Elapsed time since start of process in milliseconds.
GAUDI_API longlong | kernelTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| CPU kernel mode time of process in milliseconds.
GAUDI_API longlong | userTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| CPU user mode time of process in milliseconds.
GAUDI_API longlong | cpuTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| Consumed CPU time of process in milliseconds.
GAUDI_API longlong | remainingTime (TimeType typ=milliSec, InfoType fetch=Quota, long pid=-1)
| Maximum processing time left for this process.
GAUDI_API longlong | creationTime (TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
| Process Creation time.
GAUDI_API longlong | systemStart (TimeType typ=Sec)
| Maximum processing time left for this process.
GAUDI_API longlong | upTime (TimeType typ=Hour)
| Maximum processing time left for this process.
GAUDI_API longlong | currentTime (TimeType typ=milliSec)
| Retrieve absolute system time.
GAUDI_API longlong | tickCount ()
| Retrieve the number of ticks since system startup.
GAUDI_API ProcessTime | getProcessTime (long pid=-1)
| Retrieve the process time data for a process.
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)
static bool | PR_find (const bf::path &file, const string &search_list, PR_file_type file_type, PathResolver::SearchType search_type, string &result)
ProcessDescriptor * | getProcess ()
| Retrieve Process structure.

## 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 38 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 36 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 18 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 99 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.

                      {   NoFetch,
                          RemainTime,
                          Times,
                          ProcessBasics,
                          PriorityBoost,
                          Memory,
                          Quota,
                          System,
                          Modules,
                          IO };

enum System::MemoryUnit

Unit of memory.

Enumerator:

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

Definition at line 57 of file Memory.h.

    { Byte, kByte, MByte, GByte, TByte, PByte, EByte };

enum System::ModuleType

Enumerator:

  UNKNOWN |
  SHAREDLIB |
  EXECUTABLE |

Definition at line 28 of file ModuleInfo.h.

    { UNKNOWN, SHAREDLIB, EXECUTABLE };

enum System::PR_file_type

Enumerator:

  PR_regular_file |
  PR_directory |

Definition at line 35 of file PathResolver.cpp.

                 {
      PR_regular_file,
      PR_directory
    } PR_file_type;

enum System::PR_search_type

Enumerator:

  PR_local |
  PR_recursive |

Definition at line 40 of file PathResolver.cpp.

                 {
      PR_local,
      PR_recursive
    } PR_search_type;

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.

                              {
          ProcessBasicInformation,
          ProcessQuotaLimits,
          ProcessIoCounters,
          ProcessVmCounters,
          ProcessTimes,
          ProcessBasePriority,
          ProcessRaisePriority,
          ProcessDebugPort,
          ProcessExceptionPort,
          ProcessAccessToken,
          ProcessLdtInformation,
          ProcessLdtSize,
          ProcessDefaultHardErrorMode,
          ProcessIoPortHandlers,          // Note: this is kernel mode only
          ProcessPooledUsageAndLimits,
          ProcessWorkingSetWatch,
          ProcessUserModeIOPL,
          ProcessEnableAlignmentFaultFixup,
          ProcessPriorityClass,
          ProcessWx86Information,
          ProcessHandleCount,
          ProcessAffinityMask,
          ProcessPriorityBoost,
          MaxProcessInfoClass,  //
          ProcessEllapsedTime
      };

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.

    { Year, Month, Day, Hour, Min, Sec, milliSec, microSec, nanoSec, Native };

## Function Documentation

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

User login name.

Definition at line 495 of file System.cpp.

                                         {
      static std::string account = "";
      if ( account == "" ) {
    #ifdef _WIN32
        char buffer[512];
        unsigned long buflen = sizeof(buffer);
        ::GetUserName(buffer, &buflen);
        account = buffer;
    #else
        const char* acct = ::getlogin();
        if ( 0 == acct ) acct = ::getenv("LOGNAME");
        if ( 0 == acct ) acct = ::getenv("USER");
        account = (acct) ? acct : "Unknown";
    #endif
      }
      return account;
    }

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

                                                              {
      if ( value != -1 )    {
        switch ( unit )   {
        case Byte:   break;
        case kByte:     value =       value/1024;    break;
        case MByte:     value =      (value/1024)/1024;    break;
        case GByte:     value =     ((value/1024)/1024)/1024;    break;
        case TByte:     value =    (((value/1024)/1024)/1024)/1024;    break;
        case PByte:     value =   ((((value/1024)/1024)/1024)/1024)/1024;    break;
        case EByte:     value =  (((((value/1024)/1024)/1024)/1024)/1024)/1024;    break;
        default:        value =  -1;    break;
        }
      }
      return value;
    }

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

                                                          {
      if ( t != -1 )   {
    #ifndef _WIN32

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

    #endif
        switch( typ )   {
        case Year    :  return adjustTime<Year    >(t);
        case Month   :  return adjustTime<Month   >(t);
        case Day     :  return adjustTime<Day     >(t);
        case Hour    :  return adjustTime<Hour    >(t);
        case Min     :  return adjustTime<Min     >(t);
        case Sec     :  return adjustTime<Sec     >(t);
        case milliSec:  return adjustTime<milliSec>(t);
        case microSec:  return adjustTime<microSec>(t);
        case nanoSec :  return adjustTime<nanoSec >(t);
        case Native  :  return adjustTime<Native  >(t);
        }
      }
      return t;
    }

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

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

template<>

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

Definition at line 191 of file Timing.h.

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

template<>

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

Definition at line 207 of file Timing.h.

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

template<>

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

Definition at line 203 of file Timing.h.

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

template<>

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

Definition at line 195 of file Timing.h.

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

template<>

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

Definition at line 215 of file Timing.h.

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

template<>

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

Definition at line 211 of file Timing.h.

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

template<>

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

Definition at line 219 of file Timing.h.

                                                       {
        return t;
      }

template<>

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

Definition at line 199 of file Timing.h.

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

template<>

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

Definition at line 183 of file Timing.h.

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

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

Basic Process Information: Affinity mask.

Definition at line 74 of file Memory.cpp.

                                                        {
      PROCESS_BASIC_INFORMATION info;
      if ( fetch != NoFetch && getProcess()->query(pid, ProcessBasics, &info) )
        return info.AffinityMask;
      return 0;
    }

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

                         {
      return cmdLineArgs().size();
    }

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

                           {
      if( s_argvChars.empty() ) { cmdLineArgs(); }

      // We rely here on the fact that a vector's allocation table is contiguous
      return (char**)&s_argvChars[0];
    }

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

    {
      // Always hide the first two levels of the stack trace (that's us)
      const int totalOffset = offset + 2;
      const int totalDepth = depth + totalOffset;

      std::string fnc, lib;

      void** addresses = (void**) malloc(totalDepth*sizeof(void *));
      if ( addresses != 0 ){
        int count = System::backTrace(addresses,totalDepth);
        for (int i = totalOffset; i < count; ++i) {
          void *addr = 0;

          if (System::getStackLevel(addresses[i],addr,fnc,lib)) {
            std::ostringstream ost;
            ost << "#" << std::setw(3) << std::setiosflags( std::ios::left ) << i-totalOffset+1;
            ost << std::hex << addr << std::dec << " " << fnc << "  [" << lib << "]" << std::endl;
            btrace += ost.str();
          }
        }
        free(addresses);
      }
      else {
        free(addresses);
        return false;
      }

      return true;
    }

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

Basic Process Information: Base priority.

Definition at line 52 of file Memory.cpp.

                                                        {
      PROCESS_BASIC_INFORMATION info;
      if ( fetch != NoFetch && getProcess()->query(pid, ProcessBasics, &info) )
        return info.BasePriority;
      return 0;
    }

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.

                                          {
    #ifdef _WIN32
      long result = 0;
      if ( pid == Win::_getpid() )    {
        _asm int 3
        return 1;
      }
      else    {
        Win::LPTHREAD_START_ROUTINE fun;
        Win::HANDLE th, ph;
        Win::HINSTANCE mh;
        Win::DWORD id;
        mh = Win::LoadLibrary( "Kernel32" );
        if ( 0 != mh )    {
          fun = (Win::LPTHREAD_START_ROUTINE)Win::GetProcAddress(mh, "DebugBreak");
          if ( 0 != fun )   {
            ph = Win::OpenProcess (PROCESS_ALL_ACCESS, TRUE, pid);
            if ( 0 != ph )      {
              th = Win::CreateRemoteThread(ph,NULL,0,fun,0,0,&id);
              if ( 0 != th )   {
                Win::CloseHandle(th);
                result = 1;
              }
              Win::CloseHandle(ph);
            }
          }
          Win::FreeLibrary(mh);
        }
      }
      if ( result != 1 ) result = Win::GetLastError();
      return result;
    #else
      // I have no clue how to do this in linux
      return pid;
    #endif
    }

long System::breakExecution | ( | ) |

Break the execution of the application and invoke the debugger.

Definition at line 47 of file Debugger.cpp.

                                  {
    #ifdef _WIN32
      _asm int 3
      return 1;
    #else
      // I have no clue how to do this in linux
      return 0;
    #endif
    }

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

                                                      {
      if ( s_argvChars.size() == 0 )    {
        char exe[1024];
    #ifdef _WIN32

        // Disable warning C4996 triggered by C standard library calls
    #pragma warning(push)
    #pragma warning(disable:4996)
        // For compatibility with UNIX we CANNOT use strtok!
        // If we would use strtok, options like -g="My world" at
        // the command line level would result on NT in TWO options
        // instead in one as in UNIX.
        char *next, *tmp1, *tmp2;
        for(LPTSTR cmd = ::GetCommandLine(); *cmd; cmd=next)   {
          memset(exe,0,sizeof(exe));
          while ( *cmd == ' ' ) cmd++;
          next=::strchr(cmd,' ');
          if ( !next ) next = cmd + strlen(cmd);
          if ( (tmp1=::strchr(cmd,'\"')) > 0 && tmp1 < next )  {
            tmp2 = ::strchr(++tmp1,'\"');
            if ( tmp2 > 0 )   {
              next = ++tmp2;
              if ( cmd < tmp1 ) strncpy(exe, cmd, tmp1-cmd-1);
              strncpy(&exe[strlen(exe)], tmp1, tmp2-tmp1-1);
            }
            else    {
              std::cout << "Mismatched \" in command line arguments" << std::endl;
              s_argvChars.erase(s_argvChars.begin(), s_argvChars.end());
              s_argvStrings.erase(s_argvStrings.begin(), s_argvStrings.end());
              return s_argvStrings;
            }
          }
          else    {
            strncpy(exe, cmd, next-cmd);
          }
          s_argvStrings.push_back(exe);
          s_argvChars.push_back( s_argvStrings.back().c_str());
        }
    #pragma warning(pop)
    #elif defined(linux) || defined(__APPLE__)
        sprintf(exe, "/proc/%d/cmdline", ::getpid());
        FILE *cmdLine = ::fopen(exe,"r");
        char cmd[1024];
        if ( cmdLine )   {
          long len = fread(cmd, sizeof(char), sizeof(cmd), cmdLine);
          if ( len > 0 )   {
            cmd[len] = 0;
            for ( char* token = cmd; token-cmd < len; token += strlen(token)+1 )  {
              s_argvStrings.push_back(token);
              s_argvChars.push_back( s_argvStrings.back().c_str());
            }
            s_argvStrings[0] = exeName();
            s_argvChars[0]   = s_argvStrings[0].c_str();
          }
        }
        ::fclose(cmdLine);
    #endif
      }
      return s_argvStrings;
    }

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

                                                                   {
      longlong cputime = 0;
      KERNEL_USER_TIMES info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )   {
        cputime = adjustTime(typ, info.KernelTime+info.UserTime );
      }
      return cputime;
    }

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

                                                                          {
      longlong created = 0;
      KERNEL_USER_TIMES info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )   {
        created = adjustTime(typ, info.CreateTime-UNIX_BASE_TIME);
      }
      return created;
    }

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

                                                {
      longlong current = 0;
    #ifdef _WIN32
      ::GetSystemTimeAsFileTime((FILETIME*)&current);
      current -= UNIX_BASE_TIME;
    #else
      struct timeval tv;
      struct timezone tz;
      ::gettimeofday(&tv, &tz);
      current  = tv.tv_sec;
      current *= 1000000;
      current += tv.tv_usec;
      current *= 10;
    #endif
      return adjustTime(typ, current);
    }

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

                                                                        {
      KERNEL_USER_TIMES info;
      longlong ellapsed = currentTime(microSec)*10;
      getProcess()->query(pid, fetch, &info);
      ellapsed = adjustTime(typ, ellapsed+UNIX_BASE_TIME-info.CreateTime);
      return ellapsed;
    }

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

Handle to the executable file running.

Definition at line 172 of file ModuleInfo.cpp.

                                           {
    #ifdef _WIN32
      if ( processHandle() )    {
        static HINSTANCE handle = 0;
        DWORD   cbNeeded;
        if ( 0 == handle && _psApi.isValid() )    {
          if ( _psApi.EnumProcessModules( processHandle(), &handle, sizeof(ModuleHandle), &cbNeeded) )   {
          }
        }
        return handle;
      }
      return 0;
    #elif defined(linux) || defined(__APPLE__)
      // This does NOT work!
      static Dl_info infoBuf, *info = &infoBuf;
      if ( 0 == info ) {
        void* handle = ::dlopen(0, RTLD_LAZY);
        //printf("Exe handle:%X\n", handle);
        if ( 0 != handle ) {
          void* func = ::dlsym(handle, "main");
          //printf("Exe:Func handle:%X\n", func);
          if ( 0 != func ) {
            if ( 0 != ::dladdr(func, &infoBuf) ) {
                    //std::cout << "All OK" << std::endl;
              info = &infoBuf;
            }
          }
        }
      }
      return info;
    #elif __hpux
      // Don't know how to solve this .....
      return 0;
    #endif
    }

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

Name of the executable file running.

Definition at line 208 of file ModuleInfo.cpp.

                                        {
      static std::string module("");
      if ( module.length() == 0 )    {
        char name[PATH_MAX] = {"Unknown.module"};
        name[0] = 0;
    #ifdef _WIN32
        if ( _psApi.isValid() && processHandle() )   {
          _psApi.GetModuleFileNameExA( processHandle(), (HINSTANCE)exeHandle(), name,sizeof(name) );
          module = name;
        }
    #elif defined(linux) || defined(__APPLE__)
        char cmd[512];
        ::sprintf(cmd, "/proc/%d/exe", ::getpid());
        module = "Unknown";
        if (::readlink(cmd, name, sizeof(name)) >= 0)
          module = name;
    #elif __hpux
        if (::realpath(((HMODULE*)exeHandle())->dsc.filename, name))
          module = name;
    #endif
      }
      return module;
    }

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

                                                      {
      PROCESS_BASIC_INFORMATION info;
      if ( fetch != NoFetch && getProcess()->query(pid, ProcessBasics, &info) )
        return info.ExitStatus;
      return -2;
    }

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

                                            {
      char* env;
      if  ( (env = getenv(var)) != 0 ) {
        return env;
      } else {
        return "UNKNOWN";
      }
    }

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

                                                         {
      char* env;
      if  ( (env = getenv(var)) != 0 ) {
        value = env;
        return true;
      } else {
        return false;
      }
    }

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

Definition at line 79 of file System.h.

                                                                 {
        return getEnv(var.c_str(), value);
      }

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

get all environment variables

get all defined environment vars

Definition at line 630 of file System.cpp.

                                        {
    #if defined(_WIN32)
    #  define environ _environ
    #elif defined(__APPLE__)
      static char **environ = *_NSGetEnviron();
    #endif
      std::vector<std::string> vars;
      for (int i=0; environ[i] != 0; ++i) {
        vars.push_back(environ[i]);
      }
      return vars;
    }

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

Retrieve error code as string for a given error.

Definition at line 252 of file System.cpp.

                                                                 {
      std::string errString =  "";
    #ifdef _WIN32
      LPVOID lpMessageBuffer;
      ::FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |  FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        error,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR) &lpMessageBuffer,
        0,
        NULL );
      errString = (const char*)lpMessageBuffer;
      // Free the buffer allocated by the system
      ::LocalFree( lpMessageBuffer );
    #else
      char *cerrString(0);
      // Remember: for linux dl* routines must be handled differently!
      if ( error == 0xAFFEDEAD ) {
        cerrString = (char*)::dlerror();
        if ( 0 == cerrString ) {
          cerrString = ::strerror(error);
        }
        if ( 0 == cerrString ) {
          cerrString = (char *)"Unknown error. No information found in strerror()!";
        }
        else {
          errString = std::string(cerrString);
        }
        errno = 0;
      }
      else    {
        cerrString = ::strerror(error);
        errString = std::string(cerrString);
      }
    #endif
      return errString;
    }

unsigned long System::getLastError | ( | ) |

Get last system known error.

Retrieve last error code.

Definition at line 236 of file System.cpp.

                                          {
    #ifdef _WIN32
      return ::GetLastError();
    #else
      // convert errno (int) to unsigned long
      return static_cast<unsigned long>(static_cast<unsigned int>(errno));
    #endif
    }

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

Get last system error as string.

Retrieve last error code as string.

Definition at line 246 of file System.cpp.

                                                  {
      const std::string errString = getErrorString(getLastError());
      return errString;
    }

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

Get a specific function defined in the DLL.

Definition at line 181 of file System.cpp.

                                                                                                                {
    #ifdef _WIN32
      *pFunction = (EntryPoint)::GetProcAddress((HINSTANCE)handle, name.data());
      if ( 0 == *pFunction )    {
        return System::getLastError();
      }
      return 1;
    #elif defined(linux)
    #if __GNUC__ < 4
      *pFunction = (EntryPoint)::dlsym(handle, name.c_str());
    #else
      *pFunction = FuncPtrCast<EntryPoint>(::dlsym(handle, name.c_str()));
    #endif
      if ( 0 == *pFunction )    {
        errno = 0xAFFEDEAD;
       // std::cout << "System::getProcedureByName>" << getLastErrorString() << std::endl;
        return 0;
      }
      return 1;
    #elif defined(__APPLE__)
      *pFunction = (EntryPoint)::dlsym(handle, name.c_str());
      if(!(*pFunction)) {
        // Try with an underscore :
        std::string sname = "_" + name;
        *pFunction = (EntryPoint)::dlsym(handle, sname.c_str());
      }
      if ( 0 == *pFunction )    {
        errno = 0xAFFEDEAD;
        std::cout << "System::getProcedureByName>" << getLastErrorString() << std::endl;
        //std::cout << "System::getProcedureByName> failure" << std::endl;
        return 0;
      }
      return 1;
    #elif __hpux
      HMODULE* mod = (HMODULE*)handle;
      if ( 0 != mod ) {
        long ll1 = name.length();
        for ( int i = 0; i < mod->numSym; i++ ) {
          long ll2 = strlen(mod->sym[i].name);
          if ( 0 != ::strncmp(mod->sym[i].name, name.c_str(), (ll1>ll2) ? ll1 : ll2)==0 ) {
                  *pFunction = (EntryPoint) mod->sym[i].value;
                  return 1;
          }
        }
      }
      return 0;
    #endif
    }

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

Get a specific function defined in the DLL.

Definition at line 231 of file System.cpp.

                                                                                                             {
      return getProcedureByName(handle, name, (EntryPoint*)pFunction);
    }

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

Retrieve Process structure.

Definition at line 384 of file ProcessDescriptor.cpp.

                                                  {
      static ProcessDescriptor p;
    #ifdef _WIN32
      static bool first = true;
      if ( first )    {
        first = false;
        void* mh = ::LoadLibrary("NTDll.dll");
        if ( mh )  {
          NtApi::NtQueryInformationProcess = (NtApi::__NtQueryInformationProcess)
            ::GetProcAddress((HINSTANCE)mh, "NtQueryInformationProcess");
        }
      }
    #endif
      return &p;
    }

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

                                           {
        KERNEL_USER_TIMES info;
        if (getProcess()->query(pid, Times, &info)) {
          return ProcessTime(info.KernelTime,
                             info.UserTime,
                             currentTime(Native) - info.CreateTime);
        }
        return ProcessTime(); // return 0s in case of problems
      }

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.

                                     {
      // Return the user's home directory.
      std::string home_dir = "./";
      // Try to replace the current value with the content of several
      // environment variables
      if ( ! (System::getEnv("home", home_dir) ||
              System::getEnv("HOME", home_dir)) ) {
        // for Windows NT HOME might be defined as either $(HOMESHARE)/$(HOMEPATH)
        //                                         or     $(HOMEDRIVE)/$(HOMEPATH)
        if ( System::getEnv("HOMESHARE", home_dir) ||
             System::getEnv("HOMEDRIVE", home_dir) ) {
          std::string path;
          if (System::getEnv("HOMEPATH", path))
            home_dir += path;
        }
      }
      return home_dir;
    }

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

Host name.

Definition at line 420 of file System.cpp.

                                      {
      static std::string host = "";
      if ( host == "" ) {
        char buffer[512];
        memset(buffer,0,sizeof(buffer));
    #ifdef _WIN32
        unsigned long len = sizeof(buffer);
        ::GetComputerName(buffer, &len);
    #else
        ::gethostname(buffer, sizeof(buffer));
    #endif
        host = buffer;
      }
      return host;
    }

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

Check if an environment variable is set or not.

Definition at line 621 of file System.cpp.

                                         {
      return getenv(var) != 0;
    }

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

                                                                      {
      KERNEL_USER_TIMES info;
      longlong kerneltime = 0;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )   {
        kerneltime = adjustTime(typ, info.KernelTime );
      }
      return kerneltime;
    }

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

Vector of names of linked modules.

Definition at line 232 of file ModuleInfo.cpp.

                                                        {
      if ( s_linkedModules.size() == 0 )    {
    #ifdef _WIN32
        char   name[255];  // Maximum file name length on NT 4.0
        DWORD  cbNeeded;
        HINSTANCE handle[1024];
        if ( _psApi.isValid() )    {
          if ( _psApi.EnumProcessModules(processHandle(),handle,sizeof(handle),&cbNeeded) )   {
            for (size_t i = 0; i < cbNeeded/sizeof(HANDLE); i++ )    {
              if ( 0 < _psApi.GetModuleFileNameExA( processHandle(), handle[i], name, sizeof(name)) )   {
                s_linkedModules.push_back(name);
              }
            }
          }
        }
    #elif defined(linux) || defined(__APPLE__)
        char ff[512], cmd[1024], fname[1024], buf1[64], buf2[64], buf3[64], buf4[64];
        ::sprintf(ff, "/proc/%d/maps", ::getpid());
        FILE* maps = ::fopen(ff, "r");
        while( ::fgets(cmd, sizeof(cmd), maps) ) {
          int len;
          sscanf(cmd, "%s %s %s %s %d %s", buf1, buf2, buf3, buf4, &len, fname);
          if ( len > 0 && strncmp(buf2,"r-xp",strlen("r-xp")) == 0 ) {
            s_linkedModules.push_back(fname);
          }
        }
        ::fclose(maps);
    #endif
      }
      return s_linkedModules;
    }

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

Load dynamic link library.

Definition at line 123 of file System.cpp.

                                                                                   {
      unsigned long res;
      // if name is empty, just load it
      if (name.length() == 0) {
        res = loadWithoutEnvironment(name, handle);
      } else {
        // If the name is a logical name (environment variable), the try
        // to load the corresponding library from there.
        std::string imgName;
        if ( getEnv(name, imgName) )    {
          res = loadWithoutEnvironment(imgName, handle);
        } else {
          // build the dll name
          std::string dllName = name;
    #if defined(linux) || defined(__APPLE__)
          dllName = "lib" + dllName;
    #endif
          dllName += SHLIB_SUFFIX;
          // try to locate the dll using the standard PATH
          res = loadWithoutEnvironment(dllName, handle);
        }
        if ( res != 1 ) {
    #if defined(linux) || defined(__APPLE__)
          errno = 0xAFFEDEAD;
    #endif
         // std::cout << "System::loadDynamicLib>" << getLastErrorString() << std::endl;
        }
      }
      return res;
    }

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

Machine type.

Definition at line 475 of file System.cpp.

                                         {
      static std::string mach = "";
    #ifdef _WIN32
      SYSTEM_INFO ut;
      ::GetSystemInfo(&ut);
      std::ostringstream arch;
      arch << ut.wProcessorArchitecture;
      mach = arch.str();
    #else
      struct utsname ut;
      if (uname(&ut) == 0) {
        mach = ut.machine;
      } else {
        mach = "UNKNOWN";
      }
    #endif
      return mach;
    }

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

Basic Process Information: priority boost.

Definition at line 181 of file Memory.cpp.

                                                                         {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.WorkingSetSize);
      return -2;
    }

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

Basic Process Information: priority boost.

Definition at line 189 of file Memory.cpp.

                                                                             {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.PeakWorkingSetSize);
      return -2;
    }

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

                                                                           {
      QUOTA_LIMITS quota;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )
        return adjustMemory(unit, quota.MaximumWorkingSetSize);
      return 0;
    }

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

                                                                           {
      QUOTA_LIMITS quota;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )
        return adjustMemory(unit, quota.MinimumWorkingSetSize);
      return 0;
    }

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

Handle to currently executed module.

Definition at line 141 of file ModuleInfo.cpp.

                                              {
      if ( 0 == ModuleHandle )    {
        if ( processHandle() )    {
    #ifdef _WIN32
          static HINSTANCE handle = 0;
          DWORD   cbNeeded;
          if ( 0 == handle && _psApi.isValid() )    {
            if ( _psApi.EnumProcessModules( processHandle(), &handle, sizeof(ModuleHandle), &cbNeeded) )   {
            }
          }
          return handle;
    #elif defined(linux) || defined(__APPLE__)
          static Dl_info info;
          if ( 0 !=
               ::dladdr(
    #if __GNUC__ < 4
                   (void*)System::moduleHandle
    #else
                   FuncPtrCast<void*>(System::moduleHandle)
    #endif
                   , &info) ) {
            return &info;
          }
    #elif __hpux
          return 0;  // Don't know how to solve this .....
    #endif
        }
      }
      return ModuleHandle;
    }

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

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

Retrieve base name of module.

Definition at line 55 of file ModuleInfo.cpp.

                                          {
      static std::string module("");
      if ( module == "" )   {
        if ( processHandle() && moduleHandle() )    {
    #ifdef _WIN32
          char moduleName[256] = {"Unknown.module"};
          moduleName[0] = 0;
          if ( _psApi.isValid() )   {
            _psApi.GetModuleBaseNameA( processHandle(), (HINSTANCE)moduleHandle(), moduleName, sizeof(moduleName) );
          }
          std::string mod = moduleName;
    #elif defined(linux) || defined(__APPLE__)
          std::string mod = ::basename((char*)((Dl_info*)moduleHandle())->dli_fname);
    #elif __hpux
          std::string mod = ::basename(((HMODULE*)moduleHandle())->dsc.filename);
    #endif
          module = mod.substr(0, mod.rfind('.'));
        }
      }
      return module;
    }

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

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

Retrieve full name of module.

Definition at line 78 of file ModuleInfo.cpp.

                                              {
      static std::string module("");
      if ( module == "" )   {
        if ( processHandle() && moduleHandle() )    {
          char name[PATH_MAX] = {"Unknown.module"};
          name[0] = 0;
    #ifdef _WIN32
          if ( _psApi.isValid() )   {
            _psApi.GetModuleFileNameExA( processHandle(), (HINSTANCE)moduleHandle(), name,sizeof(name) );
            module = name;
          }
    #else
          const char *path =
    #  if defined(linux) || defined(__APPLE__)
              ((Dl_info*)moduleHandle())->dli_fname;
    #  elif __hpux
              ((HMODULE*)moduleHandle())->dsc.filename;
    #  endif
          if (::realpath(path, name))
            module = name;
    #endif
        }
      }
      return module;
    }

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

Get type of the module.

Definition at line 105 of file ModuleInfo.cpp.

                                          {
      static ModuleType type = UNKNOWN;
      if ( type == UNKNOWN )    {
        const std::string& module = moduleNameFull();
        int loc = module.rfind('.')+1;
        if ( loc == 0 )
          type = EXECUTABLE;
        else if ( module[loc] == 'e' || module[loc] == 'E' )
          type = EXECUTABLE;
    #ifdef _WIN32
        else if ( module[loc] == 'd' || module[loc] == 'D' )
    #else
        else if ( module[loc] == 's' && module[loc+1] == 'o' )
    #endif
          type = SHAREDLIB;
        else
          type = UNKNOWN;
      }
      return type;
    }

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

                                                                           {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.QuotaNonPagedPoolUsage);
      return -2;
    }

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

                                                                                {
      POOLED_USAGE_AND_LIMITS quota;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )
        return adjustMemory(unit, quota.NonPagedPoolLimit);
      return 0;
    }

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

                                                                               {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.QuotaPeakNonPagedPoolUsage);
      return -2;
    }

long System::numCmdLineArgs | ( | ) |

Number of arguments passed to the commandline.

Definition at line 514 of file System.cpp.

                                  {
      return cmdLineArgs().size();
    }

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

Basic Process Information: Number of page faults.

Basic Process Information: priority boost.

Definition at line 146 of file Memory.cpp.

                                                        {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return info.PageFaultCount;
      return -2;
    }

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

OS name.

Definition at line 437 of file System.cpp.

                                    {
      static std::string osname = "";
    #ifdef _WIN32
      osname = "Windows";
    #else
      struct utsname ut;
      if (uname(&ut) == 0) {
        osname = ut.sysname;
      } else {
        osname = "UNKNOWN";
      }
    #endif
      return osname;
    }

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

OS version.

Definition at line 454 of file System.cpp.

                                       {
      static std::string osver = "";
    #ifdef _WIN32
      OSVERSIONINFO ut;
      ut.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
      ::GetVersionEx(&ut);
      std::ostringstream ver;
      ver << ut.dwMajorVersion << '.' << ut.dwMinorVersion;
      osver = ver.str();
    #else
      struct utsname ut;
      if (uname(&ut) == 0) {
        osver = ut.release;
      } else {
        osver = "UNKNOWN";
      }
    #endif
      return osver;
    }

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

                                                                        {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.QuotaPagedPoolUsage);
      return -2;
    }

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

                                                                             {
      POOLED_USAGE_AND_LIMITS quota;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )
        return adjustMemory(unit, quota.PagedPoolLimit);
      return 0;
    }

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

                                                                            {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.QuotaPeakPagedPoolUsage);
      return -2;
    }

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

                                                                          {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.PagefileUsage);
      return -2;
    }

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

                                                                               {
      POOLED_USAGE_AND_LIMITS quota;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )    {
        if ( long(quota.PagefileLimit) < 0 )
          return -1;//LONG_MAX;
        return adjustMemory(unit, quota.PagefileLimit);
      }
      return -2;
    }

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

                                                                              {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.PeakPagefileUsage);
      return -2;
    }

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

Basic Process Information: Parent's process ID.

Definition at line 66 of file Memory.cpp.

                                                    {
      PROCESS_BASIC_INFORMATION info;
      if ( fetch != NoFetch && getProcess()->query(pid, ProcessBasics, &info) )
        return info.InheritedFromUniqueProcessId;
      return 0;
    }

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

Definition at line 228 of file PathResolver.cpp.

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

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

Definition at line 223 of file PathResolver.cpp.

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

static bool System::PR_find | ( | const bf::path & | file,
|  | const string & | search_list,
|  | PR_file_type | file_type,
|  | PathResolver::SearchType | search_type,
|  | string & | result
| ) |  | `[static]`

Definition at line 48 of file PathResolver.cpp.

                              {

      bool found(false);

      // look for file as specified first

      try {
        if ( ( file_type == PR_regular_file && is_regular_file( file ) ) ||
             ( file_type == PR_directory && is_directory( file ) ) ) {
          result = bf::system_complete(file).string();
          return true;
        }
      } catch (bf::filesystem_error /*err*/) {
      }

      // assume that "." is always part of the search path, so check locally first

      try {
        bf::path local = bf::initial_path() / file;
        if ( ( file_type == PR_regular_file && is_regular_file( local ) ) ||
             ( file_type == PR_directory && is_directory( local ) ) ) {
          result = bf::system_complete(file).string();
          return true;
        }
      } catch (bf::filesystem_error /*err*/) {
      }

      // iterate through search list
      vector<string> spv;
      split(spv, search_list, boost::is_any_of( path_separator), boost::token_compress_on);
      for (vector<string>::const_iterator itr = spv.begin();
           itr != spv.end(); ++itr ) {

        bf::path fp = *itr / file;

        try {
          if ( ( file_type == PR_regular_file && is_regular_file( fp ) ) ||
               ( file_type == PR_directory && is_directory( fp ) ) ) {
            result = bf::system_complete(fp).string();
            return true;
          }
        } catch (bf::filesystem_error /*err*/) {
        }

        // if recursive searching requested, drill down
        if (search_type == PathResolver::RecursiveSearch &&
            is_directory( bf::path(*itr) ) ) {

          bf::recursive_directory_iterator end_itr;
          try {
            for ( bf::recursive_directory_iterator ritr( *itr );
                  ritr != end_itr; ++ritr) {

              // skip if not a directory
              if (! is_directory( bf::path(*ritr) ) ) { continue; }

              bf::path fp2 = bf::path(*ritr) / file;
              if ( ( file_type == PR_regular_file && is_regular_file( fp2 ) ) ||
                   ( file_type == PR_directory && is_directory( fp2 ) ) ) {
                result = bf::system_complete( fp2 ).string();
                return true;
              }
            }
          } catch (bf::filesystem_error /*err*/) {
          }
        }

      }

      return found;
    }

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

Basic Process Information: priority boost.

Definition at line 90 of file Memory.cpp.

                                                         {
      long info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return info;
      return -2;
    }

void * System::processHandle | ( | ) |

Handle to running process.

Retrieve processhandle.

Definition at line 127 of file ModuleInfo.cpp.

                                  {
      static long pid = ::getpid();
    #ifdef _WIN32
      static HANDLE hP = ::OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,pid);
    #else
      static void* hP = (void*)pid;
    #endif
      return hP;
    }

long System::procID | ( | ) |

Basic Process Information: Process ID.

Definition at line 60 of file Memory.cpp.

                          {
      static long s_pid = ::getpid();
      return s_pid;
    }

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

                                                                           {
      longlong left = 0;
      QUOTA_LIMITS quota;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )   {
        if ( left == -1 )     {
          //left = _I64_MAX;
        }
        else  {
          left = adjustTime(typ, quota.TimeLimit);
        }
      }
      return left;
    }

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

Definition at line 51 of file Environment.cpp.

                                                                                       {
      std::string source = var;
      res = i_resolve(source, recursions);
      if ( res.find("${") == std::string::npos ) {
        return StatusCode::SUCCESS;
      }
      return StatusCode::FAILURE;
    }

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

    {
    #ifndef WIN32
      // UNIX version
      return value.empty() ?
        // remove if set to nothing (and return success)
        ::unsetenv(name.c_str()) , 0 :
        // set the value
        ::setenv(name.c_str(),value.c_str(), overwrite);
    #else
      // Windows version
      if ( value.empty() ) {
        // equivalent to unsetenv
        return ::_putenv((name+"=").c_str());
      }
      else {
        if ( !getenv(name.c_str()) || overwrite ) {
          // set if not yet present or overwrite is set (force)
          return ::_putenv((name+"="+value).c_str());
        }
      }
      return 0; // if we get here, we are trying to set a variable already set, but
                // not to overwrite.
                // It is considered a success on Linux (man P setenv)
    #endif

    }

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

Attach module handle.

Definition at line 137 of file ModuleInfo.cpp.

                                                            {
      ModuleHandle = handle;
    }

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

                                                {
      static longlong sys_start = 0;
      if ( 0 == sys_start )   {
        longlong c = currentTime(microSec);
        longlong t = tickCount();
        sys_start = 10*c - t;
      }
      return adjustTime(typ, sys_start);
    }

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

Definition at line 79 of file Environment.cpp.

                                      {
      // Return a user configured or systemwide directory to create
      // temporary files in.
      std::string dir;
      if ( System::getEnv("TEMP", dir) ||
           System::getEnv("TEMPDIR", dir) ||
           System::getEnv("TEMP_DIR", dir) ||
           System::getEnv("TMP", dir) ||
           System::getEnv("TMPDIR", dir) ||
           System::getEnv("TMP_DIR", dir)
         )
        return dir;
      else
        return homeDirectory();
    }

ThreadHandle System::threadSelf | ( | ) | `[inline]`

thread handle "accessor"

Definition at line 101 of file System.h.

    { return (void*)0; }

longlong System::tickCount | ( | ) |

Retrieve the number of ticks since system startup.

Returns:
  Requested value in the indicated units.

Definition at line 66 of file Timing.cpp.

                                  {
      longlong count = 10000;
    #ifdef _WIN32
      count *= ::GetTickCount(); // Number of milliSec since system startup
    #else
      struct tms buf;
      count *= 10*times(&buf);
    #endif
      return count;
    }

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

Get platform independent information about the class type.

Definition at line 291 of file System.cpp.

                                                                   {
      return typeinfoName(tinfo.name());
    }

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

Definition at line 295 of file System.cpp.

                                                                {
      std::string result;
    #ifdef _WIN32
      long off = 0;
      if ( ::strncmp(class_name, "class ", 6) == 0 )   {
        // The returned name is prefixed with "class "
        off = 6;
      }
      if ( ::strncmp(class_name, "struct ", 7) == 0 )   {
        // The returned name is prefixed with "struct "
        off = 7;
      }
      if ( off > 0 )    {
        std::string tmp = class_name + off;
        long loc = 0;
        while( (loc = tmp.find("class ")) > 0 )  {
          tmp.erase(loc, 6);
        }
        loc = 0;
        while( (loc = tmp.find("struct ")) > 0 )  {
          tmp.erase(loc, 7);
        }
        result = tmp;
      }
      else  {
        result = class_name;
      }
      // Change any " *" to "*"
      while ( (off=result.find(" *")) != std::string::npos ) {
        result.replace(off, 2, "*");
      }
      // Change any " &" to "&"
      while ( (off=result.find(" &")) != std::string::npos ) {
        result.replace(off, 2, "&");
      }

    #elif defined(__linux) || defined(__APPLE__)
        if ( ::strlen(class_name) == 1 ) {
          // See http://www.realitydiluted.com/mirrors/reality.sgi.com/dehnert_engr/cxx/abi.pdf
          // for details
          switch(class_name[0]) {
          case 'v':
            result = "void";
            break;
          case 'w':
            result = "wchar_t";
            break;
          case 'b':
            result = "bool";
            break;
          case 'c':
            result = "char";
            break;
          case 'a':
            result = "signed char";
            break;
          case 'h':
            result = "unsigned char";
            break;
          case 's':
            result = "short";
            break;
          case 't':
            result = "unsigned short";
            break;
          case 'i':
            result = "int";
            break;
          case 'j':
            result = "unsigned int";
            break;
          case 'l':
            result = "long";
            break;
          case 'm':
            result = "unsigned long";
            break;
          case 'x':
            result = "long long";
            break;
          case 'y':
            result = "unsigned long long";
            break;
          case 'n':
            result = "__int128";
            break;
          case 'o':
            result = "unsigned __int128";
            break;
          case 'f':
            result = "float";
            break;
          case 'd':
            result = "double";
            break;
          case 'e':
            result = "long double";
            break;
          case 'g':
            result = "__float128";
            break;
          case 'z':
            result = "ellipsis";
            break;
          }
        }
        else  {
          int   status;
          char* realname;
          realname = abi::__cxa_demangle(class_name, 0, 0, &status);
          if (realname == 0) return class_name;
          result = realname;
          free(realname);
          std::string::size_type pos = result.find(", ");
          while( std::string::npos != pos ) {
            result.replace( pos , 2 , "," ) ;
            pos = result.find(", ");
          }
        }
    #endif
      return result;
    }

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

unload dynamic link library

Definition at line 155 of file System.cpp.

                                                                {
    #ifdef _WIN32
      if ( !::FreeLibrary((HINSTANCE)handle) ) {
    #elif defined(linux) || defined(__APPLE__)
      ::dlclose( handle );
      if ( 0 ) {
    #elif __hpux
      // On HP we have to run finalization ourselves.....
      Creator pFinalize = 0;
      if ( getProcedureByName(handle, "_fini", &pFinalize) ) {
        pFinalize();
      }
      HMODULE* mod = (HMODULE*)handle;
      if ( 0 == ::shl_unload( mod->dsc.handle ) ) {
        delete mod;
      }
      else {
    #else
      if (false){
    #endif
        return getLastError();
      }
      return 1;
    }

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

                                           {
      static longlong sys_start = 10*systemStart(microSec);
      return adjustTime(typ, 10*currentTime(microSec)-sys_start);
    }

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

                                                                    {
      longlong usertime = 0;
      KERNEL_USER_TIMES info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )   {
        usertime = adjustTime(typ, info.UserTime );
      }
      return usertime;
    }

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

Basic Process Information: priority boost.

Definition at line 213 of file Memory.cpp.

                                                                          {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.VirtualSize);
      return -2;
    }

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

                                                                               {
      QUOTA_LIMITS quota;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &quota) )    {
        if ( long(quota.PagefileLimit) == -1 )
          return -1;//LONG_MAX;
        return adjustMemory(unit, quota.PagefileLimit);
      }
      return 0;
    }

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

Basic Process Information: priority boost.

Definition at line 221 of file Memory.cpp.

                                                                              {
      VM_COUNTERS info;
      if ( fetch != NoFetch && getProcess()->query(pid, fetch, &info) )
        return adjustMemory(unit, info.PeakVirtualSize);
      return -2;
    }

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines