summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/kmp_sched.cpp
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2018-07-30 17:41:08 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2018-07-30 17:41:08 +0000
commitf0682ac498e8fe65fce4d901093e201e62939b94 (patch)
treee098dbb0daadb88c794fab2b24e70a807b366d88 /openmp/runtime/src/kmp_sched.cpp
parent05779bfcc80fbae6021f142d6dda8a50e85e34af (diff)
downloadbcm5719-llvm-f0682ac498e8fe65fce4d901093e201e62939b94.tar.gz
bcm5719-llvm-f0682ac498e8fe65fce4d901093e201e62939b94.zip
[OpenMP][Stats] Cleanup stats gathering code
1) Remove unnecessary data from list node structure 2) Remove timerPair in favor of pushing/popping explicitTimers. This way, nested timers will work properly. 3) Fix #pragma omp critical timers 4) Add histogram capability 5) Add KMP_STATS_FILE formatting capability 6) Have time partitioned into serial & parallel by introducing partitionedTimers::exchange(). This also counts the number of serial regions in the executable. 7) Fix up the timers around OMP loops so that scheduling overhead and work are both counted correctly. 8) Fix up the iterations statistics so they count the number of iterations the thread receives at each loop scheduling event 9) Change timers so there is only one RDTSC read per event change 10) Fix up the outdated comments for the timers Differential Revision: https://reviews.llvm.org/D49699 llvm-svn: 338276
Diffstat (limited to 'openmp/runtime/src/kmp_sched.cpp')
-rw-r--r--openmp/runtime/src/kmp_sched.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/openmp/runtime/src/kmp_sched.cpp b/openmp/runtime/src/kmp_sched.cpp
index 3700ee04da6..d402db1dd76 100644
--- a/openmp/runtime/src/kmp_sched.cpp
+++ b/openmp/runtime/src/kmp_sched.cpp
@@ -51,8 +51,9 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
void *codeptr
#endif
) {
- KMP_COUNT_BLOCK(OMP_FOR_static);
- KMP_TIME_PARTITIONED_BLOCK(FOR_static_scheduling);
+ KMP_COUNT_BLOCK(OMP_LOOP_STATIC);
+ KMP_PUSH_PARTITIONED_TIMER(OMP_loop_static);
+ KMP_PUSH_PARTITIONED_TIMER(OMP_loop_static_scheduling);
typedef typename traits_t<T>::unsigned_t UT;
typedef typename traits_t<T>::signed_t ST;
@@ -151,7 +152,6 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
&(task_info->task_data), 0, codeptr);
}
#endif
- KMP_COUNT_VALUE(FOR_static_iterations, 0);
return;
}
@@ -254,7 +254,6 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
loc);
}
}
- KMP_COUNT_VALUE(FOR_static_iterations, trip_count);
/* compute remaining parameters */
switch (schedtype) {
@@ -390,6 +389,26 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
}
#endif
+#if KMP_STATS_ENABLED
+ {
+ kmp_int64 t;
+ kmp_int64 u = (kmp_int64)(*pupper);
+ kmp_int64 l = (kmp_int64)(*plower);
+ kmp_int64 i = (kmp_int64)incr;
+ /* compute trip count */
+ if (i == 1) {
+ t = u - l + 1;
+ } else if (i == -1) {
+ t = l - u + 1;
+ } else if (i > 0) {
+ t = (u - l) / i + 1;
+ } else {
+ t = (l - u) / (-i) + 1;
+ }
+ KMP_COUNT_VALUE(OMP_loop_static_iterations, t);
+ KMP_POP_PARTITIONED_TIMER();
+ }
+#endif
return;
}
OpenPOWER on IntegriCloud