// // Copyright 2014 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //
// system_utils.h: declaration of OS-specific utility functions
// Get absolute time in seconds. Use this function to get an absolute time with an unknown origin. double GetCurrentSystemTime(); // Get CPU time for current process in seconds. double GetCurrentProcessCpuTime();
// Unique thread id (std::this_thread::get_id() gets recycled!)
uint64_t GetCurrentThreadUniqueId();
// Run an application and get the output. Gets a nullptr-terminated set of args to execute the // application with, and returns the stdout and stderr outputs as well as the exit code. // // Pass nullptr for stdoutOut/stderrOut if you don't need to capture. exitCodeOut is required. // // Returns false if it fails to actually execute the application. bool RunApp(const std::vector<constchar *> &args,
std::string *stdoutOut,
std::string *stderrOut, int *exitCodeOut);
// Use SYSTEM_DIR to bypass loading ANGLE libraries with the same name as system DLLS // (e.g. opengl32.dll) enumclass SearchType
{ // Try to find the library in the same directory as the current module
ModuleDir, // Load the library from the system directories
SystemDir, // Get a reference to an already loaded shared library.
AlreadyLoaded,
};
// Return type of the PageFaultCallback enumclass PageFaultHandlerRangeType
{ // The memory address was known by the page fault handler
InRange, // The memory address was not in the page fault handler's range // and the signal will be forwarded to the default page handler.
OutOfRange,
};
using PageFaultCallback = std::function<PageFaultHandlerRangeType(uintptr_t)>;
class PageFaultHandler : angle::NonCopyable
{ public:
PageFaultHandler(PageFaultCallback callback); virtual ~PageFaultHandler();
// Registers OS level page fault handler for memory protection signals // and enables reception on PageFaultCallback virtualbool enable() = 0;
// Unregisters OS level page fault handler and deactivates PageFaultCallback virtualbool disable() = 0;
protected:
PageFaultCallback mCallback;
};
// Creates single instance page fault handler
PageFaultHandler *CreatePageFaultHandler(PageFaultCallback callback);
#ifdef ANGLE_PLATFORM_WINDOWS // Convert an UTF-16 wstring to an UTF-8 string.
std::string Narrow(const std::wstring_view &utf16);
// Convert an UTF-8 string to an UTF-16 wstring.
std::wstring Widen(const std::string_view &utf8); #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.