use of com.ms.silverking.time.Stopwatch in project SilverKing by Morgan-Stanley.
the class MessageGroupTest method runQueueingConnectionTestClient.
private void runQueueingConnectionTestClient(double durationSeconds) throws IOException {
MessageGroup msg;
Stopwatch sw;
Stopwatch displaySW;
// msg = createMessage(NumConversion.intToBytes(index));
sw = new SimpleStopwatch();
displaySW = new SimpleStopwatch();
do {
msg = createMessage(NumConversion.intToBytes(clientPort));
// System.out.println("Sending");
messagesSent.incrementAndGet();
paServer.send(serverAddr, msg, false, Long.MAX_VALUE);
try {
semaphore.acquire();
} catch (InterruptedException ie) {
}
// rewindBuffers(msg);
if (displaySW.getSplitSeconds() > displayIntervalSeconds) {
displayStats(sw.getSplitSeconds());
displaySW.reset();
}
} while (sw.getSplitSeconds() < durationSeconds);
sw.stop();
displayStats(sw.getElapsedSeconds());
}
use of com.ms.silverking.time.Stopwatch in project SilverKing by Morgan-Stanley.
the class JVMMonitor method run.
public void run() {
Stopwatch displaySW;
ThreadUtil.randomSleep(minUpdateIntervalMillis);
finalizationSW.reset();
displaySW = new SimpleStopwatch();
while (running) {
try {
monitor();
if (display) {
boolean displayTriggered;
displayTriggered = false;
if (displaySW.getSplitMillis() > maxUpdateIntervalMillis) {
displayTriggered = true;
}
if (deltaTriggered) {
displayTriggered = true;
}
if (displayTriggered) {
deltaTriggered = false;
displaySW.reset();
displayStatus();
}
}
ThreadUtil.sleep(minUpdateIntervalMillis);
} catch (Exception e) {
Log.logErrorSevere(e, "JVMMonitor", "run");
ThreadUtil.pauseAfterException();
}
}
}
Aggregations