-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance Test Parse Metrics (3) (#200)
- Loading branch information
1 parent
81298dd
commit 5726162
Showing
9 changed files
with
200 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ bin/ | |
k8s-dqlite | ||
hack/.build/ | ||
hack/.deps/ | ||
test/performance/results/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env Rscript | ||
|
||
# Load necessary libraries | ||
library(ggplot2) | ||
library(dplyr) | ||
library(optparse) | ||
|
||
# Define command-line options | ||
option_list = list( | ||
make_option(c("-o", "--out"), type = "character", default = ".", | ||
help = "Output path for plots"), | ||
make_option(c("-p", "--path"), type = "character", default = ".", | ||
help = "Path to metrics files"), | ||
|
||
make_option(c("-f", "--filepattern"), type = "character", default = "*.log", | ||
help = "File pattern to match metrics files") | ||
) | ||
|
||
# Parse command-line options | ||
opt_parser = OptionParser(option_list = option_list) | ||
opt = parse_args(opt_parser) | ||
|
||
metrics_files <- list.files(opt$path, pattern = opt$filepattern, full.names = TRUE) | ||
|
||
print(paste("Found", length(metrics_files), "metrics files")) | ||
|
||
# Prepare file paths | ||
metrics_data <- list() | ||
|
||
# Read and process each file | ||
for (file in metrics_files) { | ||
if (!file.exists(file)) { | ||
warning("File not found: ", file) | ||
next | ||
} | ||
|
||
# Read and clean data | ||
df <- read.table(file, header = FALSE, skip = 3, | ||
col.names = c("Time", "UID", "PID", "%usr", "%system", "%guest", "%wait", "%CPU", | ||
"CPU", "minflt/s", "majflt/s", "VSZ", "RSS", "%MEM", | ||
"kB_rd_s", "kB_wr_s", "kB_ccwr_s", "iodelay", "command"), | ||
stringsAsFactors = FALSE) | ||
|
||
# Convert numeric columns and handle NA values | ||
df[2:(ncol(df) - 1)] <- lapply(df[2:(ncol(df) - 1)], function(x) as.numeric(as.character(x))) | ||
df[is.na(df)] <- 0 | ||
|
||
metrics_data[[basename(file)]] <- df | ||
} | ||
|
||
# Verify data is loaded | ||
if (length(metrics_data) < 1) { | ||
stop("No valid data loaded. Check file paths or contents.", call. = FALSE) | ||
} | ||
|
||
# Define function to create and save plots | ||
create_plot <- function(data_list, y_column, title, y_label, file_suffix) { | ||
plot <- ggplot() + | ||
lapply(names(data_list), function(node) { | ||
geom_line(data = data_list[[node]], aes(x = 1:nrow(data_list[[node]]), y = !!sym(y_column), color = node)) | ||
}) + | ||
labs(title = title, x = "Time", y = y_label) | ||
|
||
# Save plot | ||
ggsave(filename = file.path(opt$out, paste0(file_suffix, ".png")), plot = plot, width = 8, height = 6) | ||
} | ||
|
||
print("Creating plots") | ||
# Generate and save all required plots | ||
create_plot(metrics_data, "X.CPU", "CPU Usage Over Time", "% CPU", "cpu_usage_plot") | ||
create_plot(metrics_data, "X.MEM", "Memory Usage Over Time", "% MEM", "mem_usage_plot") | ||
create_plot(metrics_data, "kB_rd_s", "IO Read Usage Over Time", "kB_rd_s", "io_read_usage_plot") | ||
create_plot(metrics_data, "kB_wr_s", "IO Write Usage Over Time", "kB_wr_s", "io_write_usage_plot") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
# | ||
# Copyright 2024 Canonical, Ltd. | ||
# | ||
import logging | ||
|
||
from test_util import harness, metrics | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
def test_single_node_load(session_instance: harness.Instance): | ||
"""Test the performance of a single node cluster with all features enabled.""" | ||
metrics.configure_kube_burner(session_instance) | ||
process_dict = metrics.collect_metrics([session_instance]) | ||
metrics.run_kube_burner(session_instance) | ||
metrics.stop_metrics([session_instance], process_dict) | ||
metrics.pull_metrics([session_instance]) | ||
metrics.pull_metrics([session_instance], "single-node") |
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
Oops, something went wrong.