in Extremem/src/main/java/com/amazon/corretto/benchmark/extremem/Configuration.java [498:601]
void doTimeArg(ExtrememThread t,
int index, String keyword, String timeString) {
MemoryLog log = t.memoryLog();
MemoryLog garbage = t.garbageLog();
long u = 0;
int i;
for (i = 0;
i < timeString.length() && Character.isDigit(timeString.charAt(i));
i++) {
char c = timeString.charAt(i);
if (!Character.isDigit(c))
usage("Unexpected character in time encoding");
u = u * 10 + Character.digit(c, 10);
}
char unit_selector = '$';
if (i + 1 == timeString.length())
unit_selector = timeString.charAt(i);
else if ((i + 2 == timeString.length()) &&
(timeString.charAt(i) == 'm') && (timeString.charAt(i+1) == 's'))
unit_selector = '@';
switch (unit_selector) {
case 'd':
u *= 24; // convert days to hours
case 'h':
u *= 60; // convert hours to minutes
case 'm':
u *= 60; // convert minutes to seconds
case 's':
u *= 1000; // convert seconds to ms
case '@':
break;
case '$':
default:
usage("Time suffix must be ms, s, m, h, or d");
}
long secs;
int nanos;
secs = u / 1000;
nanos = ((int) (u % 1000)) * 1000000;
switch (index) {
case 0:
if (keyword.equals("BrowsingExpiration")) {
BrowsingExpiration.garbageFootprint(t);
BrowsingExpiration = new RelativeTime(t, secs, nanos);
BrowsingExpiration.changeLifeSpan(t, LifeSpan.NearlyForever);
break;
}
case 1:
if (keyword.equals("CustomerPeriod")) {
CustomerPeriod.garbageFootprint(t);
CustomerPeriod = new RelativeTime(t, secs, nanos);
CustomerPeriod.changeLifeSpan(t, LifeSpan.NearlyForever);
break;
}
case 2:
if (keyword.equals("CustomerReplacementPeriod")) {
CustomerReplacementPeriod.garbageFootprint(t);
CustomerReplacementPeriod = new RelativeTime(t, secs, nanos);
CustomerReplacementPeriod.changeLifeSpan(t, LifeSpan.NearlyForever);
break;
}
case 3:
if (keyword.equals("CustomerThinkTime")) {
CustomerThinkTime.garbageFootprint(t);
CustomerThinkTime = new RelativeTime(t, secs, nanos);
CustomerThinkTime.changeLifeSpan(t, LifeSpan.NearlyForever);
break;
}
case 4:
if (keyword.equals("InitializationDelay")) {
InitializationDelay.garbageFootprint(t);
InitializationDelay = new RelativeTime(t, secs, nanos);
InitializationDelay.changeLifeSpan(t, LifeSpan.NearlyForever);
break;
}
case 5:
if (keyword.equals("ProductReplacementPeriod")) {
ProductReplacementPeriod.garbageFootprint(t);
ProductReplacementPeriod = new RelativeTime(t, secs, nanos);
ProductReplacementPeriod.changeLifeSpan(t, LifeSpan.NearlyForever);
break;
}
case 6:
if (keyword.equals("ServerPeriod")) {
ServerPeriod.garbageFootprint(t);
ServerPeriod = new RelativeTime(t, secs, nanos);
ServerPeriod.changeLifeSpan(t, LifeSpan.NearlyForever);
break;
}
case 7:
if (keyword.equals("SimulationDuration")) {
SimulationDuration.garbageFootprint(t);
SimulationDuration = new RelativeTime(t, secs, nanos);
SimulationDuration.changeLifeSpan(t, LifeSpan.NearlyForever);
break;
}
default:
usage("Unexpected internal error in doTimeArg");
}
}