diff src/share/vm/utilities/taskqueue.hpp @ 546:05c6d52fa7a9

6690928: Use spinning in combination with yields for workstealing termination. Summary: Substitute a spin loop for most calls to yield() to reduce the stress on the system. Reviewed-by: tonyp
author jmasa
date Sun, 08 Feb 2009 13:18:01 -0800
parents 23673011938d
children 0fbdb4381b99
line wrap: on
line diff
--- a/src/share/vm/utilities/taskqueue.hpp	Fri Feb 06 01:38:50 2009 +0300
+++ b/src/share/vm/utilities/taskqueue.hpp	Sun Feb 08 13:18:01 2009 -0800
@@ -426,12 +426,20 @@
 // A class to aid in the termination of a set of parallel tasks using
 // TaskQueueSet's for work stealing.
 
+#undef TRACESPINNING
+
 class ParallelTaskTerminator: public StackObj {
 private:
   int _n_threads;
   TaskQueueSetSuper* _queue_set;
   int _offered_termination;
 
+#ifdef TRACESPINNING
+  static uint _total_yields;
+  static uint _total_spins;
+  static uint _total_peeks;
+#endif
+
   bool peek_in_queue_set();
 protected:
   virtual void yield();
@@ -462,6 +470,12 @@
   // the terminator is finished.
   void reset_for_reuse();
 
+#ifdef TRACESPINNING
+  static uint total_yields() { return _total_yields; }
+  static uint total_spins() { return _total_spins; }
+  static uint total_peeks() { return _total_peeks; }
+  static void print_termination_counts();
+#endif
 };
 
 #define SIMPLE_STACK 0