Mercurial > hg > truffle
comparison src/share/vm/utilities/taskqueue.cpp @ 1665:a93a9eda13f7
6962947: shared TaskQueue statistics
Reviewed-by: tonyp, ysr
author | jcoomes |
---|---|
date | Fri, 16 Jul 2010 21:33:21 -0700 |
parents | b2a00dd3117c |
children | 5f429ee79634 |
comparison
equal
deleted
inserted
replaced
1657:1a1ce2076047 | 1665:a93a9eda13f7 |
---|---|
28 #ifdef TRACESPINNING | 28 #ifdef TRACESPINNING |
29 uint ParallelTaskTerminator::_total_yields = 0; | 29 uint ParallelTaskTerminator::_total_yields = 0; |
30 uint ParallelTaskTerminator::_total_spins = 0; | 30 uint ParallelTaskTerminator::_total_spins = 0; |
31 uint ParallelTaskTerminator::_total_peeks = 0; | 31 uint ParallelTaskTerminator::_total_peeks = 0; |
32 #endif | 32 #endif |
33 | |
34 #if TASKQUEUE_STATS | |
35 const char * const TaskQueueStats::_names[last_stat_id] = { | |
36 "qpush", "qpop", "qpop-s", "qattempt", "qsteal", "opush", "omax" | |
37 }; | |
38 | |
39 void TaskQueueStats::print_header(unsigned int line, outputStream* const stream, | |
40 unsigned int width) | |
41 { | |
42 // Use a width w: 1 <= w <= max_width | |
43 const unsigned int max_width = 40; | |
44 const unsigned int w = MAX2(MIN2(width, max_width), 1U); | |
45 | |
46 if (line == 0) { // spaces equal in width to the header | |
47 const unsigned int hdr_width = w * last_stat_id + last_stat_id - 1; | |
48 stream->print("%*s", hdr_width, " "); | |
49 } else if (line == 1) { // labels | |
50 stream->print("%*s", w, _names[0]); | |
51 for (unsigned int i = 1; i < last_stat_id; ++i) { | |
52 stream->print(" %*s", w, _names[i]); | |
53 } | |
54 } else if (line == 2) { // dashed lines | |
55 char dashes[max_width + 1]; | |
56 memset(dashes, '-', w); | |
57 dashes[w] = '\0'; | |
58 stream->print("%s", dashes); | |
59 for (unsigned int i = 1; i < last_stat_id; ++i) { | |
60 stream->print(" %s", dashes); | |
61 } | |
62 } | |
63 } | |
64 | |
65 void TaskQueueStats::print(outputStream* stream, unsigned int width) const | |
66 { | |
67 #define FMT SIZE_FORMAT_W(*) | |
68 stream->print(FMT, width, _stats[0]); | |
69 for (unsigned int i = 1; i < last_stat_id; ++i) { | |
70 stream->print(" " FMT, width, _stats[i]); | |
71 } | |
72 #undef FMT | |
73 } | |
74 #endif // TASKQUEUE_STATS | |
33 | 75 |
34 int TaskQueueSetSuper::randomParkAndMiller(int *seed0) { | 76 int TaskQueueSetSuper::randomParkAndMiller(int *seed0) { |
35 const int a = 16807; | 77 const int a = 16807; |
36 const int m = 2147483647; | 78 const int m = 2147483647; |
37 const int q = 127773; /* m div a */ | 79 const int q = 127773; /* m div a */ |