Feature: add session data consumption information in GUI/text UIs (#287)

* Feature: add session data consumption information in GUI/text UIs

Adds the total bytes downloaded and uploaded in the current session as well as the average data transfer rate for both UL/DL. The information is not added to the 1-line UI as the line will take 150+ characters in the screen.
This commit is contained in:
Luis Uguina
2020-09-12 10:00:24 +10:00
committed by GitHub
parent 4fa886c4de
commit d152e0b0ff
9 changed files with 126 additions and 10 deletions

View File

@@ -23,6 +23,7 @@ import com.sheepit.client.Client;
import com.sheepit.client.Gui;
import com.sheepit.client.Log;
import com.sheepit.client.Stats;
import com.sheepit.client.TransferStats;
import com.sheepit.client.standalone.text.CLIInputActionHandler;
import com.sheepit.client.standalone.text.CLIInputObserver;
@@ -132,6 +133,12 @@ public class GuiText implements Gui {
System.out.println(String.format("%s Frames rendered: %d", this.df.format(new Date()), this.framesRendered));
}
@Override public synchronized void displayTransferStats(TransferStats downloads, TransferStats uploads) {
System.out.println(String
.format("%s Session downloads: %s @ %s/s / Uploads: %s @ %s/s", this.df.format(new Date()), downloads.getSessionTraffic(),
downloads.getAverageSessionSpeed(), uploads.getSessionTraffic(), uploads.getAverageSessionSpeed()));
}
@Override public void displayStats(Stats stats) {
System.out.println(String.format("%s Frames remaining: %d", this.df.format(new Date()), stats.getRemainingFrame()));
System.out.println(String.format("%s Credits earned: %d", this.df.format(new Date()), stats.getCreditsEarnedDuringSession()));