Skip to content

Commit 834732c

Browse files
chore(benchmarking): Fix throughput conversion issue and report metrics in seconds (#2211)
* chore(benchmarking): Fix throughput conversion issue and report metrics in seconds * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 7401f21 commit 834732c

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

storage-shared-benchmarking/src/main/java/com/google/cloud/storage/benchmarking/StorageSharedBenchmarkingUtils.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ public static void cleanupObject(Storage storage, Blob created) {
2828
created.getBlobId(), Storage.BlobSourceOption.generationMatch(created.getGeneration()));
2929
}
3030

31-
public static double calculateThroughput(long size, Duration elapsedTime) {
32-
return size >= StorageSharedBenchmarkingUtils.SSB_SIZE_THRESHOLD_BYTES
33-
? size / 1024 / 1024 / (elapsedTime.toNanos())
34-
: size / 1024 / (elapsedTime.toNanos());
31+
public static double calculateThroughput(double size, Duration elapsedTime) {
32+
double adjustedSize =
33+
size >= StorageSharedBenchmarkingUtils.SSB_SIZE_THRESHOLD_BYTES
34+
? (size / 1024D) / 1024D
35+
: size / 1024D;
36+
double throughput = adjustedSize / (elapsedTime.toMillis() / 1000D);
37+
return throughput;
3538
}
3639
}

storage-shared-benchmarking/src/main/java/com/google/cloud/storage/benchmarking/W1R3.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ final class W1R3 implements Callable<String> {
5858
@Override
5959
public String call() throws Exception {
6060
// Create the file to be uploaded and fill it with data
61+
6162
try (TmpFile file = DataGenerator.base64Characters().tempFile(tempDirectory, objectSize)) {
6263
BlobInfo blob = BlobInfo.newBuilder(bucketName, file.toString()).build();
63-
6464
// Get the start time
6565
Clock clock = Clock.systemDefaultZone();
6666
Instant startTime = clock.instant();
@@ -71,7 +71,7 @@ public String call() throws Exception {
7171
generateCloudMonitoringResult(
7272
"WRITE",
7373
StorageSharedBenchmarkingUtils.calculateThroughput(
74-
created.getSize().longValue(), elapsedTimeUpload),
74+
created.getSize().doubleValue(), elapsedTimeUpload),
7575
created)
7676
.formatAsCustomMetric());
7777
for (int i = 0; i <= StorageSharedBenchmarkingUtils.DEFAULT_NUMBER_OF_READS; i++) {
@@ -84,7 +84,7 @@ public String call() throws Exception {
8484
generateCloudMonitoringResult(
8585
"READ[" + i + "]",
8686
StorageSharedBenchmarkingUtils.calculateThroughput(
87-
created.getSize().longValue(), elapsedTimeDownload),
87+
created.getSize().doubleValue(), elapsedTimeDownload),
8888
created)
8989
.formatAsCustomMetric());
9090
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy