A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/ncbi__system_8cpp_source.html below:

NCBI C++ ToolKit: src/corelib/ncbi_system.cpp Source File

48 #define NCBI_USE_ERRCODE_X Corelib_System 50 #if defined(NCBI_OS_UNIX) 51 # include <sys/mman.h> 52 # if defined(NCBI_OS_SOLARIS) 56  extern int

madvise(caddr_t,

size_t

,

int

);

60 # include <sys/time.h> 61 # include <sys/resource.h> 62 # include <sys/times.h> 63 # include <sys/types.h> 69 # if defined(NCBI_OS_BSD) || defined(NCBI_OS_DARWIN) 70 # include <sys/sysctl.h> 72 # if defined(NCBI_OS_IRIX) 73 # include <sys/sysmp.h> 76 # if !defined(NCBI_OS_CYGWIN) 77 # define USE_SETLIMITS 78 # define USE_SETMEMLIMIT 79 # define USE_SETCPULIMIT 81 # define HAVE_MADVISE 1 84 #if defined(NCBI_OS_LINUX) 90 # include <mach/mach.h> 91 # include <mach/mach_host.h> 92 # include <mach/host_info.h> 96 #ifdef USE_SETCPULIMIT 103 # include <dbghelp.h> 114 #if defined(NCBI_COMPILER_MIPSPRO) 115 # define set_new_handler std::set_new_handler 117 # ifdef USE_SETLIMITS 144 #if !defined(CLK_TCK) && defined(CLOCKS_PER_SEC) 145 # define CLK_TCK CLOCKS_PER_SEC 160  ERR_POST_X

(1,

"Memory heap limit exceeded in allocating memory "

\

169  if

(times(&

buffer

) == (clock_t)(-1)) {

170  ERR_POST_X

(3,

"Error in getting CPU time consumed by program"

);

173

clock_t tick = sysconf(_SC_CLK_TCK);

175  if

(!tick || tick == (clock_t)(-1))

177  #elif defined(CLOCKS_PER_SEC) 178  if

(!tick || tick == (clock_t)(-1))

181  if

(tick == (clock_t)(-1))

184  buffer

.tms_utime/(tick ? tick : 1) << (tick ?

" sec"

:

" tick"

));

186  buffer

.tms_stime/(tick ? tick : 1) << (tick ?

" sec"

:

" tick"

));

188

(

buffer

.tms_stime +

buffer

.tms_utime)/(tick ? tick : 1) << (tick ?

" sec"

:

" tick"

));

267 #ifdef USE_SETMEMLIMIT 295

rl.rlim_cur = rl.rlim_max = max_size;

297

std::set_new_handler(

nullptr

);

298

rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;

300  if

