003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/include/llvm/Support
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
include
/
llvm
/
Support
/
📁
..
📄
AArch64TargetParser.def
(12.01 KB)
📄
AArch64TargetParser.h
(4.89 KB)
📄
AMDGPUMetadata.h
(17.98 KB)
📄
AMDHSAKernelDescriptor.h
(7.63 KB)
📄
ARMAttributeParser.h
(3.2 KB)
📄
ARMBuildAttributes.h
(8.6 KB)
📄
ARMEHABI.h
(3.72 KB)
📄
ARMTargetParser.def
(18.94 KB)
📄
ARMTargetParser.h
(8.76 KB)
📄
ARMWinEH.h
(18.27 KB)
📄
AlignOf.h
(1.56 KB)
📄
Alignment.h
(12.95 KB)
📄
Allocator.h
(16.54 KB)
📄
AllocatorBase.h
(3.87 KB)
📄
ArrayRecycler.h
(4.78 KB)
📄
Atomic.h
(1.09 KB)
📄
AtomicOrdering.h
(6.01 KB)
📄
Automaton.h
(9.64 KB)
📄
Base64.h
(1.84 KB)
📄
BinaryByteStream.h
(9.14 KB)
📄
BinaryItemStream.h
(3.63 KB)
📄
BinaryStream.h
(3.75 KB)
📄
BinaryStreamArray.h
(12.46 KB)
📄
BinaryStreamError.h
(1.29 KB)
📄
BinaryStreamReader.h
(11.01 KB)
📄
BinaryStreamRef.h
(10.09 KB)
📄
BinaryStreamWriter.h
(7.79 KB)
📄
BlockFrequency.h
(2.41 KB)
📄
BranchProbability.h
(7.92 KB)
📄
BuryPointer.h
(1.03 KB)
📄
CBindingWrapping.h
(1.86 KB)
📄
CFGDiff.h
(9.95 KB)
📄
CFGUpdate.h
(4.12 KB)
📄
COM.h
(1004 B)
📄
CRC.h
(1.63 KB)
📄
CachePruning.h
(3.5 KB)
📄
Capacity.h
(972 B)
📄
Casting.h
(13.92 KB)
📄
CheckedArithmetic.h
(3.71 KB)
📄
Chrono.h
(5.78 KB)
📄
CodeGen.h
(1.96 KB)
📄
CodeGenCoverage.h
(1.18 KB)
📄
CommandLine.h
(71.22 KB)
📄
Compiler.h
(19.5 KB)
📄
Compression.h
(1.39 KB)
📄
ConvertUTF.h
(11.4 KB)
📄
CrashRecoveryContext.h
(9.26 KB)
📄
DJB.h
(1.05 KB)
📄
DOTGraphTraits.h
(5.58 KB)
📄
DataExtractor.h
(30.28 KB)
📄
DataTypes.h
(775 B)
📄
Debug.h
(4.7 KB)
📄
DebugCounter.h
(7.01 KB)
📄
DynamicLibrary.h
(5.77 KB)
📄
ELFAttributeParser.h
(2.22 KB)
📄
ELFAttributes.h
(1.02 KB)
📄
Endian.h
(14.28 KB)
📄
EndianStream.h
(1.93 KB)
📄
Errc.h
(3.8 KB)
📄
Errno.h
(1.45 KB)
📄
Error.h
(43.82 KB)
📄
ErrorHandling.h
(6.39 KB)
📄
ErrorOr.h
(7.48 KB)
📄
ExtensibleRTTI.h
(4.02 KB)
📄
FileCheck.h
(6.69 KB)
📄
FileCollector.h
(3.74 KB)
📄
FileOutputBuffer.h
(3.36 KB)
📄
FileSystem.h
(53.03 KB)
📄
FileUtilities.h
(3.83 KB)
📄
Format.h
(9.45 KB)
📄
FormatAdapters.h
(3.38 KB)
📄
FormatCommon.h
(2.05 KB)
📄
FormatProviders.h
(15.27 KB)
📄
FormatVariadic.h
(9.88 KB)
📄
FormatVariadicDetails.h
(5.3 KB)
📄
FormattedStream.h
(6.42 KB)
📄
GenericDomTree.h
(30.89 KB)
📄
GenericDomTreeConstruction.h
(63.42 KB)
📄
GenericIteratedDominanceFrontier.h
(7.31 KB)
📄
GlobPattern.h
(1.35 KB)
📄
GraphWriter.h
(11.79 KB)
📄
Host.h
(2.68 KB)
📄
InitLLVM.h
(1.79 KB)
📄
ItaniumManglingCanonicalizer.h
(3.17 KB)
📄
JSON.h
(28.25 KB)
📄
KnownBits.h
(8.35 KB)
📄
LEB128.h
(5.74 KB)
📄
LineIterator.h
(2.62 KB)
📄
Locale.h
(223 B)
📄
LockFileManager.h
(3.13 KB)
📄
LowLevelTypeImpl.h
(11.94 KB)
📄
MD5.h
(3.39 KB)
📄
MSVCErrorWorkarounds.h
(2.62 KB)
📄
MachineValueType.h
(42.37 KB)
📄
ManagedStatic.h
(4.21 KB)
📄
MathExtras.h
(32.81 KB)
📄
MemAlloc.h
(3.21 KB)
📄
Memory.h
(6.94 KB)
📄
MemoryBuffer.h
(10.98 KB)
📄
MipsABIFlags.h
(3.92 KB)
📄
Mutex.h
(2.14 KB)
📄
NativeFormatting.h
(1.64 KB)
📄
OnDiskHashTable.h
(21.97 KB)
📄
OptimizedStructLayout.h
(5.89 KB)
📄
Parallel.h
(5.99 KB)
📄
Path.h
(15.6 KB)
📄
PluginLoader.h
(1.29 KB)
📄
PointerLikeTypeTraits.h
(5.69 KB)
📄
PrettyStackTrace.h
(4.45 KB)
📄
Printable.h
(1.5 KB)
📄
Process.h
(9.31 KB)
📄
Program.h
(10.35 KB)
📄
RISCVAttributeParser.h
(1.15 KB)
📄
RISCVAttributes.h
(1.2 KB)
📄
RISCVTargetParser.def
(446 B)
📄
RWMutex.h
(5.65 KB)
📄
RandomNumberGenerator.h
(2.29 KB)
📄
Recycler.h
(3.47 KB)
📄
RecyclingAllocator.h
(2.38 KB)
📄
Regex.h
(4.37 KB)
📄
Registry.h
(5.14 KB)
📄
ReverseIteration.h
(360 B)
📄
SHA1.h
(2.37 KB)
📄
SMLoc.h
(1.78 KB)
📄
SMTAPI.h
(16.33 KB)
📄
SaveAndRestore.h
(1.02 KB)
📄
ScaledNumber.h
(30.65 KB)
📄
ScopedPrinter.h
(11.39 KB)
📄
Signals.h
(5.22 KB)
📄
Signposts.h
(1.29 KB)
📄
SmallVectorMemoryBuffer.h
(2.28 KB)
📁
Solaris
📄
SourceMgr.h
(10.37 KB)
📄
SpecialCaseList.h
(6.01 KB)
📄
StringSaver.h
(1.94 KB)
📄
SuffixTree.h
(13.15 KB)
📄
SwapByteOrder.h
(4.8 KB)
📄
SymbolRemappingReader.h
(4.36 KB)
📄
SystemUtils.h
(1.02 KB)
📄
TarWriter.h
(941 B)
📄
TargetOpcodes.def
(22.01 KB)
📄
TargetParser.h
(4.08 KB)
📄
TargetRegistry.h
(46.87 KB)
📄
TargetSelect.h
(6.2 KB)
📄
TaskQueue.h
(4.24 KB)
📄
ThreadLocal.h
(2.08 KB)
📄
ThreadPool.h
(3.44 KB)
📄
Threading.h
(10.62 KB)
📄
TimeProfiler.h
(3.46 KB)
📄
Timer.h
(8.93 KB)
📄
ToolOutputFile.h
(2.24 KB)
📄
TrailingObjects.h
(15.19 KB)
📄
TrigramIndex.h
(2.84 KB)
📄
TypeName.h
(2.13 KB)
📄
TypeSize.h
(8.53 KB)
📄
Unicode.h
(2.5 KB)
📄
UnicodeCharRanges.h
(3.27 KB)
📄
Valgrind.h
(1.16 KB)
📄
VersionTuple.h
(5.22 KB)
📄
VirtualFileSystem.h
(28.28 KB)
📄
Watchdog.h
(1.15 KB)
📄
Win64EH.h
(4.82 KB)
📁
Windows
📄
WindowsError.h
(541 B)
📄
WithColor.h
(4.64 KB)
📄
X86DisassemblerDecoderCommon.h
(29.39 KB)
📄
X86TargetParser.def
(8.21 KB)
📄
X86TargetParser.h
(3.57 KB)
📄
YAMLParser.h
(16.29 KB)
📄
YAMLTraits.h
(67.62 KB)
📄
circular_raw_ostream.h
(4.97 KB)
📄
raw_os_ostream.h
(1.29 KB)
📄
raw_ostream.h
(20.82 KB)
📄
raw_sha1_ostream.h
(1.29 KB)
📄
thread.h
(1.33 KB)
📄
type_traits.h
(6.75 KB)
📄
xxhash.h
(1.92 KB)
Editing: Process.h
//===- llvm/Support/Process.h -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// \file /// /// Provides a library for accessing information about this process and other /// processes on the operating system. Also provides means of spawning /// subprocess for commands. The design of this library is modeled after the /// proposed design of the Boost.Process library, and is design specifically to /// follow the style of standard libraries and potentially become a proposal /// for a standard library. /// /// This file declares the llvm::sys::Process class which contains a collection /// of legacy static interfaces for extracting various information about the /// current process. The goal is to migrate users of this API over to the new /// interfaces. /// //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_PROCESS_H #define LLVM_SUPPORT_PROCESS_H #include "llvm/ADT/Optional.h" #include "llvm/Support/AllocatorBase.h" #include "llvm/Support/Chrono.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/Error.h" #include <system_error> namespace llvm { template <typename T> class ArrayRef; class StringRef; namespace sys { /// A collection of legacy interfaces for querying information about the /// current executing process. class Process { public: using Pid = int32_t; /// Get the process's identifier. static Pid getProcessId(); /// 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. static Expected<unsigned> getPageSize(); /// 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. static unsigned getPageSizeEstimate() { if (auto PageSize = getPageSize()) return *PageSize; else { consumeError(PageSize.takeError()); return 4096; } } /// 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. static size_t GetMallocUsage(); /// 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. /// \param elapsed Returns the system_clock::now() giving current time /// \param user_time Returns the current amount of user time for the process /// \param sys_time Returns the current amount of system time for the process static void GetTimeUsage(TimePoint<> &elapsed, std::chrono::nanoseconds &user_time, std::chrono::nanoseconds &sys_time); /// 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. static void PreventCoreFiles(); /// true if PreventCoreFiles has been called, false otherwise. static bool AreCoreFilesPrevented(); // This function returns the environment variable \arg name's value as a UTF-8 // string. \arg Name is assumed to be in UTF-8 encoding too. static Optional<std::string> GetEnv(StringRef name); /// 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. static Optional<std::string> FindInEnvPath(StringRef EnvName, StringRef FileName, ArrayRef<std::string> IgnoreList); static Optional<std::string> FindInEnvPath(StringRef EnvName, StringRef FileName); // This functions ensures that the standard file descriptors (input, output, // and error) are properly mapped to a file descriptor before we use any of // them. This should only be called by standalone programs, library // components should not call this. static std::error_code FixupStandardFileDescriptors(); // This function safely closes a file descriptor. It is not safe to retry // close(2) when it returns with errno equivalent to EINTR; this is because // *nixen cannot agree if the file descriptor is, in fact, closed when this // occurs. // // N.B. Some operating systems, due to thread cancellation, cannot properly // guarantee that it will or will not be closed one way or the other! static std::error_code SafelyCloseFileDescriptor(int FD); /// 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. static bool StandardInIsUserInput(); /// 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. static bool StandardOutIsDisplayed(); /// 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. static bool StandardErrIsDisplayed(); /// 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. static bool FileDescriptorIsDisplayed(int fd); /// This function determines if the given file descriptor is displayd and /// supports colors. static bool FileDescriptorHasColors(int fd); /// 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. static unsigned StandardOutColumns(); /// 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. static unsigned StandardErrColumns(); /// 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. static bool StandardOutHasColors(); /// 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. static bool StandardErrHasColors(); /// 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. static void UseANSIEscapeCodes(bool enable); /// Whether changing colors requires the output to be flushed. /// This is needed on systems that don't support escape sequences for /// changing colors. static bool ColorNeedsFlush(); /// 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. static const char *OutputColor(char c, bool bold, bool bg); /// Same as OutputColor, but only enables the bold attribute. static const char *OutputBold(bool bg); /// This function returns the escape sequence to reverse forground and /// background colors. static const char *OutputReverse(); /// Resets the terminals colors, or returns an escape sequence to do so. static const char *ResetColor(); /// Get the result of a process wide random number generator. The /// generator will be automatically seeded in non-deterministic fashion. static unsigned GetRandomNumber(); /// 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. LLVM_ATTRIBUTE_NORETURN static void Exit(int RetCode); }; } } #endif
Upload File
Create Folder