The Gaudi Framework  v40r0 (475e45c1)
ProcessDescriptor.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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 #pragma once
12 
13 // Framework include files
14 #include <GaudiKernel/Kernel.h>
15 #include <GaudiKernel/SystemBase.h>
16 
17 namespace System {
18  // Forward declarations
19  class ProcessDescriptor;
21  ProcessDescriptor* getProcess();
22 
26  typedef struct _PEB* PPEB;
28  long ExitStatus;
30  unsigned long AffinityMask;
32  unsigned long UniqueProcessId;
34  };
35 
41  struct QUOTA_LIMITS {
42  unsigned long PagedPoolLimit;
43  unsigned long NonPagedPoolLimit;
44  unsigned long MinimumWorkingSetSize;
45  unsigned long MaximumWorkingSetSize;
46  unsigned long PagefileLimit;
47  long long TimeLimit;
48  };
49 
53  struct IO_COUNTERS {
54  unsigned long ReadOperationCount;
55  unsigned long WriteOperationCount;
56  unsigned long OtherOperationCount;
57  // long long ReadOperationCount;
58  // long long WriteOperationCount;
59  // long long OtherOperationCount;
60  long long ReadTransferCount;
61  long long WriteTransferCount;
62  long long OtherTransferCount;
63  };
64 
68  struct VM_COUNTERS {
69  unsigned long PeakVirtualSize;
70  unsigned long VirtualSize;
71  unsigned long PageFaultCount;
72  unsigned long PeakWorkingSetSize;
73  unsigned long WorkingSetSize;
74  unsigned long QuotaPeakPagedPoolUsage;
75  unsigned long QuotaPagedPoolUsage;
77  unsigned long QuotaNonPagedPoolUsage;
78  unsigned long PagefileUsage;
79  unsigned long PeakPagefileUsage;
80  };
81 
86  unsigned long PeakPagedPoolUsage;
87  unsigned long PagedPoolUsage;
88  unsigned long PagedPoolLimit;
89  unsigned long PeakNonPagedPoolUsage;
90  unsigned long NonPagedPoolUsage;
91  unsigned long NonPagedPoolLimit;
92  unsigned long PeakPagefileUsage;
93  unsigned long PagefileUsage;
94  unsigned long PagefileLimit;
95  };
96 
102  long long CreateTime;
103  long long ExitTime;
104  long long KernelTime;
105  long long UserTime;
106  // long long EllapsedTime; // Added by M.Frank
107  };
108 
119  void* m_handle;
121 
122  public:
123  ProcessHandle( long pid );
124  virtual ~ProcessHandle();
125  long item() { return m_needRelease ? 1 : 0; }
126  void* handle() { return m_handle; }
127  };
128 
129  public:
131  virtual ~ProcessDescriptor();
132  long query( long pid, InfoType fetch, PROCESS_BASIC_INFORMATION* info );
133  long query( long pid, InfoType fetch, POOLED_USAGE_AND_LIMITS* info );
134  long query( long pid, InfoType fetch, KERNEL_USER_TIMES* info );
135  long query( long pid, InfoType fetch, QUOTA_LIMITS* info );
136  long query( long pid, InfoType fetch, VM_COUNTERS* info );
137  long query( long pid, InfoType fetch, IO_COUNTERS* info );
138  long query( long pid, InfoType fetch, long* info );
139  };
140 
142  static ProcessDescriptor p;
143  return &p;
144  }
145 } // namespace System
System::VM_COUNTERS::QuotaPeakPagedPoolUsage
unsigned long QuotaPeakPagedPoolUsage
Definition: ProcessDescriptor.h:74
System::VM_COUNTERS::PeakPagefileUsage
unsigned long PeakPagefileUsage
Definition: ProcessDescriptor.h:79
System::VM_COUNTERS::QuotaPagedPoolUsage
unsigned long QuotaPagedPoolUsage
Definition: ProcessDescriptor.h:75
System::KERNEL_USER_TIMES
Process/Thread System and User Time NtQueryInformationProcess using ProcessTimes NtQueryInformationTh...
Definition: ProcessDescriptor.h:101
System::VM_COUNTERS::WorkingSetSize
unsigned long WorkingSetSize
Definition: ProcessDescriptor.h:73
System::InfoType
InfoType
Enumeration for fetching information.
Definition: SystemBase.h:15
System::ProcessDescriptor::ProcessHandle::m_needRelease
bool m_needRelease
Definition: ProcessDescriptor.h:120
System::VM_COUNTERS::PagefileUsage
unsigned long PagefileUsage
Definition: ProcessDescriptor.h:78
System::POOLED_USAGE_AND_LIMITS::PagefileLimit
unsigned long PagefileLimit
Definition: ProcessDescriptor.h:94
System::POOLED_USAGE_AND_LIMITS::PeakNonPagedPoolUsage
unsigned long PeakNonPagedPoolUsage
Definition: ProcessDescriptor.h:89
System::POOLED_USAGE_AND_LIMITS::PagedPoolUsage
unsigned long PagedPoolUsage
Definition: ProcessDescriptor.h:87
System::POOLED_USAGE_AND_LIMITS::NonPagedPoolLimit
unsigned long NonPagedPoolLimit
Definition: ProcessDescriptor.h:91
System::QUOTA_LIMITS::TimeLimit
long long TimeLimit
Definition: ProcessDescriptor.h:47
System::KERNEL_USER_TIMES::UserTime
long long UserTime
Definition: ProcessDescriptor.h:105
System::PROCESS_BASIC_INFORMATION::AffinityMask
unsigned long AffinityMask
Definition: ProcessDescriptor.h:30
System::VM_COUNTERS::PeakWorkingSetSize
unsigned long PeakWorkingSetSize
Definition: ProcessDescriptor.h:72
System::VM_COUNTERS::VirtualSize
unsigned long VirtualSize
Definition: ProcessDescriptor.h:70
NewInputWrite.fetch
fetch
Definition: NewInputWrite.py:45
System::PROCESS_BASIC_INFORMATION::BasePriority
long BasePriority
Definition: ProcessDescriptor.h:31
System::ProcessDescriptor::query
long query(long pid, InfoType fetch, PROCESS_BASIC_INFORMATION *info)
Definition: ProcessDescriptor.cpp:578
System::PROCESS_BASIC_INFORMATION::InheritedFromUniqueProcessId
unsigned long InheritedFromUniqueProcessId
Definition: ProcessDescriptor.h:33
System::QUOTA_LIMITS::PagedPoolLimit
unsigned long PagedPoolLimit
Definition: ProcessDescriptor.h:42
System::VM_COUNTERS::PageFaultCount
unsigned long PageFaultCount
Definition: ProcessDescriptor.h:71
System::ProcessDescriptor::ProcessHandle::ProcessHandle
ProcessHandle(long pid)
Definition: ProcessDescriptor.cpp:347
System::ProcessDescriptor::ProcessDescriptor
ProcessDescriptor()
Definition: ProcessDescriptor.cpp:374
System::IO_COUNTERS::WriteOperationCount
unsigned long WriteOperationCount
Definition: ProcessDescriptor.h:55
System::PROCESS_BASIC_INFORMATION::UniqueProcessId
unsigned long UniqueProcessId
Definition: ProcessDescriptor.h:32
System::ProcessDescriptor::~ProcessDescriptor
virtual ~ProcessDescriptor()
Definition: ProcessDescriptor.cpp:388
System::POOLED_USAGE_AND_LIMITS::PagefileUsage
unsigned long PagefileUsage
Definition: ProcessDescriptor.h:93
System::VM_COUNTERS::QuotaNonPagedPoolUsage
unsigned long QuotaNonPagedPoolUsage
Definition: ProcessDescriptor.h:77
System::ProcessDescriptor::ProcessHandle
Definition: ProcessDescriptor.h:118
System::VM_COUNTERS::PeakVirtualSize
unsigned long PeakVirtualSize
Definition: ProcessDescriptor.h:69
System::ProcessDescriptor::ProcessHandle::m_handle
void * m_handle
Definition: ProcessDescriptor.h:119
System::PROCESS_BASIC_INFORMATION
Definition: ProcessDescriptor.h:27
System::POOLED_USAGE_AND_LIMITS
Process Pooled Quota Usage and Limits NtQueryInformationProcess using ProcessPooledUsageAndLimits.
Definition: ProcessDescriptor.h:85
System::PROCESS_BASIC_INFORMATION::ExitStatus
long ExitStatus
Definition: ProcessDescriptor.h:28
System::QUOTA_LIMITS
Process Quotas NtQueryInformationProcess using ProcessQuotaLimits NtQueryInformationProcess using Pro...
Definition: ProcessDescriptor.h:41
System::IO_COUNTERS::ReadTransferCount
long long ReadTransferCount
Definition: ProcessDescriptor.h:60
System::IO_COUNTERS
Process I/O Counters NtQueryInformationProcess using ProcessIoCounters.
Definition: ProcessDescriptor.h:53
System::KERNEL_USER_TIMES::KernelTime
long long KernelTime
Definition: ProcessDescriptor.h:104
System::ProcessDescriptor::ProcessHandle::~ProcessHandle
virtual ~ProcessHandle()
Definition: ProcessDescriptor.cpp:364
System::KERNEL_USER_TIMES::CreateTime
long long CreateTime
Definition: ProcessDescriptor.h:102
System::ProcessDescriptor
Definition: ProcessDescriptor.h:117
System::POOLED_USAGE_AND_LIMITS::NonPagedPoolUsage
unsigned long NonPagedPoolUsage
Definition: ProcessDescriptor.h:90
SystemBase.h
System::POOLED_USAGE_AND_LIMITS::PeakPagedPoolUsage
unsigned long PeakPagedPoolUsage
Definition: ProcessDescriptor.h:86
System::QUOTA_LIMITS::MaximumWorkingSetSize
unsigned long MaximumWorkingSetSize
Definition: ProcessDescriptor.h:45
System::getProcess
ProcessDescriptor * getProcess()
Retrieve Process structure.
Definition: ProcessDescriptor.h:141
System::ProcessDescriptor::ProcessHandle::handle
void * handle()
Definition: ProcessDescriptor.h:126
Kernel.h
System::ProcessDescriptor::ProcessHandle::item
long item()
Definition: ProcessDescriptor.h:125
System
Note: OS specific details for environment resolution.
Definition: Debugger.h:15
System::IO_COUNTERS::OtherTransferCount
long long OtherTransferCount
Definition: ProcessDescriptor.h:62
System::VM_COUNTERS
Process Virtual Memory Counters NtQueryInformationProcess using ProcessVmCounters.
Definition: ProcessDescriptor.h:68
System::KERNEL_USER_TIMES::ExitTime
long long ExitTime
Definition: ProcessDescriptor.h:103
System::PROCESS_BASIC_INFORMATION::PebBaseAddress
PPEB PebBaseAddress
Definition: ProcessDescriptor.h:29
System::POOLED_USAGE_AND_LIMITS::PagedPoolLimit
unsigned long PagedPoolLimit
Definition: ProcessDescriptor.h:88
System::IO_COUNTERS::OtherOperationCount
unsigned long OtherOperationCount
Definition: ProcessDescriptor.h:56
System::QUOTA_LIMITS::MinimumWorkingSetSize
unsigned long MinimumWorkingSetSize
Definition: ProcessDescriptor.h:44
System::QUOTA_LIMITS::PagefileLimit
unsigned long PagefileLimit
Definition: ProcessDescriptor.h:46
System::IO_COUNTERS::ReadOperationCount
unsigned long ReadOperationCount
Definition: ProcessDescriptor.h:54
System::PPEB
struct _PEB * PPEB
Basic Process Information NtQueryInformationProcess using ProcessBasicInfo.
Definition: ProcessDescriptor.h:26
System::IO_COUNTERS::WriteTransferCount
long long WriteTransferCount
Definition: ProcessDescriptor.h:61
System::VM_COUNTERS::QuotaPeakNonPagedPoolUsage
unsigned long QuotaPeakNonPagedPoolUsage
Definition: ProcessDescriptor.h:76
System::QUOTA_LIMITS::NonPagedPoolLimit
unsigned long NonPagedPoolLimit
Definition: ProcessDescriptor.h:43
System::POOLED_USAGE_AND_LIMITS::PeakPagefileUsage
unsigned long PeakPagefileUsage
Definition: ProcessDescriptor.h:92