class Process
Declaration
class Process { /* full declaration omitted */ };
Description
A collection of legacy interfaces for querying information about the current executing process.
Declared at: llvm/include/llvm/Support/Process.h:43
Method Overview
- public static bool AreCoreFilesPrevented()
- public static bool ColorNeedsFlush()
- public static void Exit(int RetCode)
- public static bool FileDescriptorHasColors(int fd)
- public static bool FileDescriptorIsDisplayed(int fd)
- public static Optional<std::string> FindInEnvPath(llvm::StringRef EnvName, llvm::StringRef FileName, ArrayRef<std::string> IgnoreList)
- public static Optional<std::string> FindInEnvPath(llvm::StringRef EnvName, llvm::StringRef FileName)
- public static std::error_code FixupStandardFileDescriptors()
- public static Optional<std::string> GetEnv(llvm::StringRef name)
- public static size_t GetMallocUsage()
- public static unsigned int GetRandomNumber()
- public static void GetTimeUsage(TimePoint<> & elapsed, std::chrono::nanoseconds & user_time, std::chrono::nanoseconds & sys_time)
- public static const char * OutputBold(bool bg)
- public static const char * OutputColor(char c, bool bold, bool bg)
- public static const char * OutputReverse()
- public static void PreventCoreFiles()
- public static const char * ResetColor()
- public static std::error_code SafelyCloseFileDescriptor(int FD)
- public static unsigned int StandardErrColumns()
- public static bool StandardErrHasColors()
- public static bool StandardErrIsDisplayed()
- public static bool StandardInIsUserInput()
- public static unsigned int StandardOutColumns()
- public static bool StandardOutHasColors()
- public static bool StandardOutIsDisplayed()
- public static void UseANSIEscapeCodes(bool enable)
- public static Expected<unsigned int> getPageSize()
- public static unsigned int getPageSizeEstimate()
Methods
¶static bool AreCoreFilesPrevented()
static bool AreCoreFilesPrevented()
Description
true if PreventCoreFiles has been called, false otherwise.
Declared at: llvm/include/llvm/Support/Process.h:91
¶static bool ColorNeedsFlush()
static bool ColorNeedsFlush()
Description
Whether changing colors requires the output to be flushed. This is needed on systems that don't support escape sequences for changing colors.
Declared at: llvm/include/llvm/Support/Process.h:182
¶static void Exit(int RetCode)
static void Exit(int RetCode)
Description
Equivalent to ::exit(), except when running inside a CrashRecoveryContext. In that case, the control flow will resume after RunSafely(), like for a crash, rather than exiting the current process.
Declared at: llvm/include/llvm/Support/Process.h:209
Parameters
- int RetCode
¶static bool FileDescriptorHasColors(int fd)
static bool FileDescriptorHasColors(int fd)
Description
This function determines if the given file descriptor is displayd and supports colors.
Declared at: llvm/include/llvm/Support/Process.h:147
Parameters
- int fd
¶static bool FileDescriptorIsDisplayed(int fd)
static bool FileDescriptorIsDisplayed(int fd)
Description
This function determines if the given file descriptor is connected to a "tty" or "console" window. That is, the output would be displayed to the user rather than being put on a pipe or stored in a file.
Declared at: llvm/include/llvm/Support/Process.h:143
Parameters
- int fd
¶static Optional<std::string> FindInEnvPath(
llvm::StringRef EnvName,
llvm::StringRef FileName,
ArrayRef<std::string> IgnoreList)
static Optional<std::string> FindInEnvPath(
llvm::StringRef EnvName,
llvm::StringRef FileName,
ArrayRef<std::string> IgnoreList)
Description
This function searches for an existing file in the list of directories in a PATH like environment variable, and returns the first file found, according to the order of the entries in the PATH like environment variable. If an ignore list is specified, then any folder which is in the PATH like environment variable but is also in IgnoreList is not considered.
Declared at: llvm/include/llvm/Support/Process.h:103
Parameters
- llvm::StringRef EnvName
- llvm::StringRef FileName
- ArrayRef<std::string> IgnoreList
¶static Optional<std::string> FindInEnvPath(
llvm::StringRef EnvName,
llvm::StringRef FileName)
static Optional<std::string> FindInEnvPath(
llvm::StringRef EnvName,
llvm::StringRef FileName)
Declared at: llvm/include/llvm/Support/Process.h:107
Parameters
- llvm::StringRef EnvName
- llvm::StringRef FileName
¶static std::error_code
FixupStandardFileDescriptors()
static std::error_code
FixupStandardFileDescriptors()
Declared at: llvm/include/llvm/Support/Process.h:114
¶static Optional<std::string> GetEnv(
llvm::StringRef name)
static Optional<std::string> GetEnv(
llvm::StringRef name)
Declared at: llvm/include/llvm/Support/Process.h:95
Parameters
- llvm::StringRef name
¶static size_t GetMallocUsage()
static size_t GetMallocUsage()
Description
Return process memory usage. This static function will return the total amount of memory allocated by the process. This only counts the memory allocated via the malloc, calloc and realloc functions and includes any "free" holes in the allocated space.
Declared at: llvm/include/llvm/Support/Process.h:70
¶static unsigned int GetRandomNumber()
static unsigned int GetRandomNumber()
Description
Get the result of a process wide random number generator. The generator will be automatically seeded in non-deterministic fashion.
Declared at: llvm/include/llvm/Support/Process.h:203
¶static void GetTimeUsage(
TimePoint<>& elapsed,
std::chrono::nanoseconds& user_time,
std::chrono::nanoseconds& sys_time)
static void GetTimeUsage(
TimePoint<>& elapsed,
std::chrono::nanoseconds& user_time,
std::chrono::nanoseconds& sys_time)
Description
This static function will set \p user_time to the amount of CPU time spent in user (non-kernel) mode and \p sys_time to the amount of CPU time spent in system (kernel) mode. If the operating system does not support collection of these metrics, a zero duration will be for both values.
Declared at: llvm/include/llvm/Support/Process.h:80
Parameters
- TimePoint<>& elapsed
- Returns the system_clock::now() giving current time
- std::chrono::nanoseconds& user_time
- Returns the current amount of user time for the process
- std::chrono::nanoseconds& sys_time
- Returns the current amount of system time for the process
¶static const char* OutputBold(bool bg)
static const char* OutputBold(bool bg)
Description
Same as OutputColor, but only enables the bold attribute.
Declared at: llvm/include/llvm/Support/Process.h:192
Parameters
- bool bg
¶static const char* OutputColor(char c,
bool bold,
bool bg)
static const char* OutputColor(char c,
bool bold,
bool bg)
Description
This function returns the colorcode escape sequences. If ColorNeedsFlush() is true then this function will change the colors and return an empty escape sequence. In that case it is the responsibility of the client to flush the output stream prior to calling this function.
Declared at: llvm/include/llvm/Support/Process.h:189
Parameters
- char c
- bool bold
- bool bg
¶static const char* OutputReverse()
static const char* OutputReverse()
Description
This function returns the escape sequence to reverse forground and background colors.
Declared at: llvm/include/llvm/Support/Process.h:196
¶static void PreventCoreFiles()
static void PreventCoreFiles()
Description
This function makes the necessary calls to the operating system to prevent core files or any other kind of large memory dumps that can occur when a program fails. Prevent core file generation.
Declared at: llvm/include/llvm/Support/Process.h:88
¶static const char* ResetColor()
static const char* ResetColor()
Description
Resets the terminals colors, or returns an escape sequence to do so.
Declared at: llvm/include/llvm/Support/Process.h:199
¶static std::error_code SafelyCloseFileDescriptor(
int FD)
static std::error_code SafelyCloseFileDescriptor(
int FD)
Declared at: llvm/include/llvm/Support/Process.h:123
Parameters
- int FD
¶static unsigned int StandardErrColumns()
static unsigned int StandardErrColumns()
Description
This function determines the number of columns in the window if standard error is connected to a "tty" or "console" window. If standard error is not connected to a tty or console, or if the number of columns cannot be determined, this routine returns zero.
Declared at: llvm/include/llvm/Support/Process.h:161
¶static bool StandardErrHasColors()
static bool StandardErrHasColors()
Description
This function determines whether the terminal connected to standard error supports colors. If standard error is not connected to a terminal, this function returns false.
Declared at: llvm/include/llvm/Support/Process.h:171
¶static bool StandardErrIsDisplayed()
static bool StandardErrIsDisplayed()
Description
This function determines if the standard error is connected to a "tty" or "console" window. That is, the output would be displayed to the user rather than being put on a pipe or stored in a file.
Declared at: llvm/include/llvm/Support/Process.h:138
¶static bool StandardInIsUserInput()
static bool StandardInIsUserInput()
Description
This function determines if the standard input is connected directly to a user's input (keyboard probably), rather than coming from a file or pipe.
Declared at: llvm/include/llvm/Support/Process.h:128
¶static unsigned int StandardOutColumns()
static unsigned int StandardOutColumns()
Description
This function determines the number of columns in the window if standard output is connected to a "tty" or "console" window. If standard output is not connected to a tty or console, or if the number of columns cannot be determined, this routine returns zero.
Declared at: llvm/include/llvm/Support/Process.h:154
¶static bool StandardOutHasColors()
static bool StandardOutHasColors()
Description
This function determines whether the terminal connected to standard output supports colors. If standard output is not connected to a terminal, this function returns false.
Declared at: llvm/include/llvm/Support/Process.h:166
¶static bool StandardOutIsDisplayed()
static bool StandardOutIsDisplayed()
Description
This function determines if the standard output is connected to a "tty" or "console" window. That is, the output would be displayed to the user rather than being put on a pipe or stored in a file.
Declared at: llvm/include/llvm/Support/Process.h:133
¶static void UseANSIEscapeCodes(bool enable)
static void UseANSIEscapeCodes(bool enable)
Description
Enables or disables whether ANSI escape sequences are used to output colors. This only has an effect on Windows. Note: Setting this option is not thread-safe and should only be done during initialization.
Declared at: llvm/include/llvm/Support/Process.h:177
Parameters
- bool enable
¶static Expected<unsigned int> getPageSize()
static Expected<unsigned int> getPageSize()
Description
Get the process's page size. This may fail if the underlying syscall returns an error. In most cases, page size information is used for optimization, and this error can be safely discarded by calling consumeError, and an estimated page size substituted instead.
Declared at: llvm/include/llvm/Support/Process.h:50
¶static unsigned int getPageSizeEstimate()
static unsigned int getPageSizeEstimate()
Description
Get the process's estimated page size. This function always succeeds, but if the underlying syscall to determine the page size fails then this will silently return an estimated page size. The estimated page size is guaranteed to be a power of 2.
Declared at: llvm/include/llvm/Support/Process.h:56