Using new methods from CryptoFs to get correct statistics

This commit is contained in:
Martin Beyer
2020-07-21 11:10:05 +02:00
parent ed9f16e012
commit 158677bd54
4 changed files with 34 additions and 20 deletions

View File

@@ -37,8 +37,8 @@ public class VaultStats {
private final LongProperty toalBytesWritten = new SimpleLongProperty();
private final LongProperty totalBytesEncrypted = new SimpleLongProperty();
private final LongProperty totalBytesDecrypted = new SimpleLongProperty();
//private final IntegerProperty filesRead = new SimpleIntegerProperty();
//private final IntegerProperty filesWritten = new SimpleIntegerProperty();
private final LongProperty filesRead = new SimpleLongProperty();
private final LongProperty filesWritten = new SimpleLongProperty();
@Inject
VaultStats(AtomicReference<CryptoFileSystem> fs, ObjectProperty<VaultState> state, ExecutorService executor) {
@@ -69,10 +69,12 @@ 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));
toalBytesRead.set(stats.map(CryptoFileSystemStats::pollBytesRead).orElse(0l) + toalBytesRead.get());
toalBytesWritten.set(stats.map(CryptoFileSystemStats::pollBytesWritten).orElse(0l) + toalBytesWritten.get());
totalBytesEncrypted.set(stats.map(CryptoFileSystemStats::pollBytesEncrypted).orElse(0l) + totalBytesEncrypted.get());
totalBytesDecrypted.set(stats.map(CryptoFileSystemStats::pollBytesDecrypted).orElse(0l) + totalBytesDecrypted.get());
toalBytesRead.set(stats.map(CryptoFileSystemStats::pollTotalBytesRead).orElse(0l));
toalBytesWritten.set(stats.map(CryptoFileSystemStats::pollTotalBytesWritten).orElse(0l));
totalBytesEncrypted.set(stats.map(CryptoFileSystemStats::pollTotalBytesEncrypted).orElse(0l));
totalBytesDecrypted.set(stats.map(CryptoFileSystemStats::pollTotalBytesDecrypted).orElse(0l));
filesRead.set(stats.map(CryptoFileSystemStats::pollAmountOfFilesRead).orElse(0l));
filesWritten.set(stats.map(CryptoFileSystemStats::pollAmountOfFilesWritten).orElse(0l));
}
@@ -140,9 +142,7 @@ public class VaultStats {
return bytesPerSecondDecrypted.get();
}
public DoubleProperty cacheHitRateProperty() {
return cacheHitRate;
}
public DoubleProperty cacheHitRateProperty() { return cacheHitRate; }
public double getCacheHitRate() {
return cacheHitRate.get();
@@ -164,5 +164,11 @@ public class VaultStats {
public long getTotalBytesDecrypted() { return totalBytesDecrypted.get();}
public LongProperty filesRead() { return filesRead;}
public long getFilesRead() { return filesRead.get();}
public LongProperty filesWritten() {return filesWritten;}
public long getFilesWritten() {return filesWritten.get();}
}

View File

@@ -43,8 +43,8 @@ public class VaultStatisticsController implements FxController {
private final LongBinding totalBytesWritten;
private final LongBinding totalBytesEncrypted;
private final LongBinding totalBytesDecrypted;
/*private final IntegerBinding filesRead;
private final IntegerBinding filesWritten;*/
private final LongBinding filesRead;
private final LongBinding filesWritten;
private final LongBinding bpsEncrypted;
private final LongBinding bpsDecrypted;
@@ -69,8 +69,8 @@ public class VaultStatisticsController implements FxController {
this.totalBytesWritten = WeakBindings.bindLong(stats.toalBytesWrittenProperty());
this.totalBytesDecrypted = WeakBindings.bindLong(stats.totalBytesDecryptedProperty());
this.totalBytesEncrypted = WeakBindings.bindLong(stats.totalBytesEncryptedProperty());
/*this.filesRead = WeakBindings.bindInterger();
this.filesWritten = WeakBindings.bindInterger();*/
this.filesRead = WeakBindings.bindLong(stats.filesRead());
this.filesWritten = WeakBindings.bindLong(stats.filesWritten());
this.bpsEncrypted = WeakBindings.bindLong(stats.bytesPerSecondEncryptedProperty());
this.bpsDecrypted = WeakBindings.bindLong(stats.bytesPerSecondDecryptedProperty());
@@ -202,4 +202,12 @@ public class VaultStatisticsController implements FxController {
public long getBpsDecrypted() {
return bpsDecrypted.get();
}
public LongBinding filesReadProperty() { return filesRead;}
public long getFilesRead() { return filesRead.get();}
public LongBinding filesWrittenProperty() {return filesWritten;}
public long getFilesWritten() {return filesWritten.get();}
}

View File

@@ -61,15 +61,13 @@
</HBox>
<HBox alignment="CENTER">
<Label styleClass="label-large" text="%stats.totalMiBDecrypted"/>
<DataLabel styleClass="label-large" alignment="CENTER_RIGHT" minWidth="60" byteFormat="%stats.data.bytes" kibFormat="%stats.data.kiB" mibFormat="%stats.data.miB" gibFormat="%stats.data.giB"
<DataLabel styleClass="label-large" alignment="CENTER_RIGHT" minWidth="60" byteFormat="%stats.data.bytes" kibFormat="%stats.data.kiB" mibFormat="%stats.data.miB" gibFormat="%stats.data.giB"
dataInBytes="${controller.totalBytesDecrypted}"/>
</HBox>
<FormattedLabel styleClass="label-large" alignment="CENTER_RIGHT" minWidth="60" format="%stats.totalReads" arg1="${controller.filesRead}"/>
<!--
<FormattedLabel styleClass="label-large" alignment="CENTER_RIGHT" minWidth="60" format="%stats.totalMiBRead" arg1="${controller.totalBytesRead}"/>
<FormattedLabel styleClass="label-large" alignment="CENTER_RIGHT" minWidth="60" format="%stats.totalMiBDecrypted" arg1="${controller.totalBytesDecrypted}"/>
-->
</VBox>
</VBox>
<!-- Write -->
@@ -101,6 +99,8 @@
<DataLabel styleClass="label-large" alignment="CENTER_RIGHT" minWidth="60" byteFormat="%stats.data.bytes" kibFormat="%stats.data.kiB" mibFormat="%stats.data.miB" gibFormat="%stats.data.giB"
dataInBytes="${controller.totalBytesEncrypted}"/>
</HBox>
<FormattedLabel styleClass="label-large" alignment="CENTER_RIGHT" minWidth="60" format="%stats.totalWrites" arg1="${controller.filesWritten}"/>
</VBox>
</VBox>

View File

@@ -169,8 +169,8 @@ stats.totalMiBRead=Total Read:
stats.totalMiBWritten=Total Written:
stats.totalMiBEncrypted=Total Encypted:
stats.totalMiBDecrypted=Total Decrypted:
stats.totalReads=Number of Reads: %s
stats.totalWrites=Number of Writes: %s
stats.totalReads=%s Files Read
stats.totalWrites=%s Files Written
stats.data.bytes=%s Bytes
stats.data.kiB=%.1f KiB
stats.data.miB=%.1f MiB