(setrlimit(RLIMIT_DATA, &rl) != 0) {

304 # if !defined(NCBI_OS_SOLARIS) 305  if

(setrlimit(RLIMIT_AS, &rl) != 0) {

316

std::set_new_handler(

nullptr

);

333  if

(getrlimit(RLIMIT_DATA, &rl) != 0) {

338

rl.rlim_cur = max_size;

340

rl.rlim_cur = RLIM_INFINITY;

342  if

(setrlimit(RLIMIT_DATA, &rl) != 0) {

346 # if !defined(NCBI_OS_SOLARIS) 348  if

(getrlimit(RLIMIT_AS, &rlas) != 0) {

352

rl.rlim_max = rlas.rlim_max;

353  if

(setrlimit(RLIMIT_AS, &rl) != 0) {

363

std::set_new_handler(

nullptr

);

379  size_t

cur_soft_limit = 0;

381  if

(getrlimit(RLIMIT_DATA, &rl) != 0) {

386

rl.rlim_max = max_size;

387  if

(rl.rlim_cur > max_size) {

388

rl.rlim_cur = max_size;

390

cur_soft_limit = rl.rlim_cur;

392

rl.rlim_max = RLIM_INFINITY;

394  if

(setrlimit(RLIMIT_DATA, &rl) != 0) {

398 # if !defined(NCBI_OS_SOLARIS) 400  if

(getrlimit(RLIMIT_AS, &rlas) != 0) {

405

rlas.rlim_max = max_size;

408  if

(rlas.rlim_cur > cur_soft_limit) {

409

rlas.rlim_cur = cur_soft_limit;

413

cur_soft_limit = rlas.rlim_cur;

415

rlas.rlim_max = RLIM_INFINITY;

417  if

(setrlimit(RLIMIT_AS, &rlas) != 0) {

428

std::set_new_handler(

nullptr

);

438 # if !defined(NCBI_OS_SOLARIS) 439  if

(getrlimit(RLIMIT_AS, &rl) != 0) {

443  if

(rl.rlim_cur == RLIM_INFINITY) {

457 # if !defined(NCBI_OS_SOLARIS) 458  if

(getrlimit(RLIMIT_AS, &rl) != 0) {

462  if

(rl.rlim_max == RLIM_INFINITY) {

519 #ifdef USE_SETCPULIMIT 524  _VERIFY

(signal(SIGXCPU, SIG_IGN) != SIG_ERR);

535  unsigned int

terminate_delay_time,

546  if

( max_cpu_time ) {

547

rl.rlim_cur = max_cpu_time;

548

rl.rlim_max = max_cpu_time + terminate_delay_time;

550

rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;

552  if

(setrlimit(RLIMIT_CPU, &rl) != 0) {

567  unsigned int

terminate_delay_time,

588 #if defined(NCBI_OS_UNIX) 590 #elif defined(NCBI_OS_MSWIN) 600  static unsigned int

cpu = 0;

602 #if defined(NCBI_OS_MSWIN) 604

GetSystemInfo(&

si

);

605

cpu = (

unsigned int

)

si

.dwNumberOfProcessors;

608

host_basic_info_data_t hinfo;

609

mach_msg_type_number_t hinfo_count = HOST_BASIC_INFO_COUNT;

611

rc = host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hinfo, &hinfo_count);

612  if

(rc == KERN_SUCCESS) {

613

cpu = hinfo.avail_cpus;

616 #elif defined(NCBI_OS_UNIX) 618  #if defined(_SC_NPROC_ONLN) 619

x = sysconf(_SC_NPROC_ONLN);

620  #elif defined(_SC_NPROCESSORS_ONLN) 621

x = sysconf(_SC_NPROCESSORS_ONLN);

622  #elif defined(NCBI_OS_BSD) 624  size_t len

=

sizeof

(v);

625  int

mib[2] = { CTL_HW, HW_NCPU };

626  if

(sysctl(mib, 2, &v, &

len

,

NULL

, 0) == 0) {

630

cpu = (x <= 0 ? 1 : (

unsigned int

)x);

645 #if defined(NCBI_OS_MSWIN) 647

DWORD_PTR proc_mask = 0, sys_mask = 0;

648  if

(!::GetProcessAffinityMask(::GetCurrentProcess(), &proc_mask, &sys_mask)) {

652  for

(; proc_mask; proc_mask >>= 1) {

657 #elif defined(NCBI_OS_LINUX) 660  if

(total_cpus == 1) {

666

cpu_set_t* cpuset_ptr = CPU_ALLOC(total_cpus);

667  if

(cpuset_ptr ==

NULL

) {

670  size_t

cpuset_size = CPU_ALLOC_SIZE(total_cpus);

671

CPU_ZERO_S(cpuset_size, cpuset_ptr);

673  if

(sched_getaffinity(getpid(), cpuset_size, cpuset_ptr) != 0) {

674

CPU_FREE(cpuset_ptr);

677  int n

= CPU_COUNT_S(cpuset_size, cpuset_ptr);

678

CPU_FREE(cpuset_ptr);

679  return

(

n

< 0) ? 0 :

static_cast<unsigned int>

(

n

);

691 #if defined(NCBI_OS_MSWIN) 694 #elif defined(NCBI_OS_UNIX) && defined(CLOCK_UPTIME) 696  if

(clock_gettime(CLOCK_UPTIME, &ts) == 0) {

700 #elif defined(NCBI_OS_LINUX) 710 #elif defined(NCBI_OS_BSD) || defined(NCBI_OS_DAWRIN) 711  struct

timeval boottime;

712  size_t len

=

sizeof

(boottime);

713  int

mib[2] = { CTL_KERN, KERN_BOOTTIME };

714  if

(sysctl(mib, 2, &boottime, &

len

,

NULL

, 0) < 0) {

727  static

atomic<unsigned long> cached_value;

728  auto value

= cached_value.load(memory_order_relaxed);

733 #if defined(NCBI_OS_MSWIN) 735

GetSystemInfo(&

si

);

736  value

= (

unsigned

long)

si

.dwPageSize;

740  #if defined(HAVE_GETPAGESIZE) 742  #elif defined(_SC_PAGESIZE) 743

x = sysconf(_SC_PAGESIZE);

744  #elif defined(_SC_PAGE_SIZE) 745

x = sysconf(_SC_PAGE_SIZE);

756

cached_value.store(

value

, memory_order_relaxed);

763  static

atomic<unsigned long> cached_value;

764  auto value

= cached_value.load(memory_order_relaxed);

766 #if defined(NCBI_OS_MSWIN) 768

GetSystemInfo(&

si

);

769  value

= (

unsigned

long)

si

.dwAllocationGranularity;

773

cached_value.store(

value

, memory_order_relaxed);

781  static

atomic<Uint8> cached_value;

782  auto value

= cached_value.load(memory_order_relaxed);

787 #if defined(NCBI_OS_MSWIN) 789  st

.dwLength =

sizeof

(

st

);

790  if

( ::GlobalMemoryStatusEx(&

st

) ) {

794 #elif defined(NCBI_OS_UNIX) && defined(_SC_PHYS_PAGES) 795  unsigned long

num_pages = sysconf(_SC_PHYS_PAGES);

796  if

(

long

(num_pages) != -1L) {

800 #elif defined(NCBI_OS_BSD) || defined(NCBI_OS_DARWIN) 811  size_t len

=

sizeof

(physmem);

812  if

(sysctl(mib, 2, &physmem, &

len

,

NULL

, 0) == 0 &&

len

==

sizeof

(physmem)){

815  #if defined(NCBI_OS_DARWIN) 818  struct

vm_statistics vm_stat;

819

mach_port_t my_host = mach_host_self();

820

mach_msg_type_number_t

count

= HOST_VM_INFO_COUNT;

821  if

(host_statistics(my_host, HOST_VM_INFO,

822

(integer_t*) &vm_stat, &

count

) == KERN_SUCCESS) {

824

(

Uint8

(vm_stat.free_count) +

825  Uint8

(vm_stat.active_count) +

826  Uint8

(vm_stat.inactive_count) +

827  Uint8

(vm_stat.wire_count) );

832 #elif defined(NCBI_OS_IRIX) 834  if

(sysmp(MP_SAGET, MPSA_RMINFO, &rmi,

sizeof

(rmi)) >= 0) {

841

cached_value.store(

value

, memory_order_relaxed);

848 #if defined(NCBI_OS_MSWIN) 850  st

.dwLength =

sizeof

(

st

);

851  if

( ::GlobalMemoryStatusEx(&

st

) ) {

852  return st

.ullAvailPhys;

855 #elif defined(NCBI_OS_UNIX) && defined(_SC_AVPHYS_PAGES) 856  unsigned long

num_pages = sysconf(_SC_AVPHYS_PAGES);

857  if

(

long

(num_pages) != -1L) {

861 #elif (defined(NCBI_OS_BSD) || defined(NCBI_OS_DARWIN)) && defined(HW_USERMEM) 862  int

mib[2] = { CTL_HW, HW_USERMEM };

864  size_t len

=

sizeof

(mem);

865  if

(sysctl(mib, 2, &mem, &

len

,

NULL

, 0) == 0 &&

len

==

sizeof

(mem)){

868  #if defined(NCBI_OS_DARWIN) 871  struct

vm_statistics vm_stat;

872

mach_port_t my_host = mach_host_self();

873

mach_msg_type_number_t

count

= HOST_VM_INFO_COUNT;

874  if

(host_statistics(my_host, HOST_VM_INFO,

875

(integer_t*) &vm_stat, &

count

) == KERN_SUCCESS) {

881 #elif defined(NCBI_OS_IRIX) 883  if

(sysmp(MP_SAGET, MPSA_RMINFO, &rmi,

sizeof

(rmi)) >= 0) {

896 #if defined(NCBI_OS_MSWIN) 899 #elif defined(NCBI_OS_UNIX) 900  static

atomic<clock_t> cached_value;

901  auto value

= cached_value.load(memory_order_relaxed);

905

clock_t

t

= sysconf(_SC_CLK_TCK);

907  if

(!

t

||

t

== (clock_t)(-1))

t

= CLK_TCK;

908  #elif defined(CLOCKS_PER_SEC) 911  if

(

t

&&

t

!= (clock_t)(-1)) {

913

cached_value.store(

value

, memory_order_relaxed);

929  if

( !total ) { total = &scratch; }

930  if

( !resident ) { resident = &scratch; }

931  if

( !shared ) { shared = &scratch; }

933 #if defined(NCBI_OS_MSWIN) 937  DWORD

page_fault_count;

938

SIZE_T peak_working_set_size;

939

SIZE_T working_set_size;

940

SIZE_T quota_peak_paged_pool_usage;

941

SIZE_T quota_paged_pool_usage;

942

SIZE_T quota_peak_nonpaged_pool_usage;

943

SIZE_T quota_nonpaged_pool_usage;

944

SIZE_T pagefile_usage;

945

SIZE_T peak_pagefile_usage;

950  BOOL

(STDMETHODCALLTYPE

FAR

* dllGetProcessMemoryInfo)

952

dllGetProcessMemoryInfo = psapi_dll.

GetEntryPoint_Func

(

"GetProcessMemoryInfo"

, &dllGetProcessMemoryInfo);

953  if

(dllGetProcessMemoryInfo) {

955

dllGetProcessMemoryInfo(GetCurrentProcess(), counters,

sizeof

(counters));

956

*total = counters.quota_paged_pool_usage +

957

counters.quota_nonpaged_pool_usage;

958

*resident = counters.working_set_size;

966 #elif defined(NCBI_OS_LINUX) 970

statm >> *total >> *resident >> *shared;

972

*resident *= page_size;

973

*shared *= page_size;

977 #elif defined(NCBI_OS_SOLARIS) 980

*total = (size_t)

len

;

981

*resident = (size_t)

len

;

986 #elif defined(HAVE_GETRUSAGE) 987  #define _DIV0(a, b) ((a) / ((b) ? (b) : 1)) 990

memset(&ru,

'\0'

,

sizeof

(ru));

991  if

(getrusage(RUSAGE_SELF, &ru) == 0 && ru.ru_maxrss > 0) {

993

memset(&

t

,

'\0'

,

sizeof

(

t

));

994  if

(times(&

t

) != (clock_t)(-1)) {

995

clock_t ticks =

t

.tms_utime +

t

.tms_stime;

996

*resident = _DIV0(ru.ru_idrss, ticks);

997

*shared = _DIV0(ru.ru_ixrss, ticks);

998

*total = _DIV0(ru.ru_ixrss + ru.ru_idrss + ru.ru_isrss, ticks);

999  #ifdef NCBI_OS_DARWIN 1007  #if defined(NCBI_OS_DARWIN) 1008  #ifdef MACH_TASK_BASIC_INFO 1009

task_flavor_t flavor = MACH_TASK_BASIC_INFO;

1010  struct

mach_task_basic_info t_info;

1011

mach_msg_type_number_t t_info_count = MACH_TASK_BASIC_INFO_COUNT;

1013

task_flavor_t flavor = TASK_BASIC_INFO;

1014  struct

task_basic_info t_info;

1015

mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;

1017  if

(task_info(mach_task_self(), flavor, (task_info_t)&t_info, &t_info_count) == KERN_SUCCESS) {

1018

*total = *resident = t_info.resident_size;

1034 #if defined(NCBI_OS_MSWIN) 1036

FILETIME ft_creation, ft_exit, ft_kernel, ft_user;

1037  if

(!::GetProcessTimes(GetCurrentProcess(),

1038

&ft_creation, &ft_exit, &ft_kernel, &ft_user)) {

1041  if

( system_time ) {

1042

*system_time = (ft_kernel.dwLowDateTime +

1043

((

Uint8

) ft_kernel.dwHighDateTime << 32)) * 1.0e-7;

1046

*user_time = (ft_user.dwLowDateTime +

1047

((

Uint8

) ft_user.dwHighDateTime << 32)) * 1.0e-7;

1050 #elif defined(NCBI_OS_UNIX) 1053

clock_t

t

= times(&

buf

);

1054  if

(

t

== (clock_t)(-1) ) {

1057

clock_t tick = sysconf(_SC_CLK_TCK);

1058 #if defined(CLK_TCK) 1059  if

(!tick || tick == (clock_t)(-1))

1061 #elif defined(CLOCKS_PER_SEC) 1062  if

(!tick || tick == (clock_t)(-1))

1065  if

(tick == (clock_t)(-1)) {

1068  if

( system_time ) {

1069

*system_time = (double)

buf

.tms_stime / (

double

)tick;

1072

*user_time = (double)

buf

.tms_utime / (

double

)tick;

1084

rlim_t cur_limit = -1;

1085

rlim_t max_limit = -1;

1088  if

(getrlimit(RLIMIT_NOFILE, &rlim) == 0) {

1089

cur_limit = rlim.rlim_cur;

1090

max_limit = rlim.rlim_max;

1093

cur_limit =

static_cast<

rlim_t

>

(sysconf(_SC_OPEN_MAX));

1096

DIR* dir = opendir(

"/proc/self/fd/"

);

1098  while

(readdir(dir) !=

NULL

) {

1108  if

(cur_limit > 0) {

1109  int

max_fd =

static_cast<int>

(cur_limit);

1110  if

(cur_limit > INT_MAX) {

1113  for

(

int

fd = 0; fd < max_fd; ++fd) {

1114  if

(fcntl(fd, F_GETFD, 0) == -1) {

1115  if

(errno == EBADF) {

1127  if

(cur_limit > INT_MAX)

1128

*soft_limit = INT_MAX;

1130

*soft_limit =

static_cast<int>

(cur_limit);

1133  if

(max_limit > INT_MAX)

1134

*hard_limit = INT_MAX;

1136

*hard_limit =

static_cast<int>

(max_limit);

1154 #ifdef NCBI_OS_LINUX 1155  int

thread_count = 0;

1157

DIR* dir = opendir(

"/proc/self/task/"

);

1159  while

(readdir(dir) !=

NULL

)

1163  if

(thread_count <= 0)

1165  return

thread_count;

1180 #ifndef HAVE_MADVISE 1191  ERR_POST_X

(11,

"Memory address is not specified"

);

1198

adv = MADV_NORMAL;

break

;

1200

adv = MADV_RANDOM;

break

;

1202

adv = MADV_SEQUENTIAL;

break

;

1204

adv = MADV_WILLNEED;

break

;

1206

adv = MADV_DONTNEED;

break

;

1208  #if defined(MADV_DONTFORK) 1209

adv = MADV_DONTFORK;

1217  #if defined(MADV_DOFORK) 1226  #if defined(MADV_MERGEABLE) 1227

adv = MADV_MERGEABLE;

1235  #if defined(MADV_UNMERGEABLE) 1236

adv = MADV_UNMERGEABLE;

1248  if

( madvise((

char

*)

addr

,

len

, adv) != 0 ) {

1249  int

x_errno = errno; \

1250

ERR_POST_X(13,

"madvise() failed: "

<<

1268 #if defined(NCBI_OS_MSWIN) 1274

Sleep((mc_sec + (kMicroSecondsPerMilliSecond / 2)) / kMicroSecondsPerMilliSecond);

1276 #elif defined(NCBI_OS_UNIX) 1278 # if defined(HAVE_NANOSLEEP) 1279  struct

timespec delay, unslept;

1280

memset(&unslept, 0,

sizeof

(unslept));

1283  while

(nanosleep(&delay, &unslept) < 0) {

1288

memset(&unslept, 0,

sizeof

(unslept));

1290 # elif defined(HAVE_USLEEP) 1294  while

((sec = sleep(sec)) > 0) {

1308  struct

timeval delay;

1311  while

(select(0, (fd_set*) 0, (fd_set*) 0, (fd_set*) 0, &delay) < 0) {

1312 # ifdef SELECT_UPDATES_TIMEOUT 1325 #ifdef NCBI_OS_MSWIN 1345 #ifdef NCBI_OS_MSWIN 1355  wchar_t

dumpname[64],

tmp

[64];

1356

wcscat( wcscat( wcscpy(dumpname, L

"core."

), _ltow(GetCurrentProcessId(),

tmp

, 10)), L

".dmp"

);

1358  char

dumpname[64],

tmp

[64];

1359  strcat

(

strcat

( strcpy(dumpname,

"core."

), _ltoa(GetCurrentProcessId(),

tmp

, 10)),

".dmp"

);

1361  HANDLE

hf = CreateFile(dumpname,

1362

GENERIC_WRITE, 0,

NULL

, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,

NULL

);

1365

MINIDUMP_EXCEPTION_INFORMATION ei;

1366

ei.ThreadId = GetCurrentThreadId();

1367

ei.ExceptionPointers = ep;

1368

ei.ClientPointers =

FALSE

;

1370

GetCurrentProcess(), GetCurrentProcessId(),

1371

hf, MiniDumpNormal, &ei,

NULL

,

NULL

);

1373

cerr <<

"Unhandled exception: "

<<

hex 1374

<< ep->ExceptionRecord->ExceptionCode <<

" at " 1375

<< ep->ExceptionRecord->ExceptionAddress << endl;

1378  return

EXCEPTION_EXECUTE_HANDLER;

1385 #ifdef NCBI_OS_MSWIN 1391

SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |

1392

SEM_NOOPENFILEERRORBOX);

1396

_set_error_mode(_OUT_TO_STDERR);

1399  if

( !IsDebuggerPresent() ) {

1401

_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);

1402

_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);

1403

_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);

1404

_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);

1405

_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);

1406

_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);

1418

std::ignore =

mode

;

1425 #ifdef NCBI_OS_MSWIN 1436 #ifdef NCBI_OS_MSWIN 1457  #if defined(NCBI_SSE) && NCBI_SSE >= 42 1459  if

(getenv(

"NCBI_RUN_UNDER_VALGRIND"

)) {

1465  unsigned

eax, ebx, ecx, edx;

1466  #ifdef NCBI_OS_MSWIN 1469

eax = cpuid[0], ebx = cpuid[1], ecx = cpuid[2], edx = cpuid[3];

1471  asm volatile

(

"cpuid"

:

"=a"

(eax),

"=b"

(ebx),

"=c"

(ecx),

"=d"

(edx) :

"a"

(1));

1473  if

( !(ecx & (1<<20)) )

1476

message->assign(

"Application requires a CPU with SSE 4.2 support"

);

1490  return

*instruction_set;

1501 #if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) 1505  using

TRegisters = std::array<int,4>;

1506

TRegisters registers;

1507

vector<TRegisters> m_Data;

1508

vector<TRegisters> m_ExtData;

1511  auto

CPUID = [](TRegisters&

r

,

int

func_id) {

1512  #ifdef NCBI_OS_MSWIN 1513

__cpuid(

r

.data(), func_id);

1515  asm volatile

(

"cpuid"

:

"=a"

(

r

[0]),

"=b"

(

r

[1]),

"=c"

(

r

[2]),

"=d"

(

r

[3]) :

"a"

(func_id));

1518  auto

CPUID_EX = [](TRegisters&

r

,

int

func_id,

int

sub_id) {

1519  #ifdef NCBI_OS_MSWIN 1520

__cpuidex(

r

.data(), func_id, sub_id);

1522  asm volatile

(

"cpuid"

:

"=a"

(

r

[0]),

"=b"

(

r

[1]),

"=c"

(

r

[2]),

"=d"

(

r

[3]) :

"a"

(func_id),

"c"

(sub_id));

1528

CPUID(registers, 0);

1529

nIds = registers[0];

1531  for

(

int i

= 0;

i

<= nIds; ++

i

) {

1532

CPUID_EX(registers,

i

, 0);

1533

m_Data.push_back(registers);

1538

memset(vendor, 0,

sizeof

(vendor));

1539

*

reinterpret_cast<int

*

>

(vendor) = m_Data[0][1];

1540

*

reinterpret_cast<int

*

>

(vendor + 4) = m_Data[0][3];

1541

*

reinterpret_cast<int

*

>

(vendor + 8) = m_Data[0][2];

1563

CPUID(registers, 0x80000000);

1564

nExIds = registers[0];

1566  for

(

int i

= 0x80000000;

i

<= nExIds; ++

i

) {

1567

CPUID_EX(registers,

i

, 0);

1568

m_ExtData.push_back(registers);

1572  if

(nExIds >= (

int

)0x80000001) {

1578  if

(nExIds >= (

int

)0x80000004) {

1580

memset(brand, 0,

sizeof

(brand));

1581

memcpy(brand, m_ExtData[2].

data

(),

sizeof

(registers));

1582

memcpy(brand + 16, m_ExtData[3].

data

(),

sizeof

(registers));

1583

memcpy(brand + 32, m_ExtData[4].

data

(),

sizeof

(registers));

1592

list<string> supported;

1593

list<string> unsupported;

1595  auto check

= [&supported,&unsupported](

string

feature,

bool

is_supported) {

1597

supported.push_back(feature);

1599

unsupported.push_back(feature);

1660

cout << endl <<

"Supported features:"

<< endl;

1661  for

(

auto

feature : supported) {

1662

cout << feature <<

" "

;

1665

cout << endl <<

"Not supported features:"

<< endl;

1666  for

(

auto

feature : unsupported) {

1667

cout << feature <<

" "

;

static string VendorStr(void)

static bool AVX512PF(void)

static bool CMPXCHG16B(void)

static bool AVX512F(void)

static bool PCLMULQDQ(void)

static bool OSXSAVE(void)

static string BrandStr(void)

static void Print(void)

Print human-readable list of supported and not supported CPU features.

static bool AVX512CD(void)

static bool PREFETCHWT1(void)

static bool FSGSBASE(void)

static bool SYSCALL(void)

static bool AVX512ER(void)

static const InstructionSet & IS(void)

static bool MONITOR(void)

static bool _3DNOWEXT(void)

static bool INVPCID(void)

static clock_t GetClockTicksPerSecond(void)

Get number of (statistics) clock ticks per second.

static unsigned int GetCpuCount(void)

Return number of active CPUs/cores (never less than 1).

static unsigned long GetVirtualMemoryPageSize(void)

Return virtual memory page size.

static unsigned int GetCpuCountAllowed(void)

Return number of allowed to use CPUs/cores for the current thread.

static Uint8 GetAvailPhysicalMemorySize(void)

Return the amount of physical memory currently available on the system ("free"), in bytes.

static unsigned long GetVirtualMemoryAllocationGranularity(void)

Return size of an allocation unit (usually it is a multiple of page size).

static double GetUptime(void)

Get system uptime in seconds.

static Uint8 GetTotalPhysicalMemorySize(void)

Return the amount of actual/total physical memory, in bytes.

static string GetUserName(void)

Get actual user name for the current process.

static string GetUserNameByUID(uid_t uid)

Look up user name by given numeric user ID.

static string GetUserName(void)

Get name of the current user.

void(*)(CSeq_entry_Handle seh, IWorkbench *wb, const CSerialObject &obj) handler

static const char si[8][64]

EInterruptOnSignal

Interrupt on signal mode.

@ eInterruptOnSignal

Cancel operation if interrupted by a signal.

#define ERR_POST_X_ONCE(err_subcode, message)

Error posting only once during program execution with default error code and given error subcode.

#define ERR_POST_X(err_subcode, message)

Error posting with default error code and given error subcode.

TFunc GetEntryPoint_Func(const string &name, TFunc *func)

Get DLLs entry point (function).

void Critical(CExceptionArgs_Base &args)

static void SetFromErrno(void)

Set last error using current "errno" code.

void Warning(CExceptionArgs_Base &args)

static void Set(ECode code)

Set last error using native error code enum.

static void SetErrno(int errno_code)

Set last error using errno code.

Int8 GetLength(void) const

Get size of file.

int64_t Int8

8-byte (64-bit) signed integer

uint64_t Uint8

8-byte (64-bit) unsigned integer

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

IO_PREFIX::ifstream CNcbiIfstream

Portable alias for ifstream.

const long kMilliSecondsPerSecond

Number milliseconds in one second.

const long kMicroSecondsPerSecond

Number of microseconds in one second.

const long kNanoSecondsPerSecond

Number of nanoseconds in one second.

#define INVALID_HANDLE_VALUE

A value for an invalid file handle.

#define HANDLE

An abstraction for a file handle.

unsigned int

A callback function used to compare two keys in a database.

Definition of all error codes used in corelib (xncbi.lib).

where both of them are integers Note

static void hex(unsigned char c)

const struct ncbi::grid::netcache::search::fields::SIZE size

const GenericPointer< typename T::ValueType > T2 value

Defines MS Windows specific private functions and classes.

Private UNIX specific features.

Static variables safety - create on demand, destroy on application termination.

#define FALSE

bool replacment for C indicating false.

static CSafeStatic< CTime > s_TimeSet

bool SetCpuTimeLimit(unsigned int max_cpu_time, unsigned int terminate_delay_time, TLimitsPrintHandler handler, TLimitsPrintParameter parameter)

[UNIX only] Set CPU time usage limit.

bool MemoryAdvise(void *addr, size_t len, EMemoryAdvise advise)

[UNIX only] Advise on memory usage for specified memory region.

bool SetMemoryLimit(size_t max_size, TLimitsPrintHandler handler, TLimitsPrintParameter parameter)

[UNIX only] Set memory limit.

std::atomic< bool > s_IsHandlerActive

bool SetMemoryLimitSoft(size_t max_size, TLimitsPrintHandler handler, TLimitsPrintParameter parameter)

[UNIX only] Set soft memory limit.

void SleepMilliSec(unsigned long ml_sec, EInterruptOnSignal onsignal)

static TLimitsPrintParameter s_PrintHandlerParam

void SleepSec(unsigned long sec, EInterruptOnSignal onsignal)

Sleep.

static size_t s_MemoryLimitHard

static bool s_DoneSuppressSystemMessageBox

static size_t s_CpuTimeLimit

bool SetMemoryLimitHard(size_t max_size, TLimitsPrintHandler handler, TLimitsPrintParameter parameter)

[UNIX only] Set hard memory limit.

bool IsSuppressedDebugSystemMessageBox(void)

Check if system message box has been suppressed for debug library.

static void s_DefaultPrintHandler(void)

static bool s_SuppressedDebugSystemMessageBox

size_t GetVirtualMemoryLimitHard(void)

[UNIX only] Get "hard" memory limit of the virtual memory (address space) in bytes for a current proc...

bool GetCurrentProcessTimes(double *user_time, double *system_time)

void DisableSuppressSystemMessageBox(void)

Prevent run of SuppressSystemMessageBox().

static void s_SetPrintHandler(TLimitsPrintHandler handler, TLimitsPrintParameter parameter)

bool GetMemoryUsage(size_t *total, size_t *resident, size_t *shared)

void SuppressSystemMessageBox(TSuppressSystemMessageBox mode)

Suppress popup messages on execution errors.

bool VerifyCpuCompatibility(string *message)

CPU.

static void s_NewHandler(void)

static void s_SignalHandler(int sig)

std::atomic< ELimitsExitCode > s_Reason

size_t GetVirtualMemoryLimitSoft(void)

[UNIX only] Get "soft" memory limit of the virtual memory (address space) in bytes for a current proc...

static size_t s_MemoryLimitSoft

std::atomic< bool > s_IsHandlerSet

int GetProcessFDCount(int *soft_limit, int *hard_limit)

static void s_HandlerGuard(void)

DEFINE_STATIC_FAST_MUTEX(s_Limits_Handler_Mutex)

static char * s_ReservedMemory

static bool s_EnableSuppressSystemMessageBox

Suppress Diagnostic Popup Messages (all MS-Win specific)

int GetProcessThreadCount(void)

[Linux only] Provides the number of threads in the current process.

void SleepMicroSec(unsigned long mc_sec, EInterruptOnSignal onsignal)

static LONG CALLBACK _SEH_Handler(EXCEPTION_POINTERS *ep)

static TLimitsPrintHandler s_PrintHandler

int TSuppressSystemMessageBox

Binary OR of "ESuppressSystemMessageBox".

void * TLimitsPrintParameter

Type of parameter for print handler.

EMemoryAdvise

Memory advise.

@ eMADV_WillNeed

Expect access in the near future.

@ eMADV_Mergeable

KSM may merge identical pages.

@ eMADV_Normal

No further special treatment – by default.

@ eMADV_Random

Expect random page references.

@ eMADV_DontNeed

Do not expect access in the near future.

@ eMADV_Sequential

Expect sequential page references.

@ eMADV_DoFork

Do inherit across fork() – by default.

@ eMADV_DontFork

Don't inherit across fork()

@ eMADV_Unmergeable

KSM may not merge identical pages – by default.

@ fSuppress_Debug

Debug library.

@ fSuppress_System

System errors.

@ fSuppress_Runtime

Runtime library.

@ fSuppress_Exception

Unhandled exceptions.

void(* TLimitsPrintHandler)(ELimitsExitCode, size_t, CTime &, TLimitsPrintParameter)

Type of handler for printing a dump information after generating any limitation event.

@ eLEC_Cpu

CPU time usage limit.

@ eLEC_Memory

Memory limit.

Define class Dll and for Portable DLL handling.

Defines NCBI C++ Toolkit portable error codes.

Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...

Multi-threading – mutexes; rw-locks; semaphore.

double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)

static SLJIT_INLINE sljit_ins st(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4