Skip to content

Commit

Permalink
dcache-frontend: change transfer rate to compute what it advertised
Browse files Browse the repository at this point in the history
Motivation:

dcache-view currently displays MB/sec for transfer rate, but the
value is the old KB/sec.

Modification:

Make the auxiliary method on TransferInfo provide MB/sec, which
is more useful.  Retain KB/sec in old page by allowing
it to compute KB/sec there.

Result:

Pages display the values advertised.

Target: master
Patch: https://rb.dcache.org/r/12801
Acked-by: Dmitry
Request: 7.0
Request: 6.2
Request: 6.1
Request: 6.0
Request: 5.2
  • Loading branch information
alrossi committed Feb 2, 2021
1 parent 7d984a5 commit 8512696
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Expand Up @@ -600,11 +600,26 @@ private void createHtmlTableRow(HTMLBuilder page, TransferBean transfer) {
} else {
page.td("transferred", "-");
}
page.td("speed", transfer.getTransferRate());
page.td("speed", getTransferRate(transfer));
}
page.endRow();
}

private Long getTransferRate(TransferInfo info) {
Long bytes = info.getBytesTransferred();
if (bytes == null) {
return 0L;
}

Long time = info.getTransferTime();
if (time == null) {
return 0L;
}

long secs = time / 1000;
return secs > 0.0 ? BYTES.toKiB(bytes) / secs : 0L;
}

private String createHtmlTable(List<TransferBean> transfers) {
HTMLBuilder page = new HTMLBuilder(_nucleus.getDomainContext());

Expand Down
Expand Up @@ -241,7 +241,7 @@ public Long getTransferRate() {
}

long secs = transferTime / 1000;
return secs > 0.0 ? BYTES.toKiB(bytesTransferred) / secs : 0L;
return secs > 0.0 ? BYTES.toMiB(bytesTransferred) / secs : 0L;
}

public Long getTransferTime() {
Expand Down

0 comments on commit 8512696

Please sign in to comment.