in src/main/java/org/adoptopenjdk/jitwatch/ui/nmethod/compilerthread/CompilerThreadPanel.java [320:410]
private void plotQueueLengths(Graphics2D g, CompilerThread thread, double y, double rowHeight)
{
List<QueueCounter> counters = getQueueCounters(thread);
long lastTimestamp = -1;
plotThreadHeader(g, thread, y, rowHeight); // Draw thread header
List<Compilation> liveQueue = new LinkedList<>();
double oneHeight = (1.0 / maxQueueLength) * rowHeight;
oneHeight = Math.min(oneHeight, rowHeight / 20);
IMetaMember selectedMember = parent.getSelectedMember();
Compilation selectedCompilation = (selectedMember == null) ? null : selectedMember.getSelectedCompilation();
int stringHeight = g.getFontMetrics().getHeight();
for (QueueCounter counter : counters)
{
long timestamp = counter.getTimestamp();
int queueLength = liveQueue.size();
if (lastTimestamp != -1)
{
double x1 = getScaledTimestampX(lastTimestamp);
double x2 = getScaledTimestampX(timestamp);
double baseLine = y + rowHeight / 2;
boolean compilationMemberInQueue = false;
for (int i = 0; i < queueLength; i++)
{
Compilation compilation = liveQueue.get(i);
double startY = baseLine - (i + 1) * oneHeight;
double rectWidth = x2 - x1;
g.setColor(Color.WHITE);
if (compilation.getMember().equals(selectedMember))
{
g.setColor(new Color(0, 220, 255)); // COLOR_SELECTED_COMPILATION
compilationMemberInQueue = true;
}
int ix = (int) Math.round(x1);
int iy = (int) Math.round(startY);
int iw = (int) Math.ceil(rectWidth);
int ih = (int) Math.round(oneHeight);
g.fillRect(ix, iy, iw, ih);
//if (rectWidth > 4)
{
g.drawRect(ix, iy, iw, ih);
}
addMouseListenerForCompilation(ix, iy, iw, ih, compilation);
}
float labelX = (float) getXOffset() + 4;
float labelY = (float) (baseLine - rowHeight + stringHeight / 2 + 4);
String label = String.valueOf(maxQueueLength);
FontMetrics fm = g.getFontMetrics();
int textWidth = fm.stringWidth(label);
int textHeight = fm.getAscent();
g.setColor(Color.BLACK);
g.fillRect(Math.round(labelX), Math.round(labelY - textHeight), textWidth, textHeight);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.YELLOW);
g.drawString(label, labelX, labelY);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
if (compilationMemberInQueue)
{
plotMarker(g, x1, y - rowHeight / 2, selectedCompilation, true);
}
}
Compilation compilation = counter.getCompilation();
if (counter.isAdd())
{
liveQueue.add(compilation);
}
else
{
liveQueue.remove(compilation);
}
lastTimestamp = timestamp;
}
}