diff --git a/pom.xml b/pom.xml index c4290f374..7a74bf11b 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ com.github.serceman,com.github.jnr,org.ow2.asm,net.java.dev.jna,org.apache.jackrabbit,org.apache.httpcomponents,de.swiesend,org.purejava,com.github.hypfvieh - 2.4.1 + 2.5.0-SNAPSHOT 1.1.0 1.1.0 1.1.0 diff --git a/src/main/java/org/cryptomator/common/vaults/VaultStats.java b/src/main/java/org/cryptomator/common/vaults/VaultStats.java index f5733fcd2..43346b763 100644 --- a/src/main/java/org/cryptomator/common/vaults/VaultStats.java +++ b/src/main/java/org/cryptomator/common/vaults/VaultStats.java @@ -34,16 +34,15 @@ public class VaultStats { private final LongProperty bytesPerSecondWritten = new SimpleLongProperty(); private final LongProperty bytesPerSecondEncrypted = new SimpleLongProperty(); private final LongProperty bytesPerSecondDecrypted = new SimpleLongProperty(); - private final LongProperty bytesPerSecondAccessed = new SimpleLongProperty(); private final DoubleProperty cacheHitRate = new SimpleDoubleProperty(); private final LongProperty totalBytesRead = new SimpleLongProperty(); private final LongProperty totalBytesWritten = new SimpleLongProperty(); private final LongProperty totalBytesEncrypted = new SimpleLongProperty(); private final LongProperty totalBytesDecrypted = new SimpleLongProperty(); - private final LongProperty totalBytesAccessed = new SimpleLongProperty(); private final LongProperty filesRead = new SimpleLongProperty(); private final LongProperty filesWritten = new SimpleLongProperty(); private final LongProperty filesAccessed = new SimpleLongProperty(); + private final LongProperty totalFilesAccessed = new SimpleLongProperty(); private final ObjectProperty lastActivity = new SimpleObjectProperty<>(); @Inject @@ -78,16 +77,15 @@ public class VaultStats { cacheHitRate.set(stats.map(this::getCacheHitRate).orElse(0.0)); bytesPerSecondDecrypted.set(stats.map(CryptoFileSystemStats::pollBytesDecrypted).orElse(0L)); bytesPerSecondEncrypted.set(stats.map(CryptoFileSystemStats::pollBytesEncrypted).orElse(0L)); - bytesPerSecondAccessed.set(stats.map(CryptoFileSystemStats::pollBytesAccessed).orElse(0L)); totalBytesRead.set(stats.map(CryptoFileSystemStats::pollTotalBytesRead).orElse(0L)); totalBytesWritten.set(stats.map(CryptoFileSystemStats::pollTotalBytesWritten).orElse(0L)); totalBytesEncrypted.set(stats.map(CryptoFileSystemStats::pollTotalBytesEncrypted).orElse(0L)); totalBytesDecrypted.set(stats.map(CryptoFileSystemStats::pollTotalBytesDecrypted).orElse(0L)); - totalBytesAccessed.set(stats.map(CryptoFileSystemStats::pollTotalBytesAccessed).orElse(0L)); var oldAccessCount = filesRead.get() + filesWritten.get(); filesRead.set(stats.map(CryptoFileSystemStats::pollAmountOfAccessesRead).orElse(0L)); filesWritten.set(stats.map(CryptoFileSystemStats::pollAmountOfAccessesWritten).orElse(0L)); filesAccessed.set(stats.map(CryptoFileSystemStats::pollAmountOfAccesses).orElse(0L)); + totalFilesAccessed.set(stats.map(CryptoFileSystemStats::pollTotalAmountOfAccesses).orElse(0L)); var newAccessCount = filesRead.get() + filesWritten.get(); // check for any I/O activity @@ -164,14 +162,6 @@ public class VaultStats { return bytesPerSecondDecrypted.get(); } - public LongProperty bytesPerSecondAccessedProperty() { - return bytesPerSecondAccessed; - } - - public long getBytesPerSecondAccessed(){ - return bytesPerSecondAccessed.get(); - } - public DoubleProperty cacheHitRateProperty() { return cacheHitRate; } public double getCacheHitRate() { @@ -194,10 +184,6 @@ public class VaultStats { public long getTotalBytesDecrypted() { return totalBytesDecrypted.get();} - public LongProperty getTotalBytesAccessedProperty() {return totalBytesAccessed;} - - public long getTotalBytesAccessed() { return totalBytesAccessed.get();} - public LongProperty filesRead() { return filesRead;} public long getFilesRead() { return filesRead.get();} @@ -211,6 +197,14 @@ public class VaultStats { public long getFilesAccessed() {return filesAccessed.get();} + public LongProperty totalFilesAccessed(){ + return totalFilesAccessed; + } + + public long getTotalFilesAccessed(){ + return totalFilesAccessed.get(); + } + public ObjectProperty lastActivityProperty() { return lastActivity; } diff --git a/src/main/java/org/cryptomator/ui/stats/VaultStatisticsController.java b/src/main/java/org/cryptomator/ui/stats/VaultStatisticsController.java index ef4963168..dd294a457 100644 --- a/src/main/java/org/cryptomator/ui/stats/VaultStatisticsController.java +++ b/src/main/java/org/cryptomator/ui/stats/VaultStatisticsController.java @@ -35,6 +35,7 @@ public class VaultStatisticsController implements FxController { private final VaultStats stats; private final Series readData; private final Series writeData; + private final Series accessData; private final Timeline ioAnimation; private final LongBinding bpsRead; private final LongBinding bpsWritten; @@ -45,20 +46,22 @@ public class VaultStatisticsController implements FxController { private final LongBinding totalBytesWritten; private final LongBinding totalBytesEncrypted; private final LongBinding totalBytesDecrypted; - private final LongBinding totalBytesAccessed; private final LongBinding filesRead; private final LongBinding filesWritten; private final LongBinding filesAccessed; + private final LongBinding totalFilesAccessed; private final LongBinding bpsEncrypted; private final LongBinding bpsDecrypted; - private final LongBinding bpsAccessed; public AreaChart readChart; public AreaChart writeChart; + public AreaChart accessChart; public NumberAxis readChartXAxis; public NumberAxis readChartYAxis; public NumberAxis writeChartXAxis; public NumberAxis writeChartYAxis; + public NumberAxis accessChartXAxis; + public NumberAxis accessChartYAxis; @Inject public VaultStatisticsController(VaultStatisticsComponent component, @VaultStatisticsWindow Stage window, @VaultStatisticsWindow Vault vault) { @@ -66,6 +69,7 @@ public class VaultStatisticsController implements FxController { this.stats = vault.getStats(); this.readData = new Series<>(); this.writeData = new Series<>(); + this.accessData = new Series<>(); this.bpsRead = WeakBindings.bindLong(stats.bytesPerSecondReadProperty()); this.bpsWritten = WeakBindings.bindLong(stats.bytesPerSecondWrittenProperty()); this.cacheHitRate = WeakBindings.bindDouble(stats.cacheHitRateProperty()); @@ -75,16 +79,15 @@ public class VaultStatisticsController implements FxController { this.totalBytesWritten = WeakBindings.bindLong(stats.totalBytesWrittenProperty()); this.totalBytesDecrypted = WeakBindings.bindLong(stats.totalBytesDecryptedProperty()); this.totalBytesEncrypted = WeakBindings.bindLong(stats.totalBytesEncryptedProperty()); - this.totalBytesAccessed = WeakBindings.bindLong(stats.getTotalBytesAccessedProperty()); this.filesRead = WeakBindings.bindLong(stats.filesRead()); this.filesWritten = WeakBindings.bindLong(stats.filesWritten()); this.filesAccessed = WeakBindings.bindLong(stats.filesAccessed()); + this.totalFilesAccessed = WeakBindings.bindLong(stats.totalFilesAccessed()); this.bpsEncrypted = WeakBindings.bindLong(stats.bytesPerSecondEncryptedProperty()); this.bpsDecrypted = WeakBindings.bindLong(stats.bytesPerSecondDecryptedProperty()); - this.bpsAccessed = WeakBindings.bindLong(stats.bytesPerSecondAccessedProperty()); this.ioAnimation = new Timeline(); //TODO Research better timer - ioAnimation.getKeyFrames().add(new KeyFrame(Duration.seconds(IO_SAMPLING_INTERVAL), new IoSamplingAnimationHandler(readData, writeData))); + ioAnimation.getKeyFrames().add(new KeyFrame(Duration.seconds(IO_SAMPLING_INTERVAL), new IoSamplingAnimationHandler(readData, writeData, accessData))); ioAnimation.setCycleCount(Animation.INDEFINITE); ioAnimation.play(); @@ -98,6 +101,7 @@ public class VaultStatisticsController implements FxController { public void initialize() { readChart.getData().addAll(readData); writeChart.getData().addAll(writeData); + accessChart.getData().addAll(accessData); } private class IoSamplingAnimationHandler implements EventHandler { @@ -105,16 +109,21 @@ public class VaultStatisticsController implements FxController { private long step = IO_SAMPLING_STEPS; private final Series decryptedBytesRead; private final Series encryptedBytesWrite; + private final Series accessedFiles; private final long[] maxBuf = new long[IO_SAMPLING_STEPS]; + private final long[] maxAccessBuf = new long[IO_SAMPLING_STEPS]; - public IoSamplingAnimationHandler(Series readData, Series writeData) { + + public IoSamplingAnimationHandler(Series readData, Series writeData, Series accessData) { this.decryptedBytesRead = readData; this.encryptedBytesWrite = writeData; + this.accessedFiles = accessData; // initialize data once and change value of data points later: for (int i = 0; i < IO_SAMPLING_STEPS; i++) { decryptedBytesRead.getData().add(new Data<>(i, 0)); encryptedBytesWrite.getData().add(new Data<>(i, 0)); + accessedFiles.getData().add(new Data<>(i, 0)); } } @@ -123,17 +132,22 @@ public class VaultStatisticsController implements FxController { final long currentStep = step++; final long decBytes = stats.bytesPerSecondReadProperty().get(); final long encBytes = stats.bytesPerSecondWrittenProperty().get(); + final long accFiles = stats.filesAccessed().get(); maxBuf[(int) currentStep % IO_SAMPLING_STEPS] = Math.max(decBytes, encBytes); - long allTimeMax = Arrays.stream(maxBuf).max().orElse(0l); + long allTimeMax = Arrays.stream(maxBuf).max().orElse(0L); + maxAccessBuf[(int) currentStep % IO_SAMPLING_STEPS] = accFiles; + long allTimeMaxAccessedFiles = Arrays.stream(maxAccessBuf).max().orElse(0L); // remove oldest value: decryptedBytesRead.getData().remove(0); encryptedBytesWrite.getData().remove(0); + accessedFiles.getData().remove(0); // add latest value: decryptedBytesRead.getData().add(new Data<>(currentStep, decBytes)); encryptedBytesWrite.getData().add(new Data<>(currentStep, encBytes)); + accessedFiles.getData().add(new Data<>(currentStep, accFiles)); // adjust ranges: readChartXAxis.setLowerBound(currentStep - IO_SAMPLING_STEPS * 1.0); @@ -142,6 +156,9 @@ public class VaultStatisticsController implements FxController { writeChartXAxis.setLowerBound(currentStep - IO_SAMPLING_STEPS * 1.0); writeChartXAxis.setUpperBound(currentStep); writeChartYAxis.setUpperBound(allTimeMax); + accessChartXAxis.setLowerBound(currentStep - IO_SAMPLING_STEPS * 1.0); + accessChartXAxis.setUpperBound(currentStep); + accessChartYAxis.setUpperBound(allTimeMaxAccessedFiles); } } @@ -193,10 +210,6 @@ public class VaultStatisticsController implements FxController { public long getTotalBytesDecrypted() { return totalBytesDecrypted.get();} - public LongBinding getTotalBytesAccessedProperty() {return totalBytesAccessed;} - - public long getTotalBytesAccessed() { return totalBytesAccessed.get();} - public LongBinding bpsEncryptedProperty() { return bpsEncrypted; } @@ -213,12 +226,6 @@ public class VaultStatisticsController implements FxController { return bpsDecrypted.get(); } - public LongBinding bpsAccessedProperty() { - return bpsAccessed; - } - - public long getBpsAccessed(){ return bpsAccessed.get();} - public LongBinding filesReadProperty() { return filesRead;} public long getFilesRead() { return filesRead.get();} @@ -230,4 +237,8 @@ public class VaultStatisticsController implements FxController { public LongBinding filesAccessedProperty() {return filesAccessed;} public long getFilesAccessed() {return filesAccessed.get();} + + public LongBinding totalFilesAccessedProperty() {return totalFilesAccessed;} + + public long getTotalFilesAccessed() {return totalFilesAccessed.get();} } diff --git a/src/main/resources/fxml/stats.fxml b/src/main/resources/fxml/stats.fxml index 6d7cc8291..458eeedf8 100644 --- a/src/main/resources/fxml/stats.fxml +++ b/src/main/resources/fxml/stats.fxml @@ -74,19 +74,22 @@ - + - + - + + + + diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 80f1449bf..41baf4efe 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -263,7 +263,8 @@ stats.encr.total.data.gib=Data encrypted: %.1f GiB stats.write.accessCount=Total writes: %d ## Accesses -stats.access.accessCount=Total accessed: %d +stats.access.totalAccessCount=Total accessed: %d +stats.access.accessCount=Currently accessed: %d # Main Window