Skip to content

Commit

Permalink
[cleanup] Remove unused --*-mem-dump flags
Browse files Browse the repository at this point in the history
These were added before benchmarks/time-helper.c had support for
max_rss_KiB.
  • Loading branch information
Andy C committed Nov 9, 2022
1 parent 7d2596e commit 055567e
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 94 deletions.
3 changes: 0 additions & 3 deletions benchmarks/osh-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ runtime-task() {

cpython) # NOTE: $task_arg unused.

# This configure script defeats --runtime-mem-dump, I think because of:
# exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}

# autoconf supports running configure from a different directory.
pushd $files_out_dir >/dev/null

Expand Down
30 changes: 0 additions & 30 deletions benchmarks/vm-baseline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,36 +130,6 @@ EOF
# Other
#

# NOTE: Could also add Python introspection.
parser-dump-demo() {
local out_dir=_tmp/virtual-memory
mkdir -p $out_dir

# VmRSS: 46 MB for abuild, 200 MB for configure! That is bad. This
# benchmark really is necessary.
local input=benchmarks/testdata/abuild

bin/osh \
--parser-mem-dump $out_dir/parser.txt -n --ast-format none \
$input

grep '^Vm' $out_dir/parser.txt
}

runtime-dump-demo() {
# Multiple processes
#OIL_TIMING=1 bin/osh -c 'echo $(echo hi)'

local out_dir=_tmp/virtual-memory
mkdir -p $out_dir
bin/osh \
--parser-mem-dump $out_dir/parser.txt \
--runtime-mem-dump $out_dir/runtime.txt \
-c 'echo $(echo hi)'

grep '^Vm' $out_dir/parser.txt $out_dir/runtime.txt
}

soil-shell-provenance() {
### Only measure shells in the Docker image

Expand Down
13 changes: 0 additions & 13 deletions core/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,15 +655,8 @@ def Main(lang, arg_r, environ, login_shell, loader, line_input):
status = 2

if status == 0 :
if flag.parser_mem_dump is not None: # only valid in -n mode
input_path = '/proc/%d/status' % posix.getpid()
pyutil.CopyFile(input_path, flag.parser_mem_dump)

ui.PrintAst(node, flag)
else:
if flag.parser_mem_dump is not None:
raise error.Usage('--parser-mem-dump can only be used with -n')

with state.ctx_ThisDir(mem, script_name):
try:
status = main_loop.Batch(cmd_ev, c_parser, errfmt,
Expand All @@ -674,11 +667,5 @@ def Main(lang, arg_r, environ, login_shell, loader, line_input):
cmd_ev.MaybeRunExitTrap(box)
status = box[0]

# NOTE: 'exit 1' is ControlFlow and gets here, but subshell/commandsub
# don't because they call _exit().
if flag.runtime_mem_dump is not None:
input_path = '/proc/%d/status' % posix.getpid()
pyutil.CopyFile(input_path, flag.runtime_mem_dump)

# NOTE: We haven't closed the file opened with fd_state.Open
return status
13 changes: 0 additions & 13 deletions core/shell_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,8 @@ def Main(lang, arg_r, environ, login_shell, loader, line_input):
status = 2

if status == 0 :
if flag.parser_mem_dump is not None: # only valid in -n mode
input_path = '/proc/%d/status' % posix.getpid()
pyutil.CopyFile(input_path, flag.parser_mem_dump)

ui.PrintAst(node, flag)
else:
if flag.parser_mem_dump is not None:
e_usage('--parser-mem-dump can only be used with -n')

with state.ctx_ThisDir(mem, script_name):
try:
status = main_loop.Batch(cmd_ev, c_parser, errfmt,
Expand All @@ -514,11 +507,5 @@ def Main(lang, arg_r, environ, login_shell, loader, line_input):
cmd_ev.MaybeRunExitTrap(box)
status = box[0]

# NOTE: 'exit 1' is ControlFlow and gets here, but subshell/commandsub
# don't because they call _exit().
if flag.runtime_mem_dump is not None:
input_path = '/proc/%d/status' % posix.getpid()
pyutil.CopyFile(input_path, flag.runtime_mem_dump)

# NOTE: We haven't closed the file opened with fd_state.Open
return status
31 changes: 0 additions & 31 deletions demo/osh-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,6 @@ set -o pipefail

set -o errexit

parser-mem-dump() {
local big=benchmarks/testdata/configure-coreutils
#local big=_tmp/e.sh

local dump=_tmp/parser-mem-dump.txt

set +o errexit
rm -f $dump
bin/osh --parser-mem-dump $dump $big
grep '^Vm' $dump

echo '==='

# It ONLY works with -n, because we don't load the whole thing into memory
# otherwise?
rm -f $dump
bin/osh --parser-mem-dump $dump -n --ast-format none $big
grep '^Vm' $dump
}

runtime-mem-dump() {
#local big=_tmp/e.sh
local big=devtools/release.sh # just run through all the functions
local dump=_tmp/runtime-mem-dump.txt

set +o errexit
rm -f $dump
bin/osh --runtime-mem-dump $dump $big
grep '^Vm' $dump
}

myfunc() {
metrics/source-code.sh osh-cloc
}
Expand Down
4 changes: 0 additions & 4 deletions frontend/flag_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,6 @@ def _AddShellOptions(spec):
OSH_SPEC.LongFlag('--debug-file', args.String)
OSH_SPEC.LongFlag('--xtrace-to-debug-file')

# For benchmarks/*.sh
OSH_SPEC.LongFlag('--parser-mem-dump', args.String)
OSH_SPEC.LongFlag('--runtime-mem-dump', args.String)

# This flag has is named like bash's equivalent. We got rid of --norc because
# it can simply by --rcfile /dev/null.
OSH_SPEC.LongFlag('--rcfile', args.String)
Expand Down

0 comments on commit 055567e

Please sign in to comment.