Skip to content

Commit

Permalink
included runtime of shell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
EtomicBomb committed Dec 2, 2024
1 parent a5d6887 commit f84c3b0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
5 changes: 3 additions & 2 deletions infrastructure/run_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ def get_parser():
return parser

def get_environment(root):
my_env = os.environ.copy()
env = os.environ.copy()
dynamic_shell = root / 'infrastructure' / 'run_dynamic_shell.py'
my_env['BENCHMARK_SHELL'] = str(dynamic_shell)
env['BENCHMARK_SHELL'] = str(dynamic_shell)
return env

def run_analysis(root: Path, bench: Path, run_input: bool, run_deps: bool):
env = get_environment(root)
Expand Down
16 changes: 14 additions & 2 deletions infrastructure/run_dynamic_shell.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
#!/usr/bin/env python3

import shlex
from pathlib import Path
from typing import Optional
import json
from subprocess import check_output
from subprocess import check_output, run
from collections import Counter
import sys
from time import perf_counter

from all_scripts import get_all_scripts
from syntax_analysis import parse_shell_script, count_nodes
from project_root import get_project_root

run(['bash', *sys.argv[1:]])
time_file = get_project_root() / 'infrastructure' / 'target' / 'runtime_log.csv'

command = sys.argv[1:]

start = perf_counter()
run(['bash', *command])
elapsed = perf_counter() - start

with time_file.open('a') as file:
print(shlex.join(command), elapsed, sep=',', file=file)

2 changes: 2 additions & 0 deletions infrastructure/target/runtime_log.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/benchmarks/log-analysis/scripts/nginx.sh /benchmarks/log-analysis/input/nginx-logs /benchmarks/log-analysis/results/nginx.full,1.5968113659982919
/benchmarks/log-analysis/scripts/pcaps.sh /benchmarks/log-analysis/input/pcaps /benchmarks/log-analysis/results/pcaps.full,116.00431065500015
1 change: 1 addition & 0 deletions log-analysis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if [[ "$@" == *"--small"* ]]; then
fi

BENCHMARK_SHELL=${BENCHMARK_SHELL:-bash}
echo "shell: $BENCHMARK_SHELL"

echo "nginx"
$BENCHMARK_SHELL $scripts_dir/nginx.sh $nginx_input $results_dir/nginx$suffix
Expand Down

0 comments on commit f84c3b0

Please sign in to comment.