28# if defined(HAVE_EXECINFO_H)
31# include <sys/resource.h>
41#if defined(__x86_64__) || defined(_M_X64)
44#elif defined(__GNUC__) && defined(i386)
53 return (d & 0x04000000) != 0;
54#elif (defined(_MSC_VER) && defined(_M_IX86))
65 return (d & 0x04000000) != 0;
77# if defined(HAVE_EXECINFO_H)
93 nptrs = backtrace(buffer,
SIZE);
94 strings = backtrace_symbols(buffer, nptrs);
95 for (i = 0; i < nptrs; i++) {
96 fputs(strings[i], fp);
115 std::scoped_lock
lock(mutex);
121#if !defined(_WIN32) || defined(FREE_WINDOWS)
128# if defined(__x86_64__)
129 asm(
"cpuid" :
"=a"(
data[0]),
"=b"(
data[1]),
"=c"(
data[2]),
"=d"(
data[3]) :
"a"(selector));
130# elif defined(__i386__)
131 asm(
"pushl %%ebx \n\t"
133 "movl %%ebx, %1 \n\t"
147#if !defined(_M_ARM64)
151 if (
result[0] >=
int(0x80000004)) {
152 __cpuid(
reinterpret_cast<int *
>(buf + 0), 0x80000002);
153 __cpuid(
reinterpret_cast<int *
>(buf + 16), 0x80000003);
154 __cpuid(
reinterpret_cast<int *
>(buf + 32), 0x80000004);
161 DWORD processorNameStringLength = 255;
162 char processorNameString[255];
163 if (RegGetValueA(HKEY_LOCAL_MACHINE,
164 "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
165 "ProcessorNameString",
168 &processorNameString,
169 &processorNameStringLength) == ERROR_SUCCESS)
179#if !defined(_M_ARM64)
186 return (
result[2] & (
int(1) << 20)) != 0;
195 if (gethostname(buffer, buffer_maxncpy - 1) < 0) {
199 buffer[buffer_maxncpy - 1] =
'\0';
201 DWORD buffer_size_in_out = buffer_maxncpy;
202 if (!GetComputerName(buffer, &buffer_size_in_out)) {
213 const size_t limit_bytes_half = size_t(1) << (
sizeof(
size_t[8]) - 1);
215 return (limit_bytes_half >> 20) * 2;
228 constexpr int max_open_files = 8192;
232 if (_getmaxstdio() < max_open_files) {
233 ok = _setmaxstdio(max_open_files) == max_open_files;
237 ok = getrlimit(RLIMIT_NOFILE, &limit) == 0;
238 if (ok && limit.rlim_cur < rlim_t(max_open_files)) {
239 limit.rlim_cur = std::min(rlim_t(max_open_files), limit.rlim_max);
240 ok = setrlimit(RLIMIT_NOFILE, &limit) == 0;
246 "Failed to ensure max open files is at least %d: %s",
Compatibility-like things for windows.
#define CLOG_DEBUG(clg_ref,...)
void free(Subdiv *subdiv)
void BLI_hostname_get(char *buffer, size_t buffer_maxncpy)
void BLI_system_backtrace_with_os_info(FILE *fp, const void *os_info)
void BLI_system_max_open_files_ensure()
int BLI_cpu_support_sse2()
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
BMesh const char void * data
MINLINE size_t min_zz(size_t a, size_t b)
int BLI_cpu_support_sse42()
ATTR_WARN_UNUSED_RESULT const size_t num
int BLI_system_memory_max_in_megabytes_int()
void BLI_system_backtrace(FILE *fp)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
static void __cpuid(int data[4], int selector)
char * BLI_cpu_brand_string()
size_t BLI_system_memory_max_in_megabytes()