The Gaudi Framework  master (37c0b60a)
ProcessDescriptor.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIKERNEL_PROCESS_H
12 #define GAUDIKERNEL_PROCESS_H
13 
14 // Framework include files
15 #include <GaudiKernel/Kernel.h>
16 #include <GaudiKernel/SystemBase.h>
17 
18 namespace System {
19  // Forward declarations
20  class ProcessDescriptor;
22  ProcessDescriptor* getProcess();
23 
27  typedef struct _PEB* PPEB;
29  long ExitStatus;
31  unsigned long AffinityMask;
33  unsigned long UniqueProcessId;
35  };
36 
42  struct QUOTA_LIMITS {
43  unsigned long PagedPoolLimit;
44  unsigned long NonPagedPoolLimit;
45  unsigned long MinimumWorkingSetSize;
46  unsigned long MaximumWorkingSetSize;
47  unsigned long PagefileLimit;
48  long long TimeLimit;
49  };
50 
54  struct IO_COUNTERS {
55  unsigned long ReadOperationCount;
56  unsigned long WriteOperationCount;
57  unsigned long OtherOperationCount;
58  // long long ReadOperationCount;
59  // long long WriteOperationCount;
60  // long long OtherOperationCount;
61  long long ReadTransferCount;
62  long long WriteTransferCount;
63  long long OtherTransferCount;
64  };
65 
69  struct VM_COUNTERS {
70  unsigned long PeakVirtualSize;
71  unsigned long VirtualSize;
72  unsigned long PageFaultCount;
73  unsigned long PeakWorkingSetSize;
74  unsigned long WorkingSetSize;
75  unsigned long QuotaPeakPagedPoolUsage;
76  unsigned long QuotaPagedPoolUsage;
78  unsigned long QuotaNonPagedPoolUsage;
79  unsigned long PagefileUsage;
80  unsigned long PeakPagefileUsage;
81  };
82 
87  unsigned long PeakPagedPoolUsage;
88  unsigned long PagedPoolUsage;
89  unsigned long PagedPoolLimit;
90  unsigned long PeakNonPagedPoolUsage;
91  unsigned long NonPagedPoolUsage;
92  unsigned long NonPagedPoolLimit;
93  unsigned long PeakPagefileUsage;
94  unsigned long PagefileUsage;
95  unsigned long PagefileLimit;
96  };
97 
103  long long CreateTime;
104  long long ExitTime;
105  long long KernelTime;
106  long long UserTime;
107  // long long EllapsedTime; // Added by M.Frank
108  };
109 
120  void* m_handle;
122 
123  public:
124  ProcessHandle( long pid );
125  virtual ~ProcessHandle();
126  long item() { return m_needRelease ? 1 : 0; }
127  void* handle() { return m_handle; }
128  };
129 
130  public:
132  virtual ~ProcessDescriptor();
133  long query( long pid, InfoType fetch, PROCESS_BASIC_INFORMATION* info );
134  long query( long pid, InfoType fetch, POOLED_USAGE_AND_LIMITS* info );
135  long query( long pid, InfoType fetch, KERNEL_USER_TIMES* info );
136  long query( long pid, InfoType fetch, QUOTA_LIMITS* info );
137  long query( long pid, InfoType fetch, VM_COUNTERS* info );
138  long query( long pid, InfoType fetch, IO_COUNTERS* info );
139  long query( long pid, InfoType fetch, long* info );
140  };
141 
143  static ProcessDescriptor p;
144  return &p;
145  }
146 } // namespace System
147 #endif // GAUDIKERNEL_PROCESS_H
System::VM_COUNTERS::QuotaPeakPagedPoolUsage
unsigned long QuotaPeakPagedPoolUsage
Definition: ProcessDescriptor.h:75
System::VM_COUNTERS::PeakPagefileUsage
unsigned long PeakPagefileUsage
Definition: ProcessDescriptor.h:80
System::VM_COUNTERS::QuotaPagedPoolUsage
unsigned long QuotaPagedPoolUsage
Definition: ProcessDescriptor.h:76
System::KERNEL_USER_TIMES
Process/Thread System and User Time NtQueryInformationProcess using ProcessTimes NtQueryInformationTh...
Definition: ProcessDescriptor.h:102
System::VM_COUNTERS::WorkingSetSize
unsigned long WorkingSetSize
Definition: ProcessDescriptor.h:74
System::InfoType
InfoType
Enumeration for fetching information.
Definition: SystemBase.h:28
System::ProcessDescriptor::ProcessHandle::m_needRelease
bool m_needRelease
Definition: ProcessDescriptor.h:121
System::VM_COUNTERS::PagefileUsage
unsigned long PagefileUsage
Definition: ProcessDescriptor.h:79
System::POOLED_USAGE_AND_LIMITS::PagefileLimit
unsigned long PagefileLimit
Definition: ProcessDescriptor.h:95
System::POOLED_USAGE_AND_LIMITS::PeakNonPagedPoolUsage
unsigned long PeakNonPagedPoolUsage
Definition: ProcessDescriptor.h:90
System::POOLED_USAGE_AND_LIMITS::PagedPoolUsage
unsigned long PagedPoolUsage
Definition: ProcessDescriptor.h:88
System::POOLED_USAGE_AND_LIMITS::NonPagedPoolLimit
unsigned long NonPagedPoolLimit
Definition: ProcessDescriptor.h:92
System::QUOTA_LIMITS::TimeLimit
long long TimeLimit
Definition: ProcessDescriptor.h:48
System::KERNEL_USER_TIMES::UserTime
long long UserTime
Definition: ProcessDescriptor.h:106
System::PROCESS_BASIC_INFORMATION::AffinityMask
unsigned long AffinityMask
Definition: ProcessDescriptor.h:31
System::VM_COUNTERS::PeakWorkingSetSize
unsigned long PeakWorkingSetSize
Definition: ProcessDescriptor.h:73
System::VM_COUNTERS::VirtualSize
unsigned long VirtualSize
Definition: ProcessDescriptor.h:71
NewInputWrite.fetch
fetch
Definition: NewInputWrite.py:45
System::PROCESS_BASIC_INFORMATION::BasePriority
long BasePriority
Definition: ProcessDescriptor.h:32
System::ProcessDescriptor::query
long query(long pid, InfoType fetch, PROCESS_BASIC_INFORMATION *info)
Definition: ProcessDescriptor.cpp:595
System::PROCESS_BASIC_INFORMATION::InheritedFromUniqueProcessId
unsigned long InheritedFromUniqueProcessId
Definition: ProcessDescriptor.h:34
System::QUOTA_LIMITS::PagedPoolLimit
unsigned long PagedPoolLimit
Definition: ProcessDescriptor.h:43
System::VM_COUNTERS::PageFaultCount
unsigned long PageFaultCount
Definition: ProcessDescriptor.h:72
System::ProcessDescriptor::ProcessHandle::ProcessHandle
ProcessHandle(long pid)
Definition: ProcessDescriptor.cpp:364
System::ProcessDescriptor::ProcessDescriptor
ProcessDescriptor()
Definition: ProcessDescriptor.cpp:391
System::IO_COUNTERS::WriteOperationCount
unsigned long WriteOperationCount
Definition: ProcessDescriptor.h:56
System::PROCESS_BASIC_INFORMATION::UniqueProcessId
unsigned long UniqueProcessId
Definition: ProcessDescriptor.h:33
System::ProcessDescriptor::~ProcessDescriptor
virtual ~ProcessDescriptor()
Definition: ProcessDescriptor.cpp:405
System::POOLED_USAGE_AND_LIMITS::PagefileUsage
unsigned long PagefileUsage
Definition: ProcessDescriptor.h:94
System::VM_COUNTERS::QuotaNonPagedPoolUsage
unsigned long QuotaNonPagedPoolUsage
Definition: ProcessDescriptor.h:78
System::ProcessDescriptor::ProcessHandle
Definition: ProcessDescriptor.h:119
System::VM_COUNTERS::PeakVirtualSize
unsigned long PeakVirtualSize
Definition: ProcessDescriptor.h:70
System::ProcessDescriptor::ProcessHandle::m_handle
void * m_handle
Definition: ProcessDescriptor.h:120
System::PROCESS_BASIC_INFORMATION
Definition: ProcessDescriptor.h:28
System::POOLED_USAGE_AND_LIMITS
Process Pooled Quota Usage and Limits NtQueryInformationProcess using ProcessPooledUsageAndLimits.
Definition: ProcessDescriptor.h:86
System::PROCESS_BASIC_INFORMATION::ExitStatus
long ExitStatus
Definition: ProcessDescriptor.h:29
System::QUOTA_LIMITS
Process Quotas NtQueryInformationProcess using ProcessQuotaLimits NtQueryInformationProcess using Pro...
Definition: ProcessDescriptor.h:42
System::IO_COUNTERS::ReadTransferCount
long long ReadTransferCount
Definition: ProcessDescriptor.h:61
System::IO_COUNTERS
Process I/O Counters NtQueryInformationProcess using ProcessIoCounters.
Definition: ProcessDescriptor.h:54
System::KERNEL_USER_TIMES::KernelTime
long long KernelTime
Definition: ProcessDescriptor.h:105
System::ProcessDescriptor::ProcessHandle::~ProcessHandle
virtual ~ProcessHandle()
Definition: ProcessDescriptor.cpp:381
System::KERNEL_USER_TIMES::CreateTime
long long CreateTime
Definition: ProcessDescriptor.h:103
System::ProcessDescriptor
Definition: ProcessDescriptor.h:118
System::POOLED_USAGE_AND_LIMITS::NonPagedPoolUsage
unsigned long NonPagedPoolUsage
Definition: ProcessDescriptor.h:91
SystemBase.h
System::POOLED_USAGE_AND_LIMITS::PeakPagedPoolUsage
unsigned long PeakPagedPoolUsage
Definition: ProcessDescriptor.h:87
System::QUOTA_LIMITS::MaximumWorkingSetSize
unsigned long MaximumWorkingSetSize
Definition: ProcessDescriptor.h:46
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:142
System::ProcessDescriptor::ProcessHandle::handle
void * handle()
Definition: ProcessDescriptor.h:127
Kernel.h
System::ProcessDescriptor::ProcessHandle::item
long item()
Definition: ProcessDescriptor.h:126
System
Note: OS specific details for environment resolution.
Definition: Debugger.h:29
System::IO_COUNTERS::OtherTransferCount
long long OtherTransferCount
Definition: ProcessDescriptor.h:63
System::VM_COUNTERS
Process Virtual Memory Counters NtQueryInformationProcess using ProcessVmCounters.
Definition: ProcessDescriptor.h:69
System::KERNEL_USER_TIMES::ExitTime
long long ExitTime
Definition: ProcessDescriptor.h:104
System::PROCESS_BASIC_INFORMATION::PebBaseAddress
PPEB PebBaseAddress
Definition: ProcessDescriptor.h:30
System::POOLED_USAGE_AND_LIMITS::PagedPoolLimit
unsigned long PagedPoolLimit
Definition: ProcessDescriptor.h:89
System::IO_COUNTERS::OtherOperationCount
unsigned long OtherOperationCount
Definition: ProcessDescriptor.h:57
System::QUOTA_LIMITS::MinimumWorkingSetSize
unsigned long MinimumWorkingSetSize
Definition: ProcessDescriptor.h:45
System::QUOTA_LIMITS::PagefileLimit
unsigned long PagefileLimit
Definition: ProcessDescriptor.h:47
System::IO_COUNTERS::ReadOperationCount
unsigned long ReadOperationCount
Definition: ProcessDescriptor.h:55
System::PPEB
struct _PEB * PPEB
Basic Process Information NtQueryInformationProcess using ProcessBasicInfo.
Definition: ProcessDescriptor.h:27
System::IO_COUNTERS::WriteTransferCount
long long WriteTransferCount
Definition: ProcessDescriptor.h:62
System::VM_COUNTERS::QuotaPeakNonPagedPoolUsage
unsigned long QuotaPeakNonPagedPoolUsage
Definition: ProcessDescriptor.h:77
System::QUOTA_LIMITS::NonPagedPoolLimit
unsigned long NonPagedPoolLimit
Definition: ProcessDescriptor.h:44
System::POOLED_USAGE_AND_LIMITS::PeakPagefileUsage
unsigned long PeakPagefileUsage
Definition: ProcessDescriptor.h:93