forked from valkey-io/valkey-glide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yury-Fridlyand <[email protected]>
- Loading branch information
1 parent
9817802
commit 94441e2
Showing
4 changed files
with
95 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
java/jabushka/benchmarks/src/main/java/javabushka/client/utils/Reporting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package javabushka.client.utils; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
import com.google.gson.reflect.TypeToken; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.Map; | ||
import lombok.Getter; | ||
|
||
public class Reporting { | ||
|
||
public static void WriteJson( | ||
Map<ChosenAction, LatencyResults> calculatedResults, String resultsFile) throws IOException { | ||
|
||
Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().create(); | ||
Collection<Measurements> recordings = new ArrayList<>(); | ||
|
||
Path path = Path.of(resultsFile); | ||
if (Files.exists(path)) { | ||
TypeToken<Collection<Measurements>> collectionType = new TypeToken<>() {}; | ||
var json = new String(Files.readAllBytes(path)); | ||
recordings = gson.fromJson(json, collectionType); | ||
} | ||
var data = new Measurements(); | ||
// TODO: data_size, client, clientCount, num_of_tasks, is_cluster, tps | ||
data.get_existing_average_latency = calculatedResults.get(ChosenAction.GET_EXISTING).avgLatency; | ||
data.get_existing_p50_latency = calculatedResults.get(ChosenAction.GET_EXISTING).p50Latency; | ||
data.get_existing_p90_latency = calculatedResults.get(ChosenAction.GET_EXISTING).p90Latency; | ||
data.get_existing_p99_latency = calculatedResults.get(ChosenAction.GET_EXISTING).p99Latency; | ||
data.get_existing_std_dev = calculatedResults.get(ChosenAction.GET_EXISTING).stdDeviation; | ||
|
||
data.get_non_existing_average_latency = | ||
calculatedResults.get(ChosenAction.GET_NON_EXISTING).avgLatency; | ||
data.get_non_existing_p50_latency = | ||
calculatedResults.get(ChosenAction.GET_NON_EXISTING).p50Latency; | ||
data.get_non_existing_p90_latency = | ||
calculatedResults.get(ChosenAction.GET_NON_EXISTING).p90Latency; | ||
data.get_non_existing_p99_latency = | ||
calculatedResults.get(ChosenAction.GET_NON_EXISTING).p99Latency; | ||
data.get_non_existing_std_dev = | ||
calculatedResults.get(ChosenAction.GET_NON_EXISTING).stdDeviation; | ||
|
||
data.set_average_latency = calculatedResults.get(ChosenAction.SET).avgLatency; | ||
data.set_p50_latency = calculatedResults.get(ChosenAction.SET).p50Latency; | ||
data.set_p90_latency = calculatedResults.get(ChosenAction.SET).p90Latency; | ||
data.set_p99_latency = calculatedResults.get(ChosenAction.SET).p99Latency; | ||
data.set_std_dev = calculatedResults.get(ChosenAction.SET).stdDeviation; | ||
|
||
recordings.add(data); | ||
|
||
Files.write(path, gson.toJson(recordings).getBytes()); | ||
} | ||
|
||
@Getter | ||
public static class Measurements { | ||
private String client; | ||
private int clientCount; | ||
private int data_size; | ||
private double get_existing_average_latency; | ||
private double get_existing_p50_latency; | ||
private double get_existing_p90_latency; | ||
private double get_existing_p99_latency; | ||
private double get_existing_std_dev; | ||
private double get_non_existing_average_latency; | ||
private double get_non_existing_p50_latency; | ||
private double get_non_existing_p90_latency; | ||
private double get_non_existing_p99_latency; | ||
private double get_non_existing_std_dev; | ||
private boolean is_cluster; | ||
private int num_of_tasks; | ||
private double set_average_latency; | ||
private double set_p50_latency; | ||
private double set_p90_latency; | ||
private double set_p99_latency; | ||
private double set_std_dev; | ||
private double tps; | ||
} | ||
} |