mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
6962947: shared TaskQueue statistics
Reviewed-by: tonyp, ysr
This commit is contained in:
parent
4efdcb87d1
commit
daf491a814
11 changed files with 236 additions and 137 deletions
|
@ -31,6 +31,48 @@ uint ParallelTaskTerminator::_total_spins = 0;
|
|||
uint ParallelTaskTerminator::_total_peeks = 0;
|
||||
#endif
|
||||
|
||||
#if TASKQUEUE_STATS
|
||||
const char * const TaskQueueStats::_names[last_stat_id] = {
|
||||
"qpush", "qpop", "qpop-s", "qattempt", "qsteal", "opush", "omax"
|
||||
};
|
||||
|
||||
void TaskQueueStats::print_header(unsigned int line, outputStream* const stream,
|
||||
unsigned int width)
|
||||
{
|
||||
// Use a width w: 1 <= w <= max_width
|
||||
const unsigned int max_width = 40;
|
||||
const unsigned int w = MAX2(MIN2(width, max_width), 1U);
|
||||
|
||||
if (line == 0) { // spaces equal in width to the header
|
||||
const unsigned int hdr_width = w * last_stat_id + last_stat_id - 1;
|
||||
stream->print("%*s", hdr_width, " ");
|
||||
} else if (line == 1) { // labels
|
||||
stream->print("%*s", w, _names[0]);
|
||||
for (unsigned int i = 1; i < last_stat_id; ++i) {
|
||||
stream->print(" %*s", w, _names[i]);
|
||||
}
|
||||
} else if (line == 2) { // dashed lines
|
||||
char dashes[max_width + 1];
|
||||
memset(dashes, '-', w);
|
||||
dashes[w] = '\0';
|
||||
stream->print("%s", dashes);
|
||||
for (unsigned int i = 1; i < last_stat_id; ++i) {
|
||||
stream->print(" %s", dashes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TaskQueueStats::print(outputStream* stream, unsigned int width) const
|
||||
{
|
||||
#define FMT SIZE_FORMAT_W(*)
|
||||
stream->print(FMT, width, _stats[0]);
|
||||
for (unsigned int i = 1; i < last_stat_id; ++i) {
|
||||
stream->print(" " FMT, width, _stats[i]);
|
||||
}
|
||||
#undef FMT
|
||||
}
|
||||
#endif // TASKQUEUE_STATS
|
||||
|
||||
int TaskQueueSetSuper::randomParkAndMiller(int *seed0) {
|
||||
const int a = 16807;
|
||||
const int m = 2147483647;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue