1.1 --- a/src/share/vm/utilities/taskqueue.cpp Fri Jul 16 10:09:15 2010 -0700 1.2 +++ b/src/share/vm/utilities/taskqueue.cpp Fri Jul 16 21:33:21 2010 -0700 1.3 @@ -31,6 +31,48 @@ 1.4 uint ParallelTaskTerminator::_total_peeks = 0; 1.5 #endif 1.6 1.7 +#if TASKQUEUE_STATS 1.8 +const char * const TaskQueueStats::_names[last_stat_id] = { 1.9 + "qpush", "qpop", "qpop-s", "qattempt", "qsteal", "opush", "omax" 1.10 +}; 1.11 + 1.12 +void TaskQueueStats::print_header(unsigned int line, outputStream* const stream, 1.13 + unsigned int width) 1.14 +{ 1.15 + // Use a width w: 1 <= w <= max_width 1.16 + const unsigned int max_width = 40; 1.17 + const unsigned int w = MAX2(MIN2(width, max_width), 1U); 1.18 + 1.19 + if (line == 0) { // spaces equal in width to the header 1.20 + const unsigned int hdr_width = w * last_stat_id + last_stat_id - 1; 1.21 + stream->print("%*s", hdr_width, " "); 1.22 + } else if (line == 1) { // labels 1.23 + stream->print("%*s", w, _names[0]); 1.24 + for (unsigned int i = 1; i < last_stat_id; ++i) { 1.25 + stream->print(" %*s", w, _names[i]); 1.26 + } 1.27 + } else if (line == 2) { // dashed lines 1.28 + char dashes[max_width + 1]; 1.29 + memset(dashes, '-', w); 1.30 + dashes[w] = '\0'; 1.31 + stream->print("%s", dashes); 1.32 + for (unsigned int i = 1; i < last_stat_id; ++i) { 1.33 + stream->print(" %s", dashes); 1.34 + } 1.35 + } 1.36 +} 1.37 + 1.38 +void TaskQueueStats::print(outputStream* stream, unsigned int width) const 1.39 +{ 1.40 + #define FMT SIZE_FORMAT_W(*) 1.41 + stream->print(FMT, width, _stats[0]); 1.42 + for (unsigned int i = 1; i < last_stat_id; ++i) { 1.43 + stream->print(" " FMT, width, _stats[i]); 1.44 + } 1.45 + #undef FMT 1.46 +} 1.47 +#endif // TASKQUEUE_STATS 1.48 + 1.49 int TaskQueueSetSuper::randomParkAndMiller(int *seed0) { 1.50 const int a = 16807; 1.51 const int m = 2147483647;