summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2016-03-03 21:21:05 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2016-03-03 21:21:05 +0000
commit30138256fa629a78da3bcc587a0885dd4a8bdd7a (patch)
tree4f0d95f3379b925ca89ab605dce0bd26d53cd7f7
parent0b027eab7a48e190fb27ce77d6ea9e6d0c9f27e8 (diff)
downloadbcm5719-llvm-30138256fa629a78da3bcc587a0885dd4a8bdd7a.tar.gz
bcm5719-llvm-30138256fa629a78da3bcc587a0885dd4a8bdd7a.zip
[STATS] fix master and single timers
Only the thread which executes the single/master section will update its statistics. llvm-svn: 262656
-rw-r--r--openmp/runtime/src/kmp_csupport.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/openmp/runtime/src/kmp_csupport.c b/openmp/runtime/src/kmp_csupport.c
index 50650aac2ac..62d65d8d902 100644
--- a/openmp/runtime/src/kmp_csupport.c
+++ b/openmp/runtime/src/kmp_csupport.c
@@ -732,7 +732,6 @@ __kmpc_barrier(ident_t *loc, kmp_int32 global_tid)
kmp_int32
__kmpc_master(ident_t *loc, kmp_int32 global_tid)
{
- KMP_COUNT_BLOCK(OMP_MASTER);
int status = 0;
KC_TRACE( 10, ("__kmpc_master: called T#%d\n", global_tid ) );
@@ -741,6 +740,7 @@ __kmpc_master(ident_t *loc, kmp_int32 global_tid)
__kmp_parallel_initialize();
if( KMP_MASTER_GTID( global_tid )) {
+ KMP_COUNT_BLOCK(OMP_MASTER);
KMP_START_EXPLICIT_TIMER(OMP_master);
status = 1;
}
@@ -1476,9 +1476,11 @@ introduce an explicit barrier if it is required.
kmp_int32
__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) {
+
+ if (rc) {
+ // We are going to execute the single statement, so we should count it.
+ KMP_COUNT_BLOCK(OMP_SINGLE);
KMP_START_EXPLICIT_TIMER(OMP_single);
}
OpenPOWER on IntegriCloud