[+] Initial heap stat counter API
[+] Upcoming failure categories [+] Updated SysPushXXX prototypes [*] Restore bandwidth OnTick position for extrapolate (using current frame stats, ref to last) fractional lerps into the future with ref to average [*] Compression.cpp AuList<AuUInt8> upgrade was incomplete & could've been improved with modern apis
This commit is contained in:
parent
1b26faf45a
commit
1ff9feb303
@ -11,6 +11,7 @@ namespace Aurora::Debug
|
|||||||
{
|
{
|
||||||
enum EFailureCategory
|
enum EFailureCategory
|
||||||
{
|
{
|
||||||
|
// [mostly] defacto standard circa 2020:
|
||||||
kFailureGeneric,
|
kFailureGeneric,
|
||||||
kFailureNested,
|
kFailureNested,
|
||||||
kFailureMemory,
|
kFailureMemory,
|
||||||
@ -44,6 +45,67 @@ namespace Aurora::Debug
|
|||||||
kFailureInSandboxContext,
|
kFailureInSandboxContext,
|
||||||
kFailureParseError,
|
kFailureParseError,
|
||||||
|
|
||||||
|
// additional late 2022:
|
||||||
|
kFailureResourceExists,
|
||||||
|
kFailureResourceInvalid,
|
||||||
|
|
||||||
|
kFailureFeatureMissing,
|
||||||
|
kFailureFeatureOutOfDate,
|
||||||
|
|
||||||
|
kFailureIOResourceFailure,
|
||||||
|
kFailureIOResourceRejected,
|
||||||
|
kFailureIOResourceOverflow,
|
||||||
|
kFailureIOResourceDisconnected,
|
||||||
|
kFailureIOResourceNoData,
|
||||||
|
kFailureIOResourceWouldBlock,
|
||||||
|
|
||||||
|
kFailureInvalidPath,
|
||||||
|
kFailureInvalidHandle,
|
||||||
|
kFailureInvalidFd,
|
||||||
|
kFailureInvalidContext,
|
||||||
|
|
||||||
|
kFailureUnreachable,
|
||||||
|
kFailureOutOfBounds,
|
||||||
|
kFailureUnderflow,
|
||||||
|
kFailureOverflow,
|
||||||
|
|
||||||
|
kFailureOutOfSpace,
|
||||||
|
kFailureOutOfSpaceDisk,
|
||||||
|
kFailureOutOfSpaceMemory,
|
||||||
|
kFailureWorkerUnavailable,
|
||||||
|
|
||||||
|
kFailureIOBlockReadError,
|
||||||
|
kFailureIOWriteReadError,
|
||||||
|
|
||||||
|
kFailureSystemError,
|
||||||
|
kFailureSystemFileSystemError,
|
||||||
|
kFailureSystemBIOSError,
|
||||||
|
kFailureSystemInputError,
|
||||||
|
kFailureSystemDeviceError,
|
||||||
|
kFailureSystemFirmwareError,
|
||||||
|
|
||||||
|
kFailureConcurrentRejected,
|
||||||
|
kFailureConcurrentAborted,
|
||||||
|
kFailureConcurrentWrongThread,
|
||||||
|
kFailureConcurrentDeadlock,
|
||||||
|
|
||||||
|
kFailureVersionMismatch,
|
||||||
|
kFailureHashMismatch,
|
||||||
|
kFailureCryptographicVerificationFailure,
|
||||||
|
|
||||||
|
kFailureInvalidArgPos1,
|
||||||
|
kFailureInvalidArgPos2,
|
||||||
|
kFailureInvalidArgPos3,
|
||||||
|
kFailureInvalidArgPos4,
|
||||||
|
kFailureInvalidArgPos5,
|
||||||
|
kFailureInvalidArgPos6,
|
||||||
|
kFailureInvalidArgPos7,
|
||||||
|
kFailureInvalidArgPos8,
|
||||||
|
kFailureInvalidArgPos9,
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
kFailureNone = 255,
|
kFailureNone = 255,
|
||||||
kFailureUserBegin = 256
|
kFailureUserBegin = 256
|
||||||
};
|
};
|
||||||
|
@ -24,6 +24,7 @@ namespace Aurora::Debug
|
|||||||
AuOptional<EFailureCategory> eFailureCategory;
|
AuOptional<EFailureCategory> eFailureCategory;
|
||||||
AuOptional<StackTrace> optStackTrace;
|
AuOptional<StackTrace> optStackTrace;
|
||||||
AuOptional<AuUInt> optOsErrorCode;
|
AuOptional<AuUInt> optOsErrorCode;
|
||||||
|
AuUInt16 uDebugBuildSourceLineHint {};
|
||||||
|
|
||||||
AUKN_SYM AuString ToString();
|
AUKN_SYM AuString ToString();
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace Aurora::Debug
|
namespace Aurora::Debug
|
||||||
{
|
{
|
||||||
AUKN_SYM void _PushError(AuUInt address, EFailureCategory category, const char *msg);
|
AUKN_SYM void _PushError(AuUInt address, EFailureCategory category, const char *msg, AuUInt16 uLine = 0);
|
||||||
|
|
||||||
#if defined(AURORA_COMPILER_MSVC)
|
#if defined(AURORA_COMPILER_MSVC)
|
||||||
#define _DBG_RET_ADDR (AuUInt)_ReturnAddress()
|
#define _DBG_RET_ADDR (AuUInt)_ReturnAddress()
|
||||||
@ -40,83 +40,116 @@ namespace Aurora::Debug
|
|||||||
#endif
|
#endif
|
||||||
#undef _FREECOMPILER_OPTIMIZE_OFF
|
#undef _FREECOMPILER_OPTIMIZE_OFF
|
||||||
|
|
||||||
static auline void ErrorMakeNested()
|
static AU_INLINE void ErrorMakeNested()
|
||||||
{
|
{
|
||||||
_PushError(_DBG_RET_ADDR, EFailureCategory::kFailureNested, nullptr);
|
_PushError(GetIPNoBackend(), EFailureCategory::kFailureNested, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ... T>
|
template<typename ... T>
|
||||||
auline void ErrorMakeNested(const AuString &msg, T&& ... args)
|
AU_INLINE void ErrorMakeNested(const AuString &msg, T&& ... args)
|
||||||
{
|
{
|
||||||
if constexpr (sizeof...(T) == 0)
|
if constexpr (sizeof...(T) == 0)
|
||||||
{
|
{
|
||||||
_PushError(_DBG_RET_ADDR, EFailureCategory::kFailureNested, msg.c_str());
|
_PushError(GetIPNoBackend(), EFailureCategory::kFailureNested, msg.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(_AUHAS_FMT)
|
#if defined(_AUHAS_FMT)
|
||||||
try
|
AUROXTL_COMMODITY_TRY
|
||||||
{
|
{
|
||||||
auto tempString = fmt::format(msg, AuForward<T>(args)...);
|
auto tempString = fmt::format(msg, AuForward<T>(args)...);
|
||||||
_PushError(_DBG_RET_ADDR, EFailureCategory::kFailureNested, tempString.c_str());
|
_PushError(GetIPNoBackend(), EFailureCategory::kFailureNested, tempString.c_str());
|
||||||
}
|
}
|
||||||
catch (...)
|
AUROXTL_COMMODITY_CATCH
|
||||||
{
|
{
|
||||||
_PushError(_DBG_RET_ADDR, EFailureCategory::kFailureNested, msg.c_str());
|
_PushError(GetIPNoBackend(), EFailureCategory::kFailureNested, msg.c_str());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
_PushError(_DBG_RET_ADDR, EFailureCategory::kFailureNested, msg.c_str());
|
_PushError(GetIPNoBackend(), EFailureCategory::kFailureNested, msg.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static auline void ErrorMakeNested(const char *msg)
|
static AU_INLINE void ErrorMakeNested(const char *msg)
|
||||||
{
|
{
|
||||||
_PushError(_DBG_RET_ADDR, EFailureCategory::kFailureNested, msg);
|
_PushError(GetIPNoBackend(), EFailureCategory::kFailureNested, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ... T>
|
template<typename ... T>
|
||||||
auline void SysPushError(EFailureCategory category, const AuString &msg, T&& ... args)
|
AU_INLINE void SysPushError(EFailureCategory category, const AuString &msg, T&& ... args)
|
||||||
{
|
{
|
||||||
if constexpr (sizeof...(T) == 0)
|
if constexpr (sizeof...(T) == 0)
|
||||||
{
|
{
|
||||||
_PushError(_DBG_RET_ADDR, category, msg.c_str());
|
_PushError(GetIPNoBackend(), category, msg.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(_AUHAS_FMT)
|
#if defined(_AUHAS_FMT)
|
||||||
try
|
AUROXTL_COMMODITY_TRY
|
||||||
{
|
{
|
||||||
auto tempString = fmt::format(msg, AuForward<T>(args)...);
|
auto tempString = fmt::format(msg, AuForward<T>(args)...);
|
||||||
_PushError(_DBG_RET_ADDR, category, tempString.c_str());
|
_PushError(GetIPNoBackend(), category, tempString.c_str());
|
||||||
}
|
}
|
||||||
catch (...)
|
AUROXTL_COMMODITY_CATCH
|
||||||
{
|
{
|
||||||
_PushError(_DBG_RET_ADDR, category, msg.c_str());
|
_PushError(GetIPNoBackend(), category, msg.c_str());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
_PushError(_DBG_RET_ADDR, category, msg.c_str());
|
_PushError(GetIPNoBackend(), category, msg.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static auline void SysPushError(EFailureCategory category, const char *msg)
|
template<typename ... T>
|
||||||
|
AU_INLINE void SysPushError(EFailureCategory category, AuUInt16 uLineHint, const AuString &msg, T&& ... args)
|
||||||
{
|
{
|
||||||
_PushError(_DBG_RET_ADDR, category, msg);
|
if constexpr (sizeof...(T) == 0)
|
||||||
|
{
|
||||||
|
_PushError(GetIPNoBackend(), category, msg.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Aurora::Debug::AddMemoryCrunch();
|
||||||
|
#if defined(_AUHAS_FMT)
|
||||||
|
AUROXTL_COMMODITY_TRY
|
||||||
|
{
|
||||||
|
auto tempString = fmt::format(msg, AuForward<T>(args)...);
|
||||||
|
_PushError(GetIPNoBackend(), category, tempString.c_str(), uLineHint);
|
||||||
|
}
|
||||||
|
AUROXTL_COMMODITY_CATCH
|
||||||
|
{
|
||||||
|
_PushError(GetIPNoBackend(), category, msg.c_str(), uLineHint);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
_PushError(GetIPNoBackend(), category, msg.c_str(), uLineHint);
|
||||||
|
#endif
|
||||||
|
Aurora::Debug::DecMemoryCrunch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static auline void SysPushError(EFailureCategory category)
|
static AU_INLINE void SysPushError(EFailureCategory category, const char *msg, AuUInt16 uLineHint = 0)
|
||||||
{
|
{
|
||||||
_PushError(_DBG_RET_ADDR, category, "");
|
_PushError(GetIPNoBackend(), category, msg, uLineHint);
|
||||||
|
}
|
||||||
|
|
||||||
|
static AU_INLINE void SysPushError(EFailureCategory category, AuUInt16 uLineHint = 0)
|
||||||
|
{
|
||||||
|
_PushError(GetIPNoBackend(), category, "", uLineHint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(AU_CFG_ID_INTERNAL) || defined(AU_CFG_ID_DEBUG)
|
||||||
|
#define SysSafeLine __LINE__
|
||||||
|
#else
|
||||||
|
#define SysSafeLine 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SysCheckReturn(x, ...) if (!(static_cast<bool>(x))) { Aurora::Debug::ErrorMakeNested(); return __VA_ARGS__; }
|
#define SysCheckReturn(x, ...) if (!(static_cast<bool>(x))) { Aurora::Debug::ErrorMakeNested(); return __VA_ARGS__; }
|
||||||
|
|
||||||
#define SysPushErrorError(error, ...) do { Aurora::Debug::AddMemoryCrunch(); Aurora::Debug::SysPushError(Aurora::Debug::error, ## __VA_ARGS__) ;Aurora::Debug::DecMemoryCrunch(); } while (0)
|
#define SysPushErrorError(error, ...) do { Aurora::Debug::AddMemoryCrunch(); Aurora::Debug::SysPushError(Aurora::Debug::error, SysSafeLine, ## __VA_ARGS__) ;Aurora::Debug::DecMemoryCrunch(); } while (0)
|
||||||
#define SysPushUserError(exp, ...) do { Aurora::Debug::AddMemoryCrunch(); Aurora::Debug::SysPushError((Aurora::Debug::EFailureCategory)exp, ## __VA_ARGS__) ;Aurora::Debug::DecMemoryCrunch(); } while (0)
|
#define SysPushUserError(exp, ...) do { Aurora::Debug::AddMemoryCrunch(); Aurora::Debug::SysPushError((Aurora::Debug::EFailureCategory)exp, SysSafeLine, ## __VA_ARGS__) ;Aurora::Debug::DecMemoryCrunch(); } while (0)
|
||||||
|
|
||||||
// legacy
|
// legacy+shorthands
|
||||||
#define SysPushErrorArg(...) SysPushErrorError(kFailureParam, ## __VA_ARGS__)
|
#define SysPushErrorArg(...) SysPushErrorError(kFailureParam, ## __VA_ARGS__)
|
||||||
#define SysPushErrorGen(...) SysPushErrorError(kFailureGeneric, ## __VA_ARGS__)
|
#define SysPushErrorGen(...) SysPushErrorError(kFailureGeneric, ## __VA_ARGS__)
|
||||||
#define SysPushErrorCrypt(...) SysPushErrorError(kFailureCrypto, ## __VA_ARGS__)
|
#define SysPushErrorCrypt(...) SysPushErrorError(kFailureCrypto, ## __VA_ARGS__)
|
||||||
@ -127,84 +160,174 @@ namespace Aurora::Debug
|
|||||||
#define SysPushErrorNested(...) Aurora::Debug::ErrorMakeNested(__VA_ARGS__);
|
#define SysPushErrorNested(...) Aurora::Debug::ErrorMakeNested(__VA_ARGS__);
|
||||||
|
|
||||||
// enums
|
// enums
|
||||||
#define SysPushErrorGeneric(...) SysPushErrorError(kFailureGeneric, ## __VA_ARGS__)
|
#define SysPushErrorGeneric(...) SysPushErrorError(kFailureGeneric, ## __VA_ARGS__)
|
||||||
#define SysPushErrorCatch(...) SysPushErrorError(kFailureCatch, ## __VA_ARGS__)
|
#define SysPushErrorCatch(...) SysPushErrorError(kFailureCatch, ## __VA_ARGS__)
|
||||||
#define SysPushErrorMemory(...) SysPushErrorError(kFailureMemory, ## __VA_ARGS__)
|
#define SysPushErrorMemory(...) SysPushErrorError(kFailureMemory, ## __VA_ARGS__)
|
||||||
#define SysPushErrorIO(...) SysPushErrorError(kFailureIO, ## __VA_ARGS__)
|
#define SysPushErrorIO(...) SysPushErrorError(kFailureIO, ## __VA_ARGS__)
|
||||||
#define SysPushErrorFIO(...) SysPushErrorError(kFailureFIO, ## __VA_ARGS__)
|
#define SysPushErrorFIO(...) SysPushErrorError(kFailureFIO, ## __VA_ARGS__)
|
||||||
#define SysPushErrorNet(...) SysPushErrorError(kFailureNet, ## __VA_ARGS__)
|
#define SysPushErrorNet(...) SysPushErrorError(kFailureNet, ## __VA_ARGS__)
|
||||||
#define SysPushErrorAudio(...) SysPushErrorError(kFailureAudio, ## __VA_ARGS__)
|
#define SysPushErrorAudio(...) SysPushErrorError(kFailureAudio, ## __VA_ARGS__)
|
||||||
#define SysPushErrorHAL(...) SysPushErrorError(kFailureHAL, ## __VA_ARGS__)
|
#define SysPushErrorHAL(...) SysPushErrorError(kFailureHAL, ## __VA_ARGS__)
|
||||||
#define SysPushErrorHALContext(...) SysPushErrorError(kFailureHALContext, ## __VA_ARGS__)
|
#define SysPushErrorHALContext(...) SysPushErrorError(kFailureHALContext, ## __VA_ARGS__)
|
||||||
#define SysPushErrorCrypto(...) SysPushErrorError(kFailureCrypto, ## __VA_ARGS__)
|
#define SysPushErrorCrypto(...) SysPushErrorError(kFailureCrypto, ## __VA_ARGS__)
|
||||||
#define SysPushErrorParam(...) SysPushErrorError(kFailureParam, ## __VA_ARGS__)
|
#define SysPushErrorParam(...) SysPushErrorError(kFailureParam, ## __VA_ARGS__)
|
||||||
#define SysPushErrorLogicError(...) SysPushErrorError(kFailureLogicError, ## __VA_ARGS__)
|
#define SysPushErrorLogicError(...) SysPushErrorError(kFailureLogicError, ## __VA_ARGS__)
|
||||||
#define SysPushErrorMathError(...) SysPushErrorError(kFailureMathError, ## __VA_ARGS__)
|
#define SysPushErrorMathError(...) SysPushErrorError(kFailureMathError, ## __VA_ARGS__)
|
||||||
#define SysPushErrorUnavailableError(...) SysPushErrorError(kFailureUnavailableError, ## __VA_ARGS__)
|
#define SysPushErrorUnavailableError(...) SysPushErrorError(kFailureUnavailableError, ## __VA_ARGS__)
|
||||||
#define SysPushErrorTimeoutError(...) SysPushErrorError(kFailureTimeoutError, ## __VA_ARGS__)
|
#define SysPushErrorTimeoutError(...) SysPushErrorError(kFailureTimeoutError, ## __VA_ARGS__)
|
||||||
#define SysPushErrorWatchdogError(...) SysPushErrorError(kFailureWatchdogError, ## __VA_ARGS__)
|
#define SysPushErrorWatchdogError(...) SysPushErrorError(kFailureWatchdogError, ## __VA_ARGS__)
|
||||||
#define SysPushErrorServiceError(...) SysPushErrorError(kFailureServiceError, ## __VA_ARGS__)
|
#define SysPushErrorServiceError(...) SysPushErrorError(kFailureServiceError, ## __VA_ARGS__)
|
||||||
#define SysPushErrorPermissionError(...) SysPushErrorError(kFailurePermissionError, ## __VA_ARGS__)
|
#define SysPushErrorPermissionError(...) SysPushErrorError(kFailurePermissionError, ## __VA_ARGS__)
|
||||||
#define SysPushErrorOutOfRange(...) SysPushErrorError(kFailureOutOfRange, ## __VA_ARGS__)
|
#define SysPushErrorOutOfRange(...) SysPushErrorError(kFailureOutOfRange, ## __VA_ARGS__)
|
||||||
#define SysPushErrorSyntaxError(...) SysPushErrorError(kFailureSyntaxError, ## __VA_ARGS__)
|
#define SysPushErrorSyntaxError(...) SysPushErrorError(kFailureSyntaxError, ## __VA_ARGS__)
|
||||||
#define SysPushErrorDisconnected(...) SysPushErrorError(kFailureDisconnected, ## __VA_ARGS__)
|
#define SysPushErrorDisconnected(...) SysPushErrorError(kFailureDisconnected, ## __VA_ARGS__)
|
||||||
#define SysPushErrorUninitialized(...) SysPushErrorError(kFailureUninitialized, ## __VA_ARGS__)
|
#define SysPushErrorUninitialized(...) SysPushErrorError(kFailureUninitialized, ## __VA_ARGS__)
|
||||||
#define SysPushErrorUnimplemented(...) SysPushErrorError(kFailureUnimplemented, ## __VA_ARGS__)
|
#define SysPushErrorUnimplemented(...) SysPushErrorError(kFailureUnimplemented, ## __VA_ARGS__)
|
||||||
#define SysPushErrorSubmission(...) SysPushErrorError(kFailureSubmission, ## __VA_ARGS__)
|
#define SysPushErrorSubmission(...) SysPushErrorError(kFailureSubmission, ## __VA_ARGS__)
|
||||||
#define SysPushErrorLockError(...) SysPushErrorError(kFailureLockError, ## __VA_ARGS__)
|
#define SysPushErrorLockError(...) SysPushErrorError(kFailureLockError, ## __VA_ARGS__)
|
||||||
#define SysPushErrorSyntax(...) SysPushErrorError(kFailureSyntax, ## __VA_ARGS__)
|
#define SysPushErrorSyntax(...) SysPushErrorError(kFailureSyntax, ## __VA_ARGS__)
|
||||||
#define SysPushErrorNoAccess(...) SysPushErrorError(kFailureNoAccess, ## __VA_ARGS__)
|
#define SysPushErrorNoAccess(...) SysPushErrorError(kFailureNoAccess, ## __VA_ARGS__)
|
||||||
#define SysPushErrorResourceMissing(...) SysPushErrorError(kFailureResourceMissing, ## __VA_ARGS__)
|
#define SysPushErrorResourceMissing(...) SysPushErrorError(kFailureResourceMissing, ## __VA_ARGS__)
|
||||||
#define SysPushErrorResourceLocked(...) SysPushErrorError(kFailureResourceLocked, ## __VA_ARGS__)
|
#define SysPushErrorResourceLocked(...) SysPushErrorError(kFailureResourceLocked, ## __VA_ARGS__)
|
||||||
#define SysPushErrorMalformedData(...) SysPushErrorError(kFailureMalformedData, ## __VA_ARGS__)
|
#define SysPushErrorMalformedData(...) SysPushErrorError(kFailureMalformedData, ## __VA_ARGS__)
|
||||||
#define SysPushErrorInSandboxContext(...) SysPushErrorError(kFailureInSandboxContext, ## __VA_ARGS__)
|
#define SysPushErrorInSandboxContext(...) SysPushErrorError(kFailureInSandboxContext, ## __VA_ARGS__)
|
||||||
#define SysPushErrorParseError(...) SysPushErrorError(kFailureParseError, ## __VA_ARGS__)
|
#define SysPushErrorParseError(...) SysPushErrorError(kFailureParseError, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorResourceExists(...) SysPushErrorError(kFailureResourceExists, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorResourceInvalid(...) SysPushErrorError(kFailureResourceInvalid, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorFeatureMissing(...) SysPushErrorError(kFailureFeatureMissing, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorFeatureOutOfDate(...) SysPushErrorError(kFailureFeatureOutOfDate, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorIOResourceFailure(...) SysPushErrorError(kFailureIOResourceFailure, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorIOResourceRejected(...) SysPushErrorError(kFailureIOResourceRejected, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorIOResourceOverflow(...) SysPushErrorError(kFailureIOResourceOverflow, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorIOResourceDisconnected(...) SysPushErrorError(kFailureIOResourceDisconnected, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorIOResourceNoData(...) SysPushErrorError(kFailureIOResourceNoData, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorIOResourceWouldBlock(...) SysPushErrorError(kFailureIOResourceWouldBlock, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidPath(...) SysPushErrorError(kFailureInvalidPath, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidHandle(...) SysPushErrorError(kFailureInvalidHandle, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidFd(...) SysPushErrorError(kFailureInvalidFd, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidContext(...) SysPushErrorError(kFailureInvalidContext, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorUnreachable(...) SysPushErrorError(kFailureUnreachable, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorOutOfBounds(...) SysPushErrorError(kFailureOutOfBounds, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorUnderflow(...) SysPushErrorError(kFailureUnderflow, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorOverflow(...) SysPushErrorError(kFailureOverflow, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorOutOfSpace(...) SysPushErrorError(kFailureOutOfSpace, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorOutOfSpaceDisk(...) SysPushErrorError(kFailureOutOfSpaceDisk, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorOutOfSpaceMemory(...) SysPushErrorError(kFailureOutOfSpaceMemory, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorWorkerUnavailable(...) SysPushErrorError(kFailureWorkerUnavailable, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorIOBlockReadError(...) SysPushErrorError(kFailureIOBlockReadError, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorIOWriteReadError(...) SysPushErrorError(kFailureIOWriteReadError, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorSystemError(...) SysPushErrorError(kFailureSystemError, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorSystemFileSystemError(...) SysPushErrorError(kFailureSystemFileSystemError, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorSystemBIOSError(...) SysPushErrorError(kFailureSystemBIOSError, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorSystemInputError(...) SysPushErrorError(kFailureSystemInputError, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorSystemDeviceError(...) SysPushErrorError(kFailureSystemDeviceError, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorSystemFirmwareError(...) SysPushErrorError(kFailureSystemFirmwareError, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorConcurrentRejected(...) SysPushErrorError(kFailureConcurrentRejected, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorConcurrentAborted(...) SysPushErrorError(kFailureConcurrentAborted, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorConcurrentWrongThread(...) SysPushErrorError(kFailureConcurrentWrongThread, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorConcurrentDeadlock(...) SysPushErrorError(kFailureConcurrentDeadlock, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorVersionMismatch(...) SysPushErrorError(kFailureVersionMismatch, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorHashMismatch(...) SysPushErrorError(kFailureHashMismatch, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorCryptographicVerificationFailure(...) SysPushErrorError(kFailureCryptographicVerificationFailure, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidArgPos1(...) SysPushErrorError(kFailureInvalidArgPos1, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidArgPos2(...) SysPushErrorError(kFailureInvalidArgPos2, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidArgPos3(...) SysPushErrorError(kFailureInvalidArgPos3, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidArgPos4(...) SysPushErrorError(kFailureInvalidArgPos4, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidArgPos5(...) SysPushErrorError(kFailureInvalidArgPos5, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidArgPos6(...) SysPushErrorError(kFailureInvalidArgPos6, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidArgPos7(...) SysPushErrorError(kFailureInvalidArgPos7, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidArgPos8(...) SysPushErrorError(kFailureInvalidArgPos8, ## __VA_ARGS__)
|
||||||
|
#define SysPushErrorInvalidArgPos9(...) SysPushErrorError(kFailureInvalidArgPos9, ## __VA_ARGS__)
|
||||||
|
|
||||||
|
#if defined(AU_CFG_ID_INTERNAL) || defined(AU_CFG_ID_DEBUG)
|
||||||
|
|
||||||
#if defined(DEBUG) || defined(STAGING)
|
#define SysPushUserErrorDbg SysPushUserError
|
||||||
|
|
||||||
#define SysPushUserErrorDbg SysPushUserError
|
#define SysPushErrorArgDbg SysPushErrorArg
|
||||||
|
#define SysPushErrorGenDbg SysPushErrorGen
|
||||||
#define SysPushErrorArgDbg SysPushErrorArg
|
#define SysPushErrorCryptDbg SysPushErrorCrypt
|
||||||
#define SysPushErrorGenDbg SysPushErrorGen
|
#define SysPushErrorNetDbg SysPushErrorNet
|
||||||
#define SysPushErrorCryptDbg SysPushErrorCrypt
|
#define SysPushErrorMemDbg SysPushErrorMem
|
||||||
#define SysPushErrorNetDbg SysPushErrorNet
|
|
||||||
#define SysPushErrorMemDbg SysPushErrorMem
|
#define SysPushErrorGenericDbg SysPushErrorGeneric
|
||||||
|
#define SysPushErrorNestedDbg SysPushErrorNested
|
||||||
#define SysPushErrorGenericDbg SysPushErrorGeneric
|
#define SysPushErrorMemoryDbg SysPushErrorMemory
|
||||||
#define SysPushErrorNestedDbg SysPushErrorNested
|
#define SysPushErrorIODbg SysPushErrorIO
|
||||||
#define SysPushErrorMemoryDbg SysPushErrorMemory
|
#define SysPushErrorFIODbg SysPushErrorFIO
|
||||||
#define SysPushErrorIODbg SysPushErrorIO
|
#define SysPushErrorNetDbg SysPushErrorNet
|
||||||
#define SysPushErrorFIODbg SysPushErrorFIO
|
#define SysPushErrorAudioDbg SysPushErrorAudio
|
||||||
#define SysPushErrorNetDbg SysPushErrorNet
|
#define SysPushErrorHALDbg SysPushErrorHAL
|
||||||
#define SysPushErrorAudioDbg SysPushErrorAudio
|
#define SysPushErrorHALContextDbg SysPushErrorHALContext
|
||||||
#define SysPushErrorHALDbg SysPushErrorHAL
|
#define SysPushErrorCryptoDbg SysPushErrorCrypto
|
||||||
#define SysPushErrorHALContextDbg SysPushErrorHALContext
|
#define SysPushErrorParamDbg SysPushErrorParam
|
||||||
#define SysPushErrorCryptoDbg SysPushErrorCrypto
|
#define SysPushErrorLogicErrorDbg SysPushErrorLogicError
|
||||||
#define SysPushErrorParamDbg SysPushErrorParam
|
#define SysPushErrorMathErrorDbg SysPushErrorMathError
|
||||||
#define SysPushErrorLogicErrorDbg SysPushErrorLogicError
|
#define SysPushErrorUnavailableErrorDbg SysPushErrorUnavailableError
|
||||||
#define SysPushErrorMathErrorDbg SysPushErrorMathError
|
#define SysPushErrorTimeoutErrorDbg SysPushErrorTimeoutError
|
||||||
#define SysPushErrorUnavailableErrorDbg SysPushErrorUnavailableError
|
#define SysPushErrorWatchdogErrorDbg SysPushErrorWatchdogError
|
||||||
#define SysPushErrorTimeoutErrorDbg SysPushErrorTimeoutError
|
#define SysPushErrorServiceErrorDbg SysPushErrorServiceError
|
||||||
#define SysPushErrorWatchdogErrorDbg SysPushErrorWatchdogError
|
#define SysPushErrorPermissionErrorDbg SysPushErrorPermissionError
|
||||||
#define SysPushErrorServiceErrorDbg SysPushErrorServiceError
|
#define SysPushErrorOutOfRangeDbg SysPushErrorOutOfRange
|
||||||
#define SysPushErrorPermissionErrorDbg SysPushErrorPermissionError
|
#define SysPushErrorSyntaxErrorDbg SysPushErrorSyntaxError
|
||||||
#define SysPushErrorOutOfRangeDbg SysPushErrorOutOfRange
|
#define SysPushErrorDisconnectedDbg SysPushErrorDisconnected
|
||||||
#define SysPushErrorSyntaxErrorDbg SysPushErrorSyntaxError
|
#define SysPushErrorUninitializedDbg SysPushErrorUninitialized
|
||||||
#define SysPushErrorDisconnectedDbg SysPushErrorDisconnected
|
#define SysPushErrorUnimplementedDbg SysPushErrorUnimplemented
|
||||||
#define SysPushErrorUninitializedDbg SysPushErrorUninitialized
|
#define SysPushErrorCatchDbg SysPushErrorCatch
|
||||||
#define SysPushErrorUnimplementedDbg SysPushErrorUnimplemented
|
#define SysPushErrorSubmissionDbg SysPushErrorSubmission
|
||||||
#define SysPushErrorCatchDbg SysPushErrorCatch
|
#define SysPushErrorLockErrorDbg SysPushErrorLockError
|
||||||
#define SysPushErrorSubmissionDbg SysPushErrorSubmission
|
#define SysPushErrorSyntaxDbg SysPushErrorSyntax
|
||||||
#define SysPushErrorLockErrorDbg SysPushErrorLockError
|
#define SysPushErrorNoAccessDbg SysPushErrorNoAccess
|
||||||
#define SysPushErrorSyntaxDbg SysPushErrorSyntax
|
#define SysPushErrorResourceMissingDbg SysPushErrorResourceMissing
|
||||||
#define SysPushErrorNoAccessDbg SysPushErrorNoAccess
|
#define SysPushErrorResourceLockedDbg SysPushErrorResourceLocked
|
||||||
#define SysPushErrorResourceMissingDbg SysPushErrorResourceMissing
|
#define SysPushErrorMalformedDataDbg SysPushErrorMalformedData
|
||||||
#define SysPushErrorResourceLockedDbg SysPushErrorResourceLocked
|
#define SysPushErrorInSandboxContextDbg SysPushErrorInSandboxContext
|
||||||
#define SysPushErrorMalformedDataDbg SysPushErrorMalformedData
|
#define SysPushErrorParseErrorDbg SysPushErrorParseError
|
||||||
#define SysPushErrorInSandboxContextDbg SysPushErrorInSandboxContext
|
#define SysPushErrorResourceExistsDbg SysPushErrorResourceExists
|
||||||
#define SysPushErrorParseErrorDbg SysPushErrorParseError
|
#define SysPushErrorResourceInvalidDbg SysPushErrorResourceInvalid
|
||||||
|
#define SysPushErrorFeatureMissingDbg SysPushErrorFeatureMissing
|
||||||
|
#define SysPushErrorFeatureOutOfDateDbg SysPushErrorFeatureOutOfDate
|
||||||
|
#define SysPushErrorIOResourceFailureDbg SysPushErrorIOResourceFailure
|
||||||
|
#define SysPushErrorIOResourceRejectedDbg SysPushErrorIOResourceRejected
|
||||||
|
#define SysPushErrorIOResourceOverflowDbg SysPushErrorIOResourceOverflow
|
||||||
|
#define SysPushErrorIOResourceDisconnectedDbg SysPushErrorIOResourceDisconnected
|
||||||
|
#define SysPushErrorIOResourceNoDataDbg SysPushErrorIOResourceNoData
|
||||||
|
#define SysPushErrorIOResourceWouldBlockDbg SysPushErrorIOResourceWouldBlock
|
||||||
|
#define SysPushErrorInvalidPathDbg SysPushErrorInvalidPath
|
||||||
|
#define SysPushErrorInvalidHandleDbg SysPushErrorInvalidHandle
|
||||||
|
#define SysPushErrorInvalidFdDbg SysPushErrorInvalidFd
|
||||||
|
#define SysPushErrorInvalidContextDbg SysPushErrorInvalidContext
|
||||||
|
#define SysPushErrorUnreachableDbg SysPushErrorUnreachable
|
||||||
|
#define SysPushErrorOutOfBoundsDbg SysPushErrorOutOfBounds
|
||||||
|
#define SysPushErrorUnderflowDbg SysPushErrorUnderflow
|
||||||
|
#define SysPushErrorOverflowDbg SysPushErrorOverflow
|
||||||
|
#define SysPushErrorOutOfSpaceDbg SysPushErrorOutOfSpace
|
||||||
|
#define SysPushErrorOutOfSpaceDiskDbg SysPushErrorOutOfSpaceDisk
|
||||||
|
#define SysPushErrorOutOfSpaceMemoryDbg SysPushErrorOutOfSpaceMemory
|
||||||
|
#define SysPushErrorWorkerUnavailableDbg SysPushErrorWorkerUnavailable
|
||||||
|
#define SysPushErrorIOBlockReadErrorDbg SysPushErrorIOBlockReadError
|
||||||
|
#define SysPushErrorIOWriteReadErrorDbg SysPushErrorIOWriteReadError
|
||||||
|
#define SysPushErrorSystemErrorDbg SysPushErrorSystemError
|
||||||
|
#define SysPushErrorSystemFileSystemErrorDbg SysPushErrorSystemFileSystemError
|
||||||
|
#define SysPushErrorSystemBIOSErrorDbg SysPushErrorSystemBIOSError
|
||||||
|
#define SysPushErrorSystemInputErrorDbg SysPushErrorSystemInputError
|
||||||
|
#define SysPushErrorSystemDeviceErrorDbg SysPushErrorSystemDeviceError
|
||||||
|
#define SysPushErrorSystemFirmwareErrorDbg SysPushErrorSystemFirmwareError
|
||||||
|
#define SysPushErrorConcurrentRejectedDbg SysPushErrorConcurrentRejected
|
||||||
|
#define SysPushErrorConcurrentAbortedDbg SysPushErrorConcurrentAborted
|
||||||
|
#define SysPushErrorConcurrentWrongThreadDbg SysPushErrorConcurrentWrongThread
|
||||||
|
#define SysPushErrorConcurrentDeadlockDbg SysPushErrorConcurrentDeadlock
|
||||||
|
#define SysPushErrorVersionMismatchDbg SysPushErrorVersionMismatch
|
||||||
|
#define SysPushErrorHashMismatchDbg SysPushErrorHashMismatch
|
||||||
|
#define SysPushErrorCryptographicVerificationFailureDbg SysPushErrorCryptographicVerificationFailure
|
||||||
|
#define SysPushErrorInvalidArgPos1Dbg SysPushErrorInvalidArgPos1
|
||||||
|
#define SysPushErrorInvalidArgPos2Dbg SysPushErrorInvalidArgPos2
|
||||||
|
#define SysPushErrorInvalidArgPos3Dbg SysPushErrorInvalidArgPos3
|
||||||
|
#define SysPushErrorInvalidArgPos4Dbg SysPushErrorInvalidArgPos4
|
||||||
|
#define SysPushErrorInvalidArgPos5Dbg SysPushErrorInvalidArgPos5
|
||||||
|
#define SysPushErrorInvalidArgPos6Dbg SysPushErrorInvalidArgPos6
|
||||||
|
#define SysPushErrorInvalidArgPos7Dbg SysPushErrorInvalidArgPos7
|
||||||
|
#define SysPushErrorInvalidArgPos8Dbg SysPushErrorInvalidArgPos8
|
||||||
|
#define SysPushErrorInvalidArgPos9Dbg SysPushErrorInvalidArgPos9
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define SysPushUserErrorDbg(...)
|
#define SysPushUserErrorDbg(...)
|
||||||
@ -247,6 +370,51 @@ namespace Aurora::Debug
|
|||||||
#define SysPushErrorMalformedDataDbg(...)
|
#define SysPushErrorMalformedDataDbg(...)
|
||||||
#define SysPushErrorInSandboxContextDbg(...)
|
#define SysPushErrorInSandboxContextDbg(...)
|
||||||
#define SysPushErrorParseErrorDbg(...)
|
#define SysPushErrorParseErrorDbg(...)
|
||||||
|
#define SysPushErrorResourceExistsDbg(...)
|
||||||
|
#define SysPushErrorResourceInvalidDbg(...)
|
||||||
|
#define SysPushErrorFeatureMissingDbg(...)
|
||||||
|
#define SysPushErrorFeatureOutOfDateDbg(...)
|
||||||
|
#define SysPushErrorIOResourceFailureDbg(...)
|
||||||
|
#define SysPushErrorIOResourceRejectedDbg(...)
|
||||||
|
#define SysPushErrorIOResourceOverflowDbg(...)
|
||||||
|
#define SysPushErrorIOResourceDisconnectedDbg(...)
|
||||||
|
#define SysPushErrorIOResourceNoDataDbg(...)
|
||||||
|
#define SysPushErrorIOResourceWouldBlockDbg(...)
|
||||||
|
#define SysPushErrorInvalidPathDbg(...)
|
||||||
|
#define SysPushErrorInvalidHandleDbg(...)
|
||||||
|
#define SysPushErrorInvalidFdDbg(...)
|
||||||
|
#define SysPushErrorInvalidContextDbg(...)
|
||||||
|
#define SysPushErrorUnreachableDbg(...)
|
||||||
|
#define SysPushErrorOutOfBoundsDbg(...)
|
||||||
|
#define SysPushErrorUnderflowDbg(...)
|
||||||
|
#define SysPushErrorOverflowDbg(...)
|
||||||
|
#define SysPushErrorOutOfSpaceDbg(...)
|
||||||
|
#define SysPushErrorOutOfSpaceDiskDbg(...)
|
||||||
|
#define SysPushErrorOutOfSpaceMemoryDbg(...)
|
||||||
|
#define SysPushErrorWorkerUnavailableDbg(...)
|
||||||
|
#define SysPushErrorIOBlockReadErrorDbg(...)
|
||||||
|
#define SysPushErrorIOWriteReadErrorDbg(...)
|
||||||
|
#define SysPushErrorSystemErrorDbg(...)
|
||||||
|
#define SysPushErrorSystemFileSystemErrorDbg(...)
|
||||||
|
#define SysPushErrorSystemBIOSErrorDbg(...)
|
||||||
|
#define SysPushErrorSystemInputErrorDbg(...)
|
||||||
|
#define SysPushErrorSystemDeviceErrorDbg(...)
|
||||||
|
#define SysPushErrorSystemFirmwareErrorDbg(...)
|
||||||
|
#define SysPushErrorConcurrentRejectedDbg(...)
|
||||||
|
#define SysPushErrorConcurrentAbortedDbg(...)
|
||||||
|
#define SysPushErrorConcurrentWrongThreadDbg(...)
|
||||||
|
#define SysPushErrorConcurrentDeadlockDbg(...)
|
||||||
|
#define SysPushErrorVersionMismatchDbg(...)
|
||||||
|
#define SysPushErrorHashMismatchDbg(...)
|
||||||
|
#define SysPushErrorCryptographicVerificationFailDbg(...)
|
||||||
|
#define SysPushErrorInvalidArgPos1Dbg(...)
|
||||||
|
#define SysPushErrorInvalidArgPos2Dbg(...)
|
||||||
|
#define SysPushErrorInvalidArgPos3Dbg(...)
|
||||||
|
#define SysPushErrorInvalidArgPos4Dbg(...)
|
||||||
|
#define SysPushErrorInvalidArgPos5Dbg(...)
|
||||||
|
#define SysPushErrorInvalidArgPos6Dbg(...)
|
||||||
|
#define SysPushErrorInvalidArgPos7Dbg(...)
|
||||||
|
#define SysPushErrorInvalidArgPos8Dbg(...)
|
||||||
|
#define SysPushErrorInvalidArgPos9Dbg(...)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,7 @@ namespace Aurora::IO
|
|||||||
virtual bool End() = 0;
|
virtual bool End() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief time from the au epoch. see: AuTime::.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual AuInt64 GetStartTickMS() = 0;
|
virtual AuInt64 GetStartTickMS() = 0;
|
||||||
@ -36,7 +36,7 @@ namespace Aurora::IO
|
|||||||
virtual AuInt64 GetLastTickMS() = 0;
|
virtual AuInt64 GetLastTickMS() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief time from the au epoch. see: AuTime::.
|
* @brief quick approximation of normalized bytes / second
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual double GetPredictedThroughput() = 0;
|
virtual double GetPredictedThroughput() = 0;
|
||||||
|
@ -13,6 +13,7 @@ namespace Aurora::Memory
|
|||||||
{
|
{
|
||||||
virtual AuSPtr<Heap> AllocateDivision(AuUInt32 heap, AuUInt32 alignment = 32) = 0;
|
virtual AuSPtr<Heap> AllocateDivision(AuUInt32 heap, AuUInt32 alignment = 32) = 0;
|
||||||
virtual Types::size_t GetChunkSize(const void *head) = 0;
|
virtual Types::size_t GetChunkSize(const void *head) = 0;
|
||||||
|
virtual HeapStats &GetStats() = 0;
|
||||||
|
|
||||||
template<typename T = void *>
|
template<typename T = void *>
|
||||||
T ZAlloc(Types::size_t length)
|
T ZAlloc(Types::size_t length)
|
||||||
@ -87,6 +88,33 @@ namespace Aurora::Memory
|
|||||||
_Free(reinterpret_cast<void *>(in));
|
_Free(reinterpret_cast<void *>(in));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T, class ...Args>
|
||||||
|
AuSPtr<T> NewClass(T &ref, Args &&...args)
|
||||||
|
{
|
||||||
|
void * pPtr;
|
||||||
|
|
||||||
|
if constexpr (AuIsClass_v<T>)
|
||||||
|
{
|
||||||
|
pPtr = this->FAlloc<void *>(sizeof(T));
|
||||||
|
if (pPtr)
|
||||||
|
{
|
||||||
|
new (pPtr) T(AuForward<Args &&>(args)...);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pPtr = this->ZAlloc<void *>(sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pPtr)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return ToSmartPointer(pPtr, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
* @param in
|
* @param in
|
||||||
@ -99,7 +127,7 @@ namespace Aurora::Memory
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
AuSPtr<T> ToSmartPointer(T *in, bool pinThis = true)
|
AuSPtr<T> ToSmartPointer(T *in, bool pinThis)
|
||||||
{
|
{
|
||||||
if (in == nullptr) return {};
|
if (in == nullptr) return {};
|
||||||
auto heapHandle = pinThis ? GetSelfReference() : AuSPtr<Heap> {};
|
auto heapHandle = pinThis ? GetSelfReference() : AuSPtr<Heap> {};
|
||||||
@ -122,22 +150,28 @@ namespace Aurora::Memory
|
|||||||
return AuSPtr<T>(in,
|
return AuSPtr<T>(in,
|
||||||
[handle, ptr](T *delt)
|
[handle, ptr](T *delt)
|
||||||
{
|
{
|
||||||
ptr->Free(delt);
|
if constexpr (AuIsClass_v<T>)
|
||||||
|
{
|
||||||
|
delt->~T();
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr->Free(delt);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
virtual AuSPtr<Heap> GetSelfReference() = 0;
|
virtual AuSPtr<Heap> GetSelfReference() = 0; // may return empty/default. not all heaps are sharable.
|
||||||
virtual AU_ALLOC void *_ZAlloc(Types::size_t length) = 0;
|
|
||||||
virtual AU_ALLOC void *_ZAlloc(Types::size_t length, Types::size_t align) = 0;
|
virtual AU_ALLOC void *_ZAlloc(Types::size_t uLength) = 0;
|
||||||
virtual AU_ALLOC void *_FAlloc(Types::size_t length) = 0;
|
virtual AU_ALLOC void *_ZAlloc(Types::size_t uLength, Types::size_t align) = 0;
|
||||||
virtual AU_ALLOC void *_FAlloc(Types::size_t length, Types::size_t align) = 0;
|
virtual AU_ALLOC void *_FAlloc(Types::size_t uLength) = 0;
|
||||||
virtual AU_ALLOC void *_ZRealloc(void *buffer, Types::size_t length, Types::size_t align) = 0;
|
virtual AU_ALLOC void *_FAlloc(Types::size_t uLength, Types::size_t align) = 0;
|
||||||
virtual AU_ALLOC void *_ZRealloc(void *buffer, Types::size_t length) = 0;
|
virtual AU_ALLOC void *_ZRealloc(void *pBase, Types::size_t uLength, Types::size_t uAlign) = 0;
|
||||||
virtual AU_ALLOC void *_FRealloc(void *buffer, Types::size_t length, Types::size_t align) = 0;
|
virtual AU_ALLOC void *_ZRealloc(void *pBase, Types::size_t uLength) = 0;
|
||||||
virtual AU_ALLOC void *_FRealloc(void *buffer, Types::size_t length) = 0;
|
virtual AU_ALLOC void *_FRealloc(void *pBase, Types::size_t uLength, Types::size_t uAlign) = 0;
|
||||||
virtual void _Free(void* buffer) = 0;
|
virtual AU_ALLOC void *_FRealloc(void *pBase, Types::size_t uLength) = 0;
|
||||||
|
virtual void _Free(void* pBase) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,7 +187,9 @@ namespace Aurora::Memory
|
|||||||
|
|
||||||
@return a heap backed by allocated memory
|
@return a heap backed by allocated memory
|
||||||
*/
|
*/
|
||||||
AUKN_SHARED_API(AllocHeap, Heap, AuUInt size);
|
AUKN_SHARED_API(AllocHeap, Heap, AuUInt uLength);
|
||||||
|
|
||||||
AUKN_SHARED_API(RequestHeapOfRegion, Heap, void *ptr, AuUInt size);
|
AUKN_SHARED_API(RequestHeapOfRegion, Heap, void *pPtr, AuUInt uLength);
|
||||||
|
|
||||||
|
AUKN_SHARED_API(AllocHeapMimalloc, Heap, AuUInt uLength);
|
||||||
}
|
}
|
||||||
|
24
Include/Aurora/Memory/HeapStats.hpp
Normal file
24
Include/Aurora/Memory/HeapStats.hpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/***
|
||||||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||||
|
|
||||||
|
File: HeapStats.hpp
|
||||||
|
Date: 2022-12-07
|
||||||
|
Author: Reece
|
||||||
|
***/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Aurora::Memory
|
||||||
|
{
|
||||||
|
struct HeapStats
|
||||||
|
{
|
||||||
|
AuUInt64 qwBytesAllocatedLifeSpan {};
|
||||||
|
AuUInt64 qwBytesFreeLifeSpan {};
|
||||||
|
|
||||||
|
AuUInt uBytesCapacity {};
|
||||||
|
|
||||||
|
AuUInt uBytesLiveCounter {};
|
||||||
|
AuUInt uBytesPeakCounter {};
|
||||||
|
|
||||||
|
bool bIsSharedWithOtherHeaps {};
|
||||||
|
};
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
#include <Aurora/Data/Data.hpp>
|
#include <Aurora/Data/Data.hpp>
|
||||||
|
|
||||||
#include "MemRef.hpp"
|
#include "MemRef.hpp"
|
||||||
|
#include "HeapStats.hpp"
|
||||||
#include "Heap.hpp"
|
#include "Heap.hpp"
|
||||||
#include "MemoryView.hpp"
|
#include "MemoryView.hpp"
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ namespace Aurora::Utility
|
|||||||
{
|
{
|
||||||
// call me arbitrarily
|
// call me arbitrarily
|
||||||
double inline OnUpdate(AuUInt uUnit)
|
double inline OnUpdate(AuUInt uUnit)
|
||||||
{
|
{
|
||||||
|
OnTick();
|
||||||
this->uTotal += uUnit;
|
this->uTotal += uUnit;
|
||||||
this->uTotalLifetime += uUnit;
|
this->uTotalLifetime += uUnit;
|
||||||
OnTick();
|
|
||||||
return this->dCurFreq;
|
return this->dCurFreq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,18 +56,20 @@ namespace Aurora::Compression
|
|||||||
|
|
||||||
auto startingSize = out.size();
|
auto startingSize = out.size();
|
||||||
|
|
||||||
if (!AuTryResize(out, startingSize + inflatedLength))
|
auto view = out.GetOrAllocateLinearWriteable(inflatedLength);
|
||||||
|
if (!view)
|
||||||
{
|
{
|
||||||
|
SysPushErrorMemory();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ret = ZSTD_decompress(&out[startingSize], inflatedLength, source.ptr, source.length);
|
auto ret = ZSTD_decompress(view.ptr, inflatedLength, source.ptr, source.length);
|
||||||
if (ZSTD_isError(ret))
|
if (ZSTD_isError(ret))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
out.resize(startingSize + ret);
|
out.writePtr = (AuUInt8 *)view.ptr + ret;
|
||||||
|
|
||||||
read += AuUInt32(deflatedLength);
|
read += AuUInt32(deflatedLength);
|
||||||
}
|
}
|
||||||
|
@ -301,12 +301,21 @@ namespace Aurora::Debug
|
|||||||
Telemetry::EndBlock();
|
Telemetry::EndBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// compile me somewhere without public headers for compat if i care for some reason later (i probably wont)
|
||||||
|
AUKN_SYM void _PushError(AuUInt address, EFailureCategory category, const char *msg, AuUInt16 uLine);
|
||||||
AUKN_SYM void _PushError(AuUInt address, EFailureCategory category, const char *msg)
|
AUKN_SYM void _PushError(AuUInt address, EFailureCategory category, const char *msg)
|
||||||
|
{
|
||||||
|
_PushError(address, category, msg, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
AUKN_SYM void _PushError(AuUInt address, EFailureCategory category, const char *msg, AuUInt16 uLine)
|
||||||
{
|
{
|
||||||
LastError error {address, category, msg};
|
LastError error {address, category, msg};
|
||||||
|
|
||||||
// Oi, developer
|
// Oi, developer
|
||||||
#if defined(DEBUG)
|
#if defined(AU_CFG_ID_DEBUG)
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -317,6 +326,7 @@ namespace Aurora::Debug
|
|||||||
if (ShouldPushErrorStackInternal())
|
if (ShouldPushErrorStackInternal())
|
||||||
{
|
{
|
||||||
auto pMessage = AuMakeSharedThrow<ThreadMessage>();
|
auto pMessage = AuMakeSharedThrow<ThreadMessage>();
|
||||||
|
pMessage->uDebugBuildSourceLineHint = uLine;
|
||||||
pMessage->pStringMessage = AuMakeSharedThrow<AuString>(msg);
|
pMessage->pStringMessage = AuMakeSharedThrow<AuString>(msg);
|
||||||
pMessage->eFailureCategory = category;
|
pMessage->eFailureCategory = category;
|
||||||
PushErrorStackInternal(pMessage);
|
PushErrorStackInternal(pMessage);
|
||||||
@ -356,7 +366,7 @@ namespace Aurora::Debug
|
|||||||
PrintError();
|
PrintError();
|
||||||
|
|
||||||
// Is anyone listening?
|
// Is anyone listening?
|
||||||
AuLogWarn("ERROR: {}", error.dbg);
|
AuLogWarn("ERROR: {}", error.pDbgMessage);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,10 @@ namespace Aurora::Debug
|
|||||||
{
|
{
|
||||||
struct LastError
|
struct LastError
|
||||||
{
|
{
|
||||||
AuUInt address;
|
AuUInt uAddress;
|
||||||
EFailureCategory category;
|
EFailureCategory category;
|
||||||
const char *dbg;
|
const char *pDbgMessage;
|
||||||
|
AuUInt16 uLine;
|
||||||
};
|
};
|
||||||
|
|
||||||
AuUInt32 GetOSErrorFence();
|
AuUInt32 GetOSErrorFence();
|
||||||
|
@ -9,10 +9,11 @@
|
|||||||
#include "Memory.hpp"
|
#include "Memory.hpp"
|
||||||
#include "DefaultHeap.hpp"
|
#include "DefaultHeap.hpp"
|
||||||
#include "Heap.hpp"
|
#include "Heap.hpp"
|
||||||
|
#include <Source/Debug/MemoryCrunch.hpp>
|
||||||
|
|
||||||
namespace Aurora::Memory
|
namespace Aurora::Memory
|
||||||
{
|
{
|
||||||
struct DefaultHeap : Heap
|
struct DefaultHeap : BaseHeap
|
||||||
{
|
{
|
||||||
AuSPtr<Heap> AllocateDivision(AuUInt32 heap, AuUInt32 alignment) override
|
AuSPtr<Heap> AllocateDivision(AuUInt32 heap, AuUInt32 alignment) override
|
||||||
{
|
{
|
||||||
@ -73,6 +74,20 @@ namespace Aurora::Memory
|
|||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateStats() override
|
||||||
|
{
|
||||||
|
auto other = AuDebug::gReserveHeap->GetStats();
|
||||||
|
|
||||||
|
this->stats.bIsSharedWithOtherHeaps = true;
|
||||||
|
this->stats.uBytesLiveCounter = gBytesCounterAllocated + other.uBytesLiveCounter;
|
||||||
|
this->stats.uBytesPeakCounter = AuMax(gBytesCounterPeak, other.uBytesPeakCounter);
|
||||||
|
|
||||||
|
if (!this->stats.uBytesCapacity)
|
||||||
|
{
|
||||||
|
this->stats.uBytesCapacity = Aurora::HWInfo::GetMemStatSystem /*should be process, but process is this with extra steps.*/().value_or(AuHwInfo::RamStat { }).qwAvailable;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static DefaultHeap gDefaultAllocation;
|
static DefaultHeap gDefaultAllocation;
|
||||||
|
@ -95,6 +95,8 @@ namespace Aurora::Memory
|
|||||||
void DecrementUsers();
|
void DecrementUsers();
|
||||||
void RequestTermination();
|
void RequestTermination();
|
||||||
|
|
||||||
|
void UpdateStats() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
AuThreadPrimitives::MutexUnique_t mutex_;
|
AuThreadPrimitives::MutexUnique_t mutex_;
|
||||||
@ -352,6 +354,15 @@ namespace Aurora::Memory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InternalHeap::UpdateStats()
|
||||||
|
{
|
||||||
|
auto pDiag = o1heapGetDiagnostics(this->heap_);
|
||||||
|
|
||||||
|
this->stats.uBytesLiveCounter = pDiag.allocated;
|
||||||
|
this->stats.uBytesCapacity = pDiag.capacity;
|
||||||
|
this->stats.uBytesPeakCounter = pDiag.peak_allocated;
|
||||||
|
}
|
||||||
|
|
||||||
AuSPtr<Heap> InternalHeap::GetSelfReference()
|
AuSPtr<Heap> InternalHeap::GetSelfReference()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -13,6 +13,15 @@ namespace Aurora::Memory
|
|||||||
{
|
{
|
||||||
void *base_ {};
|
void *base_ {};
|
||||||
AuUInt length_ {};
|
AuUInt length_ {};
|
||||||
|
HeapStats stats;
|
||||||
|
|
||||||
|
virtual void UpdateStats() = 0;
|
||||||
|
|
||||||
|
inline HeapStats &GetStats() override
|
||||||
|
{
|
||||||
|
UpdateStats();
|
||||||
|
return stats;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AuSPtr<Heap> AllocateDivisionGlobal(Heap *heap, AuUInt32 length, AuUInt32 alignment);
|
AuSPtr<Heap> AllocateDivisionGlobal(Heap *heap, AuUInt32 length, AuUInt32 alignment);
|
||||||
|
@ -18,6 +18,19 @@
|
|||||||
|
|
||||||
namespace Aurora::Memory
|
namespace Aurora::Memory
|
||||||
{
|
{
|
||||||
|
AuUInt gBytesCounterAllocated {};
|
||||||
|
AuUInt gBytesCounterPeak {};
|
||||||
|
|
||||||
|
static void AddBytesToCounter(AuUInt uBytes)
|
||||||
|
{
|
||||||
|
gBytesCounterPeak = AuMax(gBytesCounterPeak, AuAtomicAdd(&gBytesCounterAllocated, uBytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void RemoveBytesFromCounter(AuUInt uBytes)
|
||||||
|
{
|
||||||
|
AuAtomicSub(&gBytesCounterAllocated, uBytes);
|
||||||
|
}
|
||||||
|
|
||||||
AUKN_SYM AuUInt GetChunkSize(const void *head)
|
AUKN_SYM AuUInt GetChunkSize(const void *head)
|
||||||
{
|
{
|
||||||
if (AuDebug::IsPointerReserveRange((void *)head))
|
if (AuDebug::IsPointerReserveRange((void *)head))
|
||||||
@ -52,6 +65,10 @@ namespace Aurora::Memory
|
|||||||
SysPanic(string); \
|
SysPanic(string); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
AddBytesToCounter(::mi_malloc_size(pRet)); \
|
||||||
|
} \
|
||||||
return pRet;
|
return pRet;
|
||||||
|
|
||||||
AUKN_SYM void *_ZAlloc(Types::size_t length)
|
AUKN_SYM void *_ZAlloc(Types::size_t length)
|
||||||
@ -82,7 +99,9 @@ namespace Aurora::Memory
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RemoveBytesFromCounter(::mi_malloc_size(buffer));
|
||||||
auto pRet = ::mi_rezalloc_aligned(buffer, length, align);
|
auto pRet = ::mi_rezalloc_aligned(buffer, length, align);
|
||||||
|
AddBytesToCounter(::mi_malloc_size(pRet));
|
||||||
if (!pRet)
|
if (!pRet)
|
||||||
{
|
{
|
||||||
if (gRuntimeConfig.debug.bIsMemoryErrorFatal)
|
if (gRuntimeConfig.debug.bIsMemoryErrorFatal)
|
||||||
@ -103,7 +122,9 @@ namespace Aurora::Memory
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RemoveBytesFromCounter(::mi_malloc_size(buffer));
|
||||||
auto pRet = ::mi_rezalloc(buffer, length);
|
auto pRet = ::mi_rezalloc(buffer, length);
|
||||||
|
AddBytesToCounter(::mi_malloc_size(pRet));
|
||||||
if (!pRet)
|
if (!pRet)
|
||||||
{
|
{
|
||||||
if (gRuntimeConfig.debug.bIsMemoryErrorFatal)
|
if (gRuntimeConfig.debug.bIsMemoryErrorFatal)
|
||||||
@ -124,7 +145,9 @@ namespace Aurora::Memory
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RemoveBytesFromCounter(::mi_malloc_size(buffer));
|
||||||
auto pRet = ::mi_realloc_aligned(buffer, length, align);
|
auto pRet = ::mi_realloc_aligned(buffer, length, align);
|
||||||
|
AddBytesToCounter(::mi_malloc_size(pRet));
|
||||||
if (!pRet)
|
if (!pRet)
|
||||||
{
|
{
|
||||||
if (gRuntimeConfig.debug.bIsMemoryErrorFatal)
|
if (gRuntimeConfig.debug.bIsMemoryErrorFatal)
|
||||||
@ -145,7 +168,9 @@ namespace Aurora::Memory
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RemoveBytesFromCounter(::mi_malloc_size(buffer));
|
||||||
auto pRet = ::mi_realloc(buffer, length);
|
auto pRet = ::mi_realloc(buffer, length);
|
||||||
|
AddBytesToCounter(::mi_malloc_size(pRet));
|
||||||
if (!pRet)
|
if (!pRet)
|
||||||
{
|
{
|
||||||
if (gRuntimeConfig.debug.bIsMemoryErrorFatal)
|
if (gRuntimeConfig.debug.bIsMemoryErrorFatal)
|
||||||
@ -158,15 +183,16 @@ namespace Aurora::Memory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AUKN_SYM void _Free(void *buffer)
|
AUKN_SYM void _Free(void *pHead)
|
||||||
{
|
{
|
||||||
if (AuDebug::IsPointerReserveRange(buffer))
|
if (AuDebug::IsPointerReserveRange(pHead))
|
||||||
{
|
{
|
||||||
AuDebug::gReserveHeap->Free(buffer);
|
AuDebug::gReserveHeap->Free(pHead);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::mi_free(buffer);
|
RemoveBytesFromCounter(::mi_malloc_size(pHead));
|
||||||
|
::mi_free(pHead);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,5 +9,6 @@
|
|||||||
|
|
||||||
namespace Aurora::Memory
|
namespace Aurora::Memory
|
||||||
{
|
{
|
||||||
|
extern AuUInt gBytesCounterAllocated;
|
||||||
|
extern AuUInt gBytesCounterPeak;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user