aboutsummaryrefslogtreecommitdiffstats
path: root/util/system
diff options
context:
space:
mode:
authorEvgeny Grechnikov <diamondaz@yandex.ru>2022-02-10 16:46:20 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:20 +0300
commit6e38f52f898d7c077ddd319800b4014967a5ca76 (patch)
treef0b2473cfc98506158b8f1d3d387c4f478ade18e /util/system
parentbd085aee9b4f7a0bee302ce687964ffb7098f986 (diff)
downloadydb-6e38f52f898d7c077ddd319800b4014967a5ca76.tar.gz
Restoring authorship annotation for Evgeny Grechnikov <diamondaz@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system')
-rw-r--r--util/system/env.h4
-rw-r--r--util/system/mem_info.cpp138
-rw-r--r--util/system/mlock.cpp2
-rw-r--r--util/system/thread.i2
4 files changed, 73 insertions, 73 deletions
diff --git a/util/system/env.h b/util/system/env.h
index e2ccdd1e95..d7313d4944 100644
--- a/util/system/env.h
+++ b/util/system/env.h
@@ -11,7 +11,7 @@
* @return String that is associated with the matched environment variable or empty string if
* such variable is missing.
*
- * @note Use it only in pair with `SetEnv` as there may be inconsistency in their behaviour
+ * @note Use it only in pair with `SetEnv` as there may be inconsistency in their behaviour
* otherwise.
* @note Calls to `GetEnv` and `SetEnv` from different threads must be synchronized.
* @see SetEnv
@@ -24,7 +24,7 @@ TString GetEnv(const TString& key, const TString& def = TString());
* @key String identifying the name of the environment variable to set or change
* @value Value to assign
- * @note Use it only in pair with `GetEnv` as there may be inconsistency in their behaviour
+ * @note Use it only in pair with `GetEnv` as there may be inconsistency in their behaviour
* otherwise.
* @note Calls to `GetEnv` and `SetEnv` from different threads must be synchronized.
* @see GetEnv
diff --git a/util/system/mem_info.cpp b/util/system/mem_info.cpp
index aa51ae3b16..8a39a27393 100644
--- a/util/system/mem_info.cpp
+++ b/util/system/mem_info.cpp
@@ -21,79 +21,79 @@
#elif defined(__MACH__) && defined(__APPLE__)
#include <mach/mach.h>
#endif
-#elif defined(_win_)
+#elif defined(_win_)
#include <Windows.h>
#include <util/generic/ptr.h>
-
+
using NTSTATUS = LONG;
#define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
#define STATUS_BUFFER_TOO_SMALL 0xC0000023
-
-typedef struct _UNICODE_STRING {
- USHORT Length;
- USHORT MaximumLength;
- PWSTR Buffer;
-} UNICODE_STRING, *PUNICODE_STRING;
+
+typedef struct _UNICODE_STRING {
+ USHORT Length;
+ USHORT MaximumLength;
+ PWSTR Buffer;
+} UNICODE_STRING, *PUNICODE_STRING;
typedef struct _CLIENT_ID {
- HANDLE UniqueProcess;
- HANDLE UniqueThread;
-} CLIENT_ID, *PCLIENT_ID;
+ HANDLE UniqueProcess;
+ HANDLE UniqueThread;
+} CLIENT_ID, *PCLIENT_ID;
using KWAIT_REASON = ULONG;
typedef struct _SYSTEM_THREAD_INFORMATION {
- LARGE_INTEGER KernelTime;
- LARGE_INTEGER UserTime;
- LARGE_INTEGER CreateTime;
- ULONG WaitTime;
- PVOID StartAddress;
- CLIENT_ID ClientId;
- LONG Priority;
- LONG BasePriority;
- ULONG ContextSwitches;
- ULONG ThreadState;
- KWAIT_REASON WaitReason;
-} SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
+ LARGE_INTEGER KernelTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER CreateTime;
+ ULONG WaitTime;
+ PVOID StartAddress;
+ CLIENT_ID ClientId;
+ LONG Priority;
+ LONG BasePriority;
+ ULONG ContextSwitches;
+ ULONG ThreadState;
+ KWAIT_REASON WaitReason;
+} SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
typedef struct _SYSTEM_PROCESS_INFORMATION {
- ULONG NextEntryOffset;
- ULONG NumberOfThreads;
- LARGE_INTEGER SpareLi1;
- LARGE_INTEGER SpareLi2;
- LARGE_INTEGER SpareLi3;
- LARGE_INTEGER CreateTime;
- LARGE_INTEGER UserTime;
- LARGE_INTEGER KernelTime;
- UNICODE_STRING ImageName;
- LONG BasePriority;
- HANDLE UniqueProcessId;
- HANDLE InheritedFromUniqueProcessId;
- ULONG HandleCount;
- ULONG SessionId;
- ULONG_PTR PageDirectoryBase;
- SIZE_T PeakVirtualSize;
- SIZE_T VirtualSize;
- DWORD PageFaultCount;
- SIZE_T PeakWorkingSetSize;
- SIZE_T WorkingSetSize;
- SIZE_T QuotaPeakPagedPoolUsage;
- SIZE_T QuotaPagedPoolUsage;
- SIZE_T QuotaPeakNonPagedPoolUsage;
- SIZE_T QuotaNonPagedPoolUsage;
- SIZE_T PagefileUsage;
- SIZE_T PeakPagefileUsage;
- SIZE_T PrivatePageCount;
- LARGE_INTEGER ReadOperationCount;
- LARGE_INTEGER WriteOperationCount;
- LARGE_INTEGER OtherOperationCount;
- LARGE_INTEGER ReadTransferCount;
- LARGE_INTEGER WriteTransferCount;
- LARGE_INTEGER OtherTransferCount;
- SYSTEM_THREAD_INFORMATION Threads[1];
-} SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
-
-typedef enum _SYSTEM_INFORMATION_CLASS {
- SystemBasicInformation = 0,
- SystemProcessInformation = 5,
-} SYSTEM_INFORMATION_CLASS;
-
+ ULONG NextEntryOffset;
+ ULONG NumberOfThreads;
+ LARGE_INTEGER SpareLi1;
+ LARGE_INTEGER SpareLi2;
+ LARGE_INTEGER SpareLi3;
+ LARGE_INTEGER CreateTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER KernelTime;
+ UNICODE_STRING ImageName;
+ LONG BasePriority;
+ HANDLE UniqueProcessId;
+ HANDLE InheritedFromUniqueProcessId;
+ ULONG HandleCount;
+ ULONG SessionId;
+ ULONG_PTR PageDirectoryBase;
+ SIZE_T PeakVirtualSize;
+ SIZE_T VirtualSize;
+ DWORD PageFaultCount;
+ SIZE_T PeakWorkingSetSize;
+ SIZE_T WorkingSetSize;
+ SIZE_T QuotaPeakPagedPoolUsage;
+ SIZE_T QuotaPagedPoolUsage;
+ SIZE_T QuotaPeakNonPagedPoolUsage;
+ SIZE_T QuotaNonPagedPoolUsage;
+ SIZE_T PagefileUsage;
+ SIZE_T PeakPagefileUsage;
+ SIZE_T PrivatePageCount;
+ LARGE_INTEGER ReadOperationCount;
+ LARGE_INTEGER WriteOperationCount;
+ LARGE_INTEGER OtherOperationCount;
+ LARGE_INTEGER ReadTransferCount;
+ LARGE_INTEGER WriteTransferCount;
+ LARGE_INTEGER OtherTransferCount;
+ SYSTEM_THREAD_INFORMATION Threads[1];
+} SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
+
+typedef enum _SYSTEM_INFORMATION_CLASS {
+ SystemBasicInformation = 0,
+ SystemProcessInformation = 5,
+} SYSTEM_INFORMATION_CLASS;
+
#else
#endif
@@ -173,15 +173,15 @@ namespace NMemInfo {
Y_UNUSED(pid);
ythrow yexception() << "arm is not supported";
#endif
-#elif defined(_win_)
+#elif defined(_win_)
if (!pid) {
pid = GetCurrentProcessId();
}
-
+
NTSTATUS status;
TArrayHolder<char> buffer;
ULONG bufferSize;
-
+
// Query data for all processes and threads in the system.
// This is probably an overkill if the target process is normal not-privileged one,
// but allows to obtain information even about system processes that are not open-able directly.
@@ -201,7 +201,7 @@ namespace NMemInfo {
ythrow yexception() << "NtQuerySystemInformation failed with status code " << status;
}
}
-
+
SYSTEM_PROCESS_INFORMATION* process = (SYSTEM_PROCESS_INFORMATION*)buffer.Get();
while (process->UniqueProcessId != (HANDLE)(size_t)(pid)) {
if (!process->NextEntryOffset) {
@@ -210,7 +210,7 @@ namespace NMemInfo {
process = (SYSTEM_PROCESS_INFORMATION*)((char*)process + process->NextEntryOffset);
}
-
+
result.VMS = process->VirtualSize;
result.RSS = process->WorkingSetSize;
#endif
diff --git a/util/system/mlock.cpp b/util/system/mlock.cpp
index 435338c98f..2431ef73db 100644
--- a/util/system/mlock.cpp
+++ b/util/system/mlock.cpp
@@ -21,7 +21,7 @@ void LockMemory(const void* addr, size_t len) {
#if defined(_unix_)
const size_t pageSize = NSystemInfo::GetPageSize();
if (mlock(AlignDown(addr, pageSize), AlignUp(len, pageSize))) {
- ythrow yexception() << LastSystemErrorText();
+ ythrow yexception() << LastSystemErrorText();
}
#elif defined(_win_)
HANDLE hndl = GetCurrentProcess();
diff --git a/util/system/thread.i b/util/system/thread.i
index 8cba505473..e93a3f4d62 100644
--- a/util/system/thread.i
+++ b/util/system/thread.i
@@ -3,7 +3,7 @@
#include "platform.h"
#if defined(_win_)
- #include "winint.h"
+ #include "winint.h"
#include <process.h>
typedef HANDLE THREADHANDLE;