8206453: Taskqueue stats should count real steal attempts, not calls to GenericTaskQueueSet::steal
Reviewed-by: ehelin, kbarrett
--- a/src/hotspot/share/gc/shared/taskqueue.hpp Sun Jul 08 20:00:46 2018 -0400
+++ b/src/hotspot/share/gc/shared/taskqueue.hpp Mon Jul 09 14:12:50 2018 +0200
@@ -61,10 +61,11 @@
public:
inline TaskQueueStats() { reset(); }
- inline void record_push() { ++_stats[push]; }
- inline void record_pop() { ++_stats[pop]; }
- inline void record_pop_slow() { record_pop(); ++_stats[pop_slow]; }
- inline void record_steal(bool success);
+ inline void record_push() { ++_stats[push]; }
+ inline void record_pop() { ++_stats[pop]; }
+ inline void record_pop_slow() { record_pop(); ++_stats[pop_slow]; }
+ inline void record_steal_attempt() { ++_stats[steal_attempt]; }
+ inline void record_steal() { ++_stats[steal]; }
inline void record_overflow(size_t new_length);
TaskQueueStats & operator +=(const TaskQueueStats & addend);
@@ -87,11 +88,6 @@
static const char * const _names[last_stat_id];
};
-void TaskQueueStats::record_steal(bool success) {
- ++_stats[steal_attempt];
- if (success) ++_stats[steal];
-}
-
void TaskQueueStats::record_overflow(size_t new_len) {
++_stats[overflow];
if (new_len > _stats[overflow_max_len]) _stats[overflow_max_len] = new_len;
@@ -364,18 +360,19 @@
template<class T, MEMFLAGS F>
class GenericTaskQueueSet: public TaskQueueSetSuperImpl<F> {
+public:
+ typedef typename T::element_type E;
+
private:
uint _n;
T** _queues;
+ bool steal_best_of_2(uint queue_num, int* seed, E& t);
+
public:
- typedef typename T::element_type E;
-
GenericTaskQueueSet(int n);
~GenericTaskQueueSet();
- bool steal_best_of_2(uint queue_num, int* seed, E& t);
-
void register_queue(uint i, T* q);
T* queue(uint n);
--- a/src/hotspot/share/gc/shared/taskqueue.inline.hpp Sun Jul 08 20:00:46 2018 -0400
+++ b/src/hotspot/share/gc/shared/taskqueue.inline.hpp Mon Jul 09 14:12:50 2018 +0200
@@ -252,12 +252,12 @@
template<class T, MEMFLAGS F> bool
GenericTaskQueueSet<T, F>::steal(uint queue_num, int* seed, E& t) {
for (uint i = 0; i < 2 * _n; i++) {
+ TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal_attempt());
if (steal_best_of_2(queue_num, seed, t)) {
- TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal(true));
+ TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal());
return true;
}
}
- TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal(false));
return false;
}