diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2015-08-11 21:36:41 +0000 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2015-08-11 21:36:41 +0000 |
commit | 45be450070170249ac44043e705d4587a9c53205 (patch) | |
tree | fcbf4247ba307318e66f9e6a1caa33e8233cf718 /openmp/runtime/src/kmp_csupport.c | |
parent | 827529e7a05d19185ff54aa8997a363c77f9baf0 (diff) | |
download | bcm5719-llvm-45be450070170249ac44043e705d4587a9c53205.tar.gz bcm5719-llvm-45be450070170249ac44043e705d4587a9c53205.zip |
Tidy statistics collection
This removes some statistics counters and timers which were not used,
adds new counters and timers for some language features that were not
monitored previously and separates the counters and timers into those
which are of interest for investigating user code and those which are
only of interest to the developer of the runtime itself.
The runtime developer statistics are now ony collected if the
additional #define KMP_DEVELOPER_STATS is set.
Additional user statistics which are now collected include:
* Count of nested parallelism (omp parallel inside a parallel region)
* Count of omp distribute occurrences
* Count of omp teams occurrences
* Counts of task related statistics (taskyield, task execution, task
cancellation, task steal)
* Values passed to omp_set_numtheads
* Time spent in omp single and omp master
None of this affects code compiled without stats gathering enabled,
which is the normal library build mode.
This also fixes the CMake build by linking to the standard c++ library
when building the stats library as it is a requirement. The normal library
does not have this requirement and its link phase is left alone.
Differential Revision: http://reviews.llvm.org/D11759
llvm-svn: 244677
Diffstat (limited to 'openmp/runtime/src/kmp_csupport.c')
-rw-r--r-- | openmp/runtime/src/kmp_csupport.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/openmp/runtime/src/kmp_csupport.c b/openmp/runtime/src/kmp_csupport.c index 1c8c5fb7d1b..e6e98130ca4 100644 --- a/openmp/runtime/src/kmp_csupport.c +++ b/openmp/runtime/src/kmp_csupport.c @@ -280,9 +280,21 @@ Do the actual fork and call the microtask in the relevant number of threads. void __kmpc_fork_call(ident_t *loc, kmp_int32 argc, kmpc_micro microtask, ...) { - KMP_STOP_EXPLICIT_TIMER(OMP_serial); - KMP_COUNT_BLOCK(OMP_PARALLEL); int gtid = __kmp_entry_gtid(); + +#if (KMP_STATS_ENABLED) + int inParallel = __kmpc_in_parallel(loc); + if (inParallel) + { + KMP_COUNT_BLOCK(OMP_NESTED_PARALLEL); + } + else + { + KMP_STOP_EXPLICIT_TIMER(OMP_serial); + KMP_COUNT_BLOCK(OMP_PARALLEL); + } +#endif + // maybe to save thr_state is enough here { va_list ap; @@ -329,7 +341,10 @@ __kmpc_fork_call(ident_t *loc, kmp_int32 argc, kmpc_micro microtask, ...) } #endif } - KMP_START_EXPLICIT_TIMER(OMP_serial); +#if (KMP_STATS_ENABLED) + if (!inParallel) + KMP_START_EXPLICIT_TIMER(OMP_serial); +#endif } #if OMP_40_ENABLED @@ -370,6 +385,8 @@ __kmpc_fork_teams(ident_t *loc, kmp_int32 argc, kmpc_micro microtask, ...) va_list ap; va_start( ap, microtask ); + KMP_COUNT_BLOCK(OMP_TEAMS); + // remember teams entry point and nesting level this_thr->th.th_teams_microtask = microtask; this_thr->th.th_teams_level = this_thr->th.th_team->t.t_level; // AC: can be >0 on host @@ -715,8 +732,10 @@ __kmpc_master(ident_t *loc, kmp_int32 global_tid) if( ! TCR_4( __kmp_init_parallel ) ) __kmp_parallel_initialize(); - if( KMP_MASTER_GTID( global_tid )) + if( KMP_MASTER_GTID( global_tid )) { + KMP_START_EXPLICIT_TIMER(OMP_master); status = 1; + } #if OMPT_SUPPORT && OMPT_TRACE if (status) { @@ -764,6 +783,7 @@ __kmpc_end_master(ident_t *loc, kmp_int32 global_tid) KC_TRACE( 10, ("__kmpc_end_master: called T#%d\n", global_tid ) ); KMP_DEBUG_ASSERT( KMP_MASTER_GTID( global_tid )); + KMP_STOP_EXPLICIT_TIMER(OMP_master); #if OMPT_SUPPORT && OMPT_TRACE kmp_info_t *this_thr = __kmp_threads[ global_tid ]; @@ -1386,6 +1406,9 @@ __kmpc_single(ident_t *loc, kmp_int32 global_tid) { KMP_COUNT_BLOCK(OMP_SINGLE); kmp_int32 rc = __kmp_enter_single( global_tid, loc, TRUE ); + if(rc == TRUE) { + KMP_START_EXPLICIT_TIMER(OMP_single); + } #if OMPT_SUPPORT && OMPT_TRACE kmp_info_t *this_thr = __kmp_threads[ global_tid ]; @@ -1427,6 +1450,7 @@ void __kmpc_end_single(ident_t *loc, kmp_int32 global_tid) { __kmp_exit_single( global_tid ); + KMP_STOP_EXPLICIT_TIMER(OMP_single); #if OMPT_SUPPORT && OMPT_TRACE kmp_info_t *this_thr = __kmp_threads[ global_tid ]; @@ -2191,7 +2215,6 @@ int __kmpc_test_lock( ident_t *loc, kmp_int32 gtid, void **user_lock ) { KMP_COUNT_BLOCK(OMP_test_lock); - KMP_TIME_BLOCK(OMP_test_lock); #if KMP_USE_DYNAMIC_LOCK int rc; |