Added artifact download traffic statistics.

Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-07-05 17:41:08 +02:00
parent eff798393d
commit 227b93c527
16 changed files with 147 additions and 36 deletions

View File

@@ -293,6 +293,7 @@ public final class RestResourceConversionHelper {
long toRead = length;
boolean toContinue = true;
long shippedSinceLastEvent = 0;
while (toContinue) {
final int r = from.read(buf);
@@ -304,9 +305,11 @@ public final class RestResourceConversionHelper {
if (toRead > 0) {
to.write(buf, 0, r);
total += r;
shippedSinceLastEvent += r;
} else {
to.write(buf, 0, (int) toRead + r);
total += toRead + r;
shippedSinceLastEvent += toRead + r;
toContinue = false;
}
@@ -316,7 +319,8 @@ public final class RestResourceConversionHelper {
// every 10 percent an event
if (newPercent == 100 || newPercent > progressPercent + 10) {
progressPercent = newPercent;
controllerManagement.downloadProgressPercent(statusId, progressPercent);
controllerManagement.downloadProgressPercent(statusId, progressPercent, shippedSinceLastEvent);
shippedSinceLastEvent = 0;
}
}
}