Merge remote-tracking branch 'refs/remotes/tpgc/main'
commit
57be387904
|
@ -18,9 +18,6 @@
|
|||
namespace blt::logging
|
||||
{
|
||||
|
||||
template<typename K, typename V>
|
||||
using hashmap = std::unordered_map<K, V>;
|
||||
|
||||
enum class log_level
|
||||
{
|
||||
// default
|
||||
|
@ -206,6 +203,7 @@ namespace blt::logging
|
|||
#include <thread>
|
||||
#include <cstdarg>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#if defined(CXX17_FILESYSTEM) || defined (CXX17_FILESYSTEM_LIBFS)
|
||||
#include <filesystem>
|
||||
#elif defined(CXX11_EXP_FILESYSTEM) || defined (CXX11_EXP_FILESYSTEM_LIBFS)
|
||||
|
@ -216,6 +214,9 @@ namespace blt::logging
|
|||
#include <ios>
|
||||
#include <fstream>
|
||||
|
||||
template<typename K, typename V>
|
||||
using hashmap = std::unordered_map<K, V>;
|
||||
|
||||
namespace blt::logging {
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,11 +7,15 @@
|
|||
#ifndef BLT_SYSTEM_H
|
||||
#define BLT_SYSTEM_H
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#ifdef _WIN32
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <x86intrin.h>
|
||||
#endif
|
||||
#else
|
||||
#include <chrono>
|
||||
#endif
|
||||
#include <cstdint>
|
||||
|
||||
namespace blt::system {
|
||||
|
@ -21,7 +25,11 @@ namespace blt::system {
|
|||
// #define GNU_INLINE
|
||||
//#endif
|
||||
inline std::uint64_t rdtsc(){
|
||||
#ifdef __EMSCRIPTEN__
|
||||
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||
#else
|
||||
return __rdtsc();
|
||||
#endif
|
||||
}
|
||||
// TODO: system memory and current CPU usage. (Linux Only currently)
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <blt/parse/argparse.h>
|
||||
#include <iostream>
|
||||
#include <blt/std/string.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace blt
|
||||
{
|
||||
|
@ -526,7 +527,7 @@ namespace blt
|
|||
{
|
||||
const auto& name = arg->a_flags.name;
|
||||
std::cout << name;
|
||||
auto size = std::max(static_cast<int64_t>(max_length) - static_cast<int64_t>(name.size()), 0l);
|
||||
auto size = std::max(static_cast<int64_t>(max_length) - static_cast<int64_t>(name.size()), static_cast<int64_t>(0));
|
||||
size += tab_size;
|
||||
for (int64_t i = 0; i < size; i++)
|
||||
std::cout << " ";
|
||||
|
@ -540,7 +541,7 @@ namespace blt
|
|||
{
|
||||
const auto& name = getFlagHelp(arg);
|
||||
std::cout << name;
|
||||
auto size = std::max(static_cast<int64_t>(max_length) - static_cast<int64_t>(name.size()), 0l);
|
||||
auto size = std::max(static_cast<int64_t>(max_length) - static_cast<int64_t>(name.size()), static_cast<int64_t>(0));
|
||||
size += tab_size;
|
||||
for (int64_t i = 0; i < size; i++)
|
||||
std::cout << " ";
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__EMSCRIPTEN__)
|
||||
|
||||
#include <execinfo.h>
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__EMSCRIPTEN__)
|
||||
#define BLT_STACK_TRACE(number) void* ptrs[number]; \
|
||||
int size = backtrace(ptrs, number); \
|
||||
char** messages = backtrace_symbols(ptrs, size);
|
||||
|
@ -41,7 +41,7 @@ namespace blt {
|
|||
|
||||
void b_throw(const char* what, const char* path, int line)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__EMSCRIPTEN__)
|
||||
BLT_STACK_TRACE(50);
|
||||
|
||||
BLT_ERROR("An exception '%s' has occurred in file '%s:%d'", what, path, line);
|
||||
|
@ -54,7 +54,7 @@ namespace blt {
|
|||
|
||||
void b_assert_failed(const char* expression, const char* path, int line)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__EMSCRIPTEN__)
|
||||
BLT_STACK_TRACE(50);
|
||||
|
||||
BLT_ERROR("The assertion '%s' has failed in file '%s:%d'", expression, path, line);
|
||||
|
@ -70,7 +70,7 @@ namespace blt {
|
|||
{
|
||||
if (messages == nullptr)
|
||||
return;
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__EMSCRIPTEN__)
|
||||
for (int i = 1; i < size; i++){
|
||||
int tabs = i - 1;
|
||||
std::string buffer;
|
||||
|
|
Loading…
Reference in New Issue