summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/z_Linux_util.c
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2016-11-14 21:13:44 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2016-11-14 21:13:44 +0000
commit5375fe820cff7ae7f3c5c771f28c6f5518f2ee60 (patch)
treed1a87287140554083ff8cc8428685f237f2fe899 /openmp/runtime/src/z_Linux_util.c
parentf10a871419c3bfb05690add75201b1cb56c8e96d (diff)
downloadbcm5719-llvm-5375fe820cff7ae7f3c5c771f28c6f5518f2ee60.tar.gz
bcm5719-llvm-5375fe820cff7ae7f3c5c771f28c6f5518f2ee60.zip
Update stats-gathering code
Have developer timers use partitioning scheme which also required that some redundant developer timers be removed in favor of the already existing normal timers. Move per thread stats initialization to just after global thread id assignment which is as early as possible. Also put all global stats initialization code in __kmp_stats_init() and all global stats destruction code in __kmp_stats_fini(). Differential Revision: https://reviews.llvm.org/D26361 llvm-svn: 286892
Diffstat (limited to 'openmp/runtime/src/z_Linux_util.c')
-rw-r--r--openmp/runtime/src/z_Linux_util.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/openmp/runtime/src/z_Linux_util.c b/openmp/runtime/src/z_Linux_util.c
index 389f4d543db..4a26d4b65d5 100644
--- a/openmp/runtime/src/z_Linux_util.c
+++ b/openmp/runtime/src/z_Linux_util.c
@@ -866,14 +866,12 @@ __kmp_create_worker( int gtid, kmp_info_t *th, size_t stack_size )
// th->th.th_stats is used to transfer thread specific stats-pointer to __kmp_launch_worker
// So when thread is created (goes into __kmp_launch_worker) it will
// set it's __thread local pointer to th->th.th_stats
- th->th.th_stats = __kmp_stats_list.push_back(gtid);
- if(KMP_UBER_GTID(gtid)) {
- __kmp_stats_start_time = tsc_tick_count::now();
- __kmp_stats_thread_ptr = th->th.th_stats;
- __kmp_stats_init();
- KMP_START_EXPLICIT_TIMER(OMP_worker_thread_life);
- KMP_SET_THREAD_STATE(SERIAL_REGION);
- KMP_INIT_PARTITIONED_TIMERS(OMP_serial);
+ if(!KMP_UBER_GTID(gtid)) {
+ th->th.th_stats = __kmp_stats_list->push_back(gtid);
+ } else {
+ // For root threads, the __kmp_stats_thread_ptr is set in __kmp_register_root(), so
+ // set the th->th.th_stats field to it.
+ th->th.th_stats = __kmp_stats_thread_ptr;
}
__kmp_release_tas_lock(&__kmp_stats_lock, gtid);
@@ -1541,7 +1539,7 @@ __kmp_suspend_uninitialize_thread( kmp_info_t *th )
template <class C>
static inline void __kmp_suspend_template( int th_gtid, C *flag )
{
- KMP_TIME_DEVELOPER_BLOCK(USER_suspend);
+ KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(USER_suspend);
kmp_info_t *th = __kmp_threads[th_gtid];
int status;
typename C::flag_t old_spin;
@@ -1675,7 +1673,7 @@ void __kmp_suspend_oncore(int th_gtid, kmp_flag_oncore *flag) {
template <class C>
static inline void __kmp_resume_template( int target_gtid, C *flag )
{
- KMP_TIME_DEVELOPER_BLOCK(USER_resume);
+ KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(USER_resume);
kmp_info_t *th = __kmp_threads[target_gtid];
int status;
@@ -1750,7 +1748,7 @@ void __kmp_resume_oncore(int target_gtid, kmp_flag_oncore *flag) {
void
__kmp_resume_monitor()
{
- KMP_TIME_DEVELOPER_BLOCK(USER_resume);
+ KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(USER_resume);
int status;
#ifdef KMP_DEBUG
int gtid = TCR_4(__kmp_init_gtid) ? __kmp_get_gtid() : -1;
OpenPOWER on IntegriCloud