mirror of
https://github.com/falcosecurity/falco.git
synced 2025-10-21 11:29:26 +00:00
Add shell scripts to make it easier to collect performance results from traces, live tests, and phoronix tests. With run_performance_tests.sh you specify the following: - a subject program to run, using --root - a name to give to this set of results, using --variant - a test to run, using --test - a file to write the results to, using --results. For tests that start with "trace", the script runs falco/sysdig on the trace file and measures the time taken to read the file. For other tests, he script handles starting falco/sysdig, starting a cpu measurement script (a wrapper around top, just to provide identical values to what you would see using top) to measure the cpu usage of falco/sysdig, and running a live test. The measurement interval for cpu usage depends on the test being run--10 seconds for most tests, 2 seconds for shorter tests. The output is written as json to the file specified in --results. Also add R scripts to easily display the results from the shell script. plot-live.r shows a linechart of the cpu usage for the provided variants over time. plot-traces.r shows grouped barcharts showing user/system/total time taken for the provided variants and traces. One bug--you have to make the results file actual json by adding leading/trailing []s.
41 lines
1.1 KiB
R
41 lines
1.1 KiB
R
require(jsonlite)
|
|
library(ggplot2)
|
|
library(GetoptLong)
|
|
|
|
initial.options <- commandArgs(trailingOnly = FALSE)
|
|
file.arg.name <- "--file="
|
|
script.name <- sub(file.arg.name, "", initial.options[grep(file.arg.name, initial.options)])
|
|
script.basename <- dirname(script.name)
|
|
|
|
if (substr(script.basename, 1, 1) != '/') {
|
|
script.basename = paste(getwd(), script.basename, sep='/')
|
|
}
|
|
|
|
results = paste(script.basename, "results.json", sep='/')
|
|
output = "./output.png"
|
|
|
|
GetoptLong(
|
|
"results=s", "Path to results file",
|
|
"benchmark=s", "Benchmark from results file to graph",
|
|
"variant=s@", "Variant(s) to include in graph. Can be specified multiple times",
|
|
"output=s", "Output graph file"
|
|
)
|
|
|
|
res <- fromJSON(results, flatten=TRUE)
|
|
|
|
res2 = res[res$benchmark == benchmark & res$variant %in% variant,]
|
|
|
|
plot <- ggplot(data=res2, aes(x=sample, y=cpu_usage, group=variant, colour=variant)) +
|
|
geom_line() +
|
|
ylab("CPU Usage (%)") +
|
|
xlab("Time") +
|
|
ggtitle(sprintf("Falco/Sysdig CPU Usage: %s", benchmark))
|
|
theme(legend.position=c(.2, .88));
|
|
|
|
print(paste("Writing graph to", output, sep=" "))
|
|
ggsave(file=output)
|
|
|
|
|
|
|
|
|