|
static HandleType | guessHandle (HandleCategory category) noexcept |
| Gets the type of the handle given a category.
|
|
static HandleType | guessHandle (FileHandle file) noexcept |
| Gets the type of the stream to be used with the given descriptor.
|
|
static std::vector< CPUInfo > | cpuInfo () noexcept |
| Gets information about the CPUs on the system.
|
|
static std::vector< InterfaceAddress > | interfaceAddresses () noexcept |
| Gets a set of descriptors of all the available interfaces.
|
|
static std::string | indexToName (unsigned int index) noexcept |
| IPv6-capable implementation of if_indextoname.
|
|
static std::string | indexToIid (unsigned int index) noexcept |
| Retrieves a network interface identifier.
|
|
static bool | replaceAllocator (MallocFuncType mallocFunc, ReallocFuncType reallocFunc, CallocFuncType callocFunc, FreeFuncType freeFunc) noexcept |
| Override the use of some standard library’s functions.
|
|
static std::array< double, 3 > | loadAverage () noexcept |
| Gets the load average.
|
|
static char ** | setupArgs (int argc, char **argv) |
| Store the program arguments.
|
|
static std::string | processTitle () |
| Gets the title of the current process.
|
|
static bool | processTitle (const std::string &title) |
| Sets the current process title.
|
|
static uint64_t | totalMemory () noexcept |
| Gets memory information (in bytes).
|
|
static uint64_t | constrainedMemory () noexcept |
| Gets the amount of memory available to the process (in bytes).
|
|
static double | uptime () noexcept |
| Gets the current system uptime.
|
|
static RUsage | rusage () noexcept |
| Gets the resource usage measures for the current process.
|
|
static uint64_t | hrtime () noexcept |
| Gets the current high-resolution real time.
|
|
static std::string | path () noexcept |
| Gets the executable path.
|
|
static std::string | cwd () noexcept |
| Gets the current working directory.
|
|
static bool | chdir (const std::string &dir) noexcept |
| Changes the current working directory.
|
|
static TimeVal64 | timeOfDay () noexcept |
| Cross-platform implementation of gettimeofday
|
|
static void | sleep (unsigned int msec) noexcept |
| Causes the calling thread to sleep for a while.
|
|
static unsigned int | availableParallelism () noexcept |
| Returns an estimate of the amount of parallelism a program should use (always a non-zero value).
|
|
Miscellaneous utilities.
Miscellaneous functions that don’t really belong to any other class.
Definition at line 460 of file util.h.
static bool uvw::Utilities::replaceAllocator |
( |
MallocFuncType | mallocFunc, |
|
|
ReallocFuncType | reallocFunc, |
|
|
CallocFuncType | callocFunc, |
|
|
FreeFuncType | freeFunc ) |
|
staticnoexcept |
Override the use of some standard library’s functions.
Override the use of the standard library’s memory allocation functions.
This method must be invoked before any other uvw
function is called or after all resources have been freed and thus the underlying library doesn’t reference any allocated memory chunk.
If any of the function pointers is null, the invokation will fail.
- Note
- There is no protection against changing the allocator multiple times. If the user changes it they are responsible for making sure the allocator is changed while no memory was allocated with the previous allocator, or that they are compatible.
- Parameters
-
mallocFunc | Replacement function for malloc. |
reallocFunc | Replacement function for realloc. |
callocFunc | Replacement function for calloc. |
freeFunc | Replacement function for free. |
- Returns
- True in case of success, false otherwise.