summaryrefslogtreecommitdiff
path: root/indra/llcommon/llprocinfo.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-29 07:43:28 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-29 07:56:09 +0300
commit1b68f71348ecf3983b76b40d7940da8377f049b7 (patch)
tree2974eddaef130a067c26033d60a59fc790365b3d /indra/llcommon/llprocinfo.cpp
parentaf4ea94efc1999f3b19fd8d643d0331f0b77e265 (diff)
#824 Process source files in bulk: replace tabs with spaces, convert CRLF to LF, and trim trailing whitespaces as needed
Diffstat (limited to 'indra/llcommon/llprocinfo.cpp')
-rw-r--r--indra/llcommon/llprocinfo.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/indra/llcommon/llprocinfo.cpp b/indra/llcommon/llprocinfo.cpp
index c00f979b0b..69be00e14a 100644
--- a/indra/llcommon/llprocinfo.cpp
+++ b/indra/llcommon/llprocinfo.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llprocinfo.cpp
* @brief Process, cpu and resource usage information APIs.
* @author monty@lindenlab.com
@@ -30,7 +30,7 @@
#if LL_WINDOWS
-#define PSAPI_VERSION 1
+#define PSAPI_VERSION 1
#include "windows.h"
#include "psapi.h"
@@ -38,7 +38,7 @@
#include <sys/resource.h>
#include <mach/mach.h>
-
+
#else
#include <sys/time.h>
@@ -52,42 +52,42 @@ void LLProcInfo::getCPUUsage(time_type & user_time, time_type & system_time)
{
#if LL_WINDOWS
- HANDLE self(GetCurrentProcess()); // Does not have to be closed
- FILETIME ft_dummy, ft_system, ft_user;
-
- GetProcessTimes(self, &ft_dummy, &ft_dummy, &ft_system, &ft_user);
- ULARGE_INTEGER uli;
- uli.u.LowPart = ft_system.dwLowDateTime;
- uli.u.HighPart = ft_system.dwHighDateTime;
- system_time = uli.QuadPart / U64L(10); // Convert to uS
- uli.u.LowPart = ft_user.dwLowDateTime;
- uli.u.HighPart = ft_user.dwHighDateTime;
- user_time = uli.QuadPart / U64L(10);
-
+ HANDLE self(GetCurrentProcess()); // Does not have to be closed
+ FILETIME ft_dummy, ft_system, ft_user;
+
+ GetProcessTimes(self, &ft_dummy, &ft_dummy, &ft_system, &ft_user);
+ ULARGE_INTEGER uli;
+ uli.u.LowPart = ft_system.dwLowDateTime;
+ uli.u.HighPart = ft_system.dwHighDateTime;
+ system_time = uli.QuadPart / U64L(10); // Convert to uS
+ uli.u.LowPart = ft_user.dwLowDateTime;
+ uli.u.HighPart = ft_user.dwHighDateTime;
+ user_time = uli.QuadPart / U64L(10);
+
#elif LL_DARWIN
- struct rusage usage;
+ struct rusage usage;
- if (getrusage(RUSAGE_SELF, &usage))
- {
- user_time = system_time = time_type(0U);
- return;
- }
- user_time = U64(usage.ru_utime.tv_sec) * U64L(1000000) + usage.ru_utime.tv_usec;
- system_time = U64(usage.ru_stime.tv_sec) * U64L(1000000) + usage.ru_stime.tv_usec;
+ if (getrusage(RUSAGE_SELF, &usage))
+ {
+ user_time = system_time = time_type(0U);
+ return;
+ }
+ user_time = U64(usage.ru_utime.tv_sec) * U64L(1000000) + usage.ru_utime.tv_usec;
+ system_time = U64(usage.ru_stime.tv_sec) * U64L(1000000) + usage.ru_stime.tv_usec;
#else // Linux
- struct rusage usage;
+ struct rusage usage;
+
+ if (getrusage(RUSAGE_SELF, &usage))
+ {
+ user_time = system_time = time_type(0U);
+ return;
+ }
+ user_time = U64(usage.ru_utime.tv_sec) * U64L(1000000) + usage.ru_utime.tv_usec;
+ system_time = U64(usage.ru_stime.tv_sec) * U64L(1000000) + usage.ru_stime.tv_usec;
- if (getrusage(RUSAGE_SELF, &usage))
- {
- user_time = system_time = time_type(0U);
- return;
- }
- user_time = U64(usage.ru_utime.tv_sec) * U64L(1000000) + usage.ru_utime.tv_usec;
- system_time = U64(usage.ru_stime.tv_sec) * U64L(1000000) + usage.ru_stime.tv_usec;
-
#endif // LL_WINDOWS/LL_DARWIN/Linux
}