#include "kmp.h"
#include "kmp_wrapper_getpid.h"
#include "kmp_str.h"
#include "kmp_i18n.h"
#include "kmp_io.h"
#include <alloca.h>
#include <unistd.h>
#include <math.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/resource.h>
#include <sys/syscall.h>
#include <dirent.h>
#include <ctype.h>
#include <fcntl.h>
Go to the source code of this file.
Data Structures | |
struct | kmp_sys_timer |
Defines | |
#define | TS2NS(timespec) (((timespec).tv_sec * 1e9) + (timespec).tv_nsec) |
Functions | |
static void | __kmp_atfork_child (void) |
static void | __kmp_atfork_parent (void) |
static void | __kmp_atfork_prepare (void) |
void | __kmp_clear_system_time (void) |
void | __kmp_create_monitor (kmp_info_t *th) |
void | __kmp_create_worker (int gtid, kmp_info_t *th, size_t stack_size) |
void | __kmp_disable (int *old_state) |
void | __kmp_elapsed (double *t) |
void | __kmp_elapsed_tick (double *t) |
void | __kmp_enable (int new_state) |
void | __kmp_exit_thread (int exit_status) |
static kmp_uint64 | __kmp_get_frequency_from_proc () |
static int | __kmp_get_xproc (void) |
int | __kmp_gtid_get_specific () |
void | __kmp_gtid_set_specific (int gtid) |
int | __kmp_is_address_mapped (void *addr) |
static void * | __kmp_launch_monitor (void *thr) |
static void * | __kmp_launch_worker (void *thr) |
double | __kmp_read_cpu_time (void) |
int | __kmp_read_system_info (struct kmp_sys_info *info) |
void | __kmp_read_system_time (double *delta) |
void | __kmp_reap_monitor (kmp_info_t *th) |
void | __kmp_reap_worker (kmp_info_t *th) |
void | __kmp_register_atfork (void) |
void | __kmp_resume (int target_gtid, volatile kmp_uint *spin) |
void | __kmp_runtime_destroy (void) |
void | __kmp_runtime_initialize (void) |
static kmp_int32 | __kmp_set_stack_info (int gtid, kmp_info_t *th) |
void | __kmp_suspend (int th_gtid, volatile kmp_uint *spinner, kmp_uint checker) |
void | __kmp_suspend_initialize (void) |
static void | __kmp_suspend_initialize_thread (kmp_info_t *th) |
void | __kmp_suspend_uninitialize_thread (kmp_info_t *th) |
void | __kmp_terminate_thread (int gtid) |
void | __kmp_thread_sleep (int millis) |
void | __kmp_yield (int cond) |
Variables | |
static int | __kmp_fork_count = 0 |
static int | __kmp_init_runtime = FALSE |
static pthread_condattr_t | __kmp_suspend_cond_attr |
static pthread_mutexattr_t | __kmp_suspend_mutex_attr |
static struct kmp_sys_timer | __kmp_sys_timer_data |
static kmp_cond_align_t | __kmp_wait_cv |
static kmp_mutex_align_t | __kmp_wait_mx |
#define TS2NS | ( | timespec | ) | (((timespec).tv_sec * 1e9) + (timespec).tv_nsec) |
Definition at line 94 of file z_Linux_util.c.
Referenced by __kmp_read_system_time().
static void __kmp_atfork_child | ( | void | ) | [static] |
Definition at line 1525 of file z_Linux_util.c.
References __kmp_all_nth, __kmp_console_lock, __kmp_fork_count, __kmp_init_bootstrap_lock(), __kmp_init_common, __kmp_init_gtid, __kmp_init_middle, __kmp_init_monitor, __kmp_init_parallel, __kmp_init_runtime, __kmp_init_serial, __kmp_init_user_locks, __kmp_initz_lock, __kmp_lock_blocks, __kmp_nth, __kmp_stdio_lock, __kmp_threadpriv_cache_list, __kmp_user_lock_table, kmp_lock_table::allocated, FALSE, KA_TRACE, KC_TRACE, kmp_lock_table::table, TCW_4, and kmp_lock_table::used.
Referenced by __kmp_register_atfork().
static void __kmp_atfork_parent | ( | void | ) | [static] |
Definition at line 1514 of file z_Linux_util.c.
Referenced by __kmp_register_atfork().
static void __kmp_atfork_prepare | ( | void | ) | [static] |
Definition at line 1508 of file z_Linux_util.c.
Referenced by __kmp_register_atfork().
void __kmp_clear_system_time | ( | void | ) |
Definition at line 1952 of file z_Linux_util.c.
References __kmp_sys_timer_data, KMP_CHECK_SYSFAIL_ERRNO, and kmp_sys_timer::start.
void __kmp_create_monitor | ( | kmp_info_t * | th | ) |
Definition at line 1072 of file z_Linux_util.c.
References __kmp_get_gtid, __kmp_global, __kmp_launch_monitor(), __kmp_monitor_stksize, __kmp_msg(), __kmp_msg_null, __kmp_neq_4(), __kmp_sys_min_stksize, __kmp_wait_yield_4(), FALSE, KA_TRACE, KMP_CHECK_SYSFAIL, KMP_DEBUG_ASSERT, KMP_DEFAULT_MONITOR_STKSIZE, KMP_ERR, KMP_GTID_MONITOR, KMP_HNT, KMP_MB, kmp_ms_fatal, kmp_ms_warning, KMP_MSG, KMP_SYSFAIL, TCW_4, and TRUE.
void __kmp_create_worker | ( | int | gtid, | |
kmp_info_t * | th, | |||
size_t | stack_size | |||
) |
Definition at line 934 of file z_Linux_util.c.
References __kmp_check_stack_overlap(), __kmp_env_stksize, __kmp_launch_worker(), __kmp_msg(), __kmp_msg_null, __kmp_set_stack_info(), __kmp_stkoffset, __kmp_stksize, KA_TRACE, KMP_DEFAULT_STKSIZE, KMP_ERR, KMP_HNT, KMP_MB, kmp_ms_fatal, kmp_ms_warning, KMP_MSG, KMP_SYSFAIL, and KMP_UBER_GTID.
void __kmp_disable | ( | int * | old_state | ) |
Definition at line 1495 of file z_Linux_util.c.
References KMP_CHECK_SYSFAIL.
void __kmp_elapsed | ( | double * | t | ) |
Definition at line 2187 of file z_Linux_util.c.
References KMP_CHECK_SYSFAIL_ERRNO, NSEC_PER_SEC, and USEC_PER_SEC.
void __kmp_elapsed_tick | ( | double * | t | ) |
Definition at line 2209 of file z_Linux_util.c.
void __kmp_enable | ( | int | new_state | ) |
Definition at line 1484 of file z_Linux_util.c.
References KMP_CHECK_SYSFAIL, and KMP_DEBUG_ASSERT.
void __kmp_exit_thread | ( | int | exit_status | ) |
Definition at line 1227 of file z_Linux_util.c.
static kmp_uint64 __kmp_get_frequency_from_proc | ( | ) | [static] |
Definition at line 2035 of file z_Linux_util.c.
References KA_TRACE.
Referenced by __kmp_runtime_initialize().
static int __kmp_get_xproc | ( | void | ) | [static] |
Definition at line 1993 of file z_Linux_util.c.
References KMP_INFORM, and KMP_WARNING.
Referenced by __kmp_runtime_initialize().
int __kmp_gtid_get_specific | ( | void | ) |
Definition at line 1876 of file z_Linux_util.c.
References __kmp_gtid_threadprivate_key, __kmp_init_runtime, KA_TRACE, KMP_GTID_DNE, and KMP_GTID_SHUTDOWN.
void __kmp_gtid_set_specific | ( | int | gtid | ) |
Definition at line 1867 of file z_Linux_util.c.
References __kmp_gtid_threadprivate_key, __kmp_init_runtime, KMP_ASSERT, and KMP_CHECK_SYSFAIL.
int __kmp_is_address_mapped | ( | void * | addr | ) |
Definition at line 2219 of file z_Linux_util.c.
References __kmp_str_format(), KMP_ASSERT, and KMP_INTERNAL_FREE.
static void* __kmp_launch_monitor | ( | void * | thr | ) | [static] |
Definition at line 743 of file z_Linux_util.c.
References __kmp_check_stack_overlap(), __kmp_cleanup(), __kmp_global, __kmp_gtid_set_specific(), __kmp_monitor_wakeups, __kmp_msg(), __kmp_msg_null, __kmp_set_stack_info(), __kmp_terminate_thread(), __kmp_threads_capacity, __kmp_wait_cv, __kmp_wait_mx, __kmp_yield_cycle, __kmp_yield_off_count, __kmp_yield_on_count, __kmp_yielding_on, KA_TRACE, KMP_CHECK_SYSFAIL, KMP_CHECK_SYSFAIL_ERRNO, KMP_ERR, KMP_GTID_MONITOR, KMP_HNT, KMP_MB, kmp_ms_warning, KMP_MSG, KMP_SYSFAIL, KMP_WARNING, NSEC_PER_SEC, TCR_4, and TCW_4.
Referenced by __kmp_create_monitor().
static void* __kmp_launch_worker | ( | void * | thr | ) | [static] |
Definition at line 667 of file z_Linux_util.c.
References __kmp_check_stack_overlap(), __kmp_gtid_set_specific(), __kmp_launch_thread(), __kmp_set_stack_info(), __kmp_stkoffset, FALSE, KMP_CHECK_SYSFAIL, KMP_CHECK_SYSFAIL_ERRNO, and KMP_MB.
Referenced by __kmp_create_worker().
double __kmp_read_cpu_time | ( | void | ) |
Definition at line 1899 of file z_Linux_util.c.
int __kmp_read_system_info | ( | struct kmp_sys_info * | info | ) |
Definition at line 1910 of file z_Linux_util.c.
References kmp_sys_info::inblock, KMP_CHECK_SYSFAIL_ERRNO, kmp_sys_info::majflt, kmp_sys_info::maxrss, kmp_sys_info::minflt, kmp_sys_info::nivcsw, kmp_sys_info::nswap, kmp_sys_info::nvcsw, and kmp_sys_info::oublock.
void __kmp_read_system_time | ( | double * | delta | ) |
Definition at line 1937 of file z_Linux_util.c.
References __kmp_sys_timer_data, KMP_CHECK_SYSFAIL_ERRNO, kmp_sys_timer::start, and TS2NS.
void __kmp_reap_monitor | ( | kmp_info_t * | th | ) |
Definition at line 1234 of file z_Linux_util.c.
References __kmp_msg(), __kmp_msg_null, i, KA_TRACE, KMP_DEBUG_ASSERT, KMP_ERR, KMP_GTID_DNE, KMP_GTID_MONITOR, KMP_MB, kmp_ms_fatal, and KMP_MSG.
void __kmp_reap_worker | ( | kmp_info_t * | th | ) |
Definition at line 1286 of file z_Linux_util.c.
References __kmp_msg(), __kmp_msg_null, KA_TRACE, KMP_ERR, KMP_MB, kmp_ms_fatal, and KMP_MSG.
void __kmp_register_atfork | ( | void | ) |
Definition at line 1586 of file z_Linux_util.c.
References __kmp_atfork_child(), __kmp_atfork_parent(), __kmp_atfork_prepare(), __kmp_need_register_atfork, FALSE, and KMP_CHECK_SYSFAIL.
Referenced by __kmp_do_serial_initialize().
void __kmp_resume | ( | int | target_gtid, | |
volatile kmp_uint * | spin | |||
) |
Definition at line 1786 of file z_Linux_util.c.
References __kmp_get_gtid, __kmp_init_gtid, __kmp_printf(), __kmp_suspend_initialize_thread(), __kmp_test_then_and32(), __kmp_threads, KF_TRACE, KMP_BARRIER_SLEEP_STATE, KMP_CHECK_SYSFAIL, KMP_DEBUG_ASSERT, TCR_4, TCR_PTR, and TCW_PTR.
void __kmp_runtime_destroy | ( | void | ) |
Definition at line 2141 of file z_Linux_util.c.
References __kmp_gtid_threadprivate_key, __kmp_init_runtime, __kmp_wait_cv, __kmp_wait_mx, FALSE, KMP_CHECK_SYSFAIL, and KMP_SYSFAIL.
void __kmp_runtime_initialize | ( | void | ) |
Definition at line 2068 of file z_Linux_util.c.
References __kmp_cpu_frequency, __kmp_cpuinfo, __kmp_get_frequency_from_proc(), __kmp_get_xproc(), __kmp_gtid_threadprivate_key, __kmp_init_runtime, __kmp_internal_end_dest(), __kmp_sys_max_nth, __kmp_sys_min_stksize, __kmp_tls_gtid_min, __kmp_wait_cv, __kmp_wait_mx, __kmp_xproc, kmp_cpuinfo::frequency, kmp_cpuinfo::initialized, KMP_CHECK_SYSFAIL, KMP_MAX_NTH, KMP_MIN_STKSIZE, KMP_TLS_GTID_MIN, and TRUE.
static kmp_int32 __kmp_set_stack_info | ( | int | gtid, | |
kmp_info_t * | th | |||
) | [static] |
Definition at line 618 of file z_Linux_util.c.
References FALSE, KA_TRACE, KMP_CHECK_SYSFAIL, KMP_UBER_GTID, TCW_4, TCW_PTR, and TRUE.
Referenced by __kmp_create_worker(), __kmp_launch_monitor(), and __kmp_launch_worker().
Definition at line 1646 of file z_Linux_util.c.
References __kmp_dflt_blocktime, __kmp_printf(), __kmp_suspend_initialize_thread(), __kmp_test_then_and32(), __kmp_test_then_or32(), __kmp_thread_pool_active_nth, __kmp_threads, FALSE, KF_TRACE, KMP_BARRIER_SLEEP_STATE, KMP_CHECK_SYSFAIL, KMP_CHECK_SYSFAIL_ERRNO, KMP_DEBUG_ASSERT, KMP_SYSFAIL, KMP_TEST_THEN_DEC32, KMP_TEST_THEN_INC32, TCR_4, TCW_PTR, and TRUE.
void __kmp_suspend_initialize | ( | void | ) |
Definition at line 1595 of file z_Linux_util.c.
References __kmp_suspend_cond_attr, __kmp_suspend_mutex_attr, and KMP_CHECK_SYSFAIL.
static void __kmp_suspend_initialize_thread | ( | kmp_info_t * | th | ) | [static] |
Definition at line 1605 of file z_Linux_util.c.
References __kmp_fork_count, __kmp_suspend_cond_attr, __kmp_suspend_mutex_attr, and KMP_CHECK_SYSFAIL.
Referenced by __kmp_resume(), and __kmp_suspend().
void __kmp_suspend_uninitialize_thread | ( | kmp_info_t * | th | ) |
Definition at line 1620 of file z_Linux_util.c.
References __kmp_fork_count, KMP_DEBUG_ASSERT, and KMP_SYSFAIL.
void __kmp_terminate_thread | ( | int | gtid | ) |
Definition at line 581 of file z_Linux_util.c.
References __kmp_msg(), __kmp_msg_null, __kmp_threads, __kmp_yield(), KA_TRACE, KMP_ERR, kmp_ms_fatal, KMP_MSG, and TRUE.
void __kmp_thread_sleep | ( | int | millis | ) |
Definition at line 2180 of file z_Linux_util.c.
void __kmp_yield | ( | int | cond | ) |
Definition at line 1856 of file z_Linux_util.c.
References __kmp_yielding_on.
int __kmp_fork_count = 0 [static] |
Definition at line 106 of file z_Linux_util.c.
Referenced by __kmp_atfork_child(), __kmp_suspend_initialize_thread(), and __kmp_suspend_uninitialize_thread().
int __kmp_init_runtime = FALSE [static] |
Definition at line 104 of file z_Linux_util.c.
Referenced by __kmp_atfork_child(), __kmp_gtid_get_specific(), __kmp_gtid_set_specific(), __kmp_runtime_destroy(), and __kmp_runtime_initialize().
pthread_condattr_t __kmp_suspend_cond_attr [static] |
Definition at line 108 of file z_Linux_util.c.
Referenced by __kmp_suspend_initialize(), and __kmp_suspend_initialize_thread().
pthread_mutexattr_t __kmp_suspend_mutex_attr [static] |
Definition at line 109 of file z_Linux_util.c.
Referenced by __kmp_suspend_initialize(), and __kmp_suspend_initialize_thread().
struct kmp_sys_timer __kmp_sys_timer_data [static] |
Definition at line 96 of file z_Linux_util.c.
Referenced by __kmp_clear_system_time(), and __kmp_read_system_time().
kmp_cond_align_t __kmp_wait_cv [static] |
Definition at line 111 of file z_Linux_util.c.
Referenced by __kmp_launch_monitor(), __kmp_runtime_destroy(), and __kmp_runtime_initialize().
kmp_mutex_align_t __kmp_wait_mx [static] |
Definition at line 112 of file z_Linux_util.c.
Referenced by __kmp_launch_monitor(), __kmp_runtime_destroy(), and __kmp_runtime_initialize().