Calculate effective duration and tps;

git-svn-id: svn://home0/lm-lib@3652 71dcc7fd-b1f2-4e5d-bb8e-274146e81173
This commit is contained in:
(no author)
2024-12-22 12:34:07 +00:00
parent 63087a1cd6
commit cb2c1c02da
2 changed files with 16 additions and 6 deletions

View File

@@ -36,16 +36,16 @@ public final class AgentRequestStatistic {
return this.requestDuration;
}
public Duration getAbsoluteDuration() {
public Duration getEffectiveDuration() {
return Duration.between(this.start, Instant.now());
}
public String getTps() {
return new DecimalFormat("#.##").format((double) (this.inTokens.get() + this.outTokens.get()) / (double)this.getAbsoluteDuration().toMillis() * 1000.0);
return new DecimalFormat("#.##").format((double) (this.inTokens.get() + this.outTokens.get()) / (double)this.getEffectiveDuration().toMillis() * 1000.0);
}
public String getOutTps() {
return new DecimalFormat("#.##").format((double) this.outTokens.get() / (double)this.getAbsoluteDuration().toMillis() * 1000.0);
return new DecimalFormat("#.##").format((double) this.outTokens.get() / (double)this.getEffectiveDuration().toMillis() * 1000.0);
}
public void add(final Completion completion) {
@@ -70,8 +70,8 @@ public final class AgentRequestStatistic {
builder.append(this.outTokens);
builder.append(", requestDuration=");
builder.append(this.requestDuration);
builder.append(", getAbsoluteDuration()=");
builder.append(this.getAbsoluteDuration());
builder.append(", getEffectiveDuration()=");
builder.append(this.getEffectiveDuration());
builder.append(", getTps()=");
builder.append(this.getTps());
builder.append(", getOutTps()=");