publicclass Main { publicstaticvoid main(String[] args) throws Exception { for (int p = Thread.MIN_PRIORITY; p <= Thread.MAX_PRIORITY; ++p) { int niceness = Thread.nicenessForPriority(p); if (p > Thread.MIN_PRIORITY && Thread.nicenessForPriority(p - 1) <= niceness) { thrownew Error("Niceness not monotonic at " + p);
} int mapped_p = Thread.priorityForNiceness(Thread.nicenessForPriority(p)); if (mapped_p != p) { thrownew Error(p + " mapped to: " + Thread.nicenessForPriority(p) + " which mapped back to " + mapped_p);
}
} Thread self = Thread.currentThread();
VMRuntime vmrt = VMRuntime.getRuntime(); for (int p = Thread.MIN_PRIORITY; p <= Thread.MAX_PRIORITY; ++p) {
self.setPriority(p); int result = self.getPriority(); if (result != p) {
System.out.println("Set priority to " + p + " but got " + result);
} int niceness_result = vmrt.getThreadNiceness(self); if (niceness_result != Thread.nicenessForPriority(p)) {
System.out.println("Set priority to " + p
+ " but got niceness " + niceness_result);
}
} for (int n = -20; n <= 19; ++n) {
vmrt.setThreadNiceness(self, n); int result = vmrt.getThreadNiceness(self); if (result != n) {
System.out.println("Set niceness to " + n + " but got " + result);
}
}
System.out.println("Done");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.