mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
out/run.sh: write before execution
This commit is contained in:
@@ -12445,7 +12445,14 @@ Profiling builds as of 3cea7d9ce49bda49c50e756339ff1287fd55df77 both use: `-g -O
|
||||
* `prof` uses `-pg` for gprof
|
||||
* `perf` uses `-lprofile` for google-pprof
|
||||
|
||||
See also: <<profiling-userland-programs>>.
|
||||
Profiling techniques are discussed in more detail at: <<profiling-userland-programs>>.
|
||||
|
||||
For the `prof` build, you can get the `gmon.out` file with:
|
||||
|
||||
....
|
||||
./run --arch aarch64 --emulator gem5 --userland userland/c/hello.c --gem5-build-type prof
|
||||
gprof "$(./getvar --arch aarch64 gem5_executable)" > tmp.gprof
|
||||
....
|
||||
|
||||
==== gem5 clang build
|
||||
|
||||
|
||||
@@ -944,7 +944,8 @@ Incompatible archs are skipped.
|
||||
else:
|
||||
env['guest_terminal_file'] = env['qemu_termout_file']
|
||||
env['trace_txt_file'] = env['qemu_trace_txt_file']
|
||||
env['run_cmd_file'] = join(env['run_dir'], 'run.sh')
|
||||
env['run_cmd_file_basename'] = 'run.sh'
|
||||
env['run_cmd_file'] = join(env['run_dir'], env['run_cmd_file_basename'])
|
||||
|
||||
# Linux kernel.
|
||||
if not env['_args_given']['linux_build_dir']:
|
||||
|
||||
3
run
3
run
@@ -840,14 +840,13 @@ Extra options to append at the end of the emulator command line.
|
||||
out_file = self.env['termout_file']
|
||||
exit_status = self.sh.run_cmd(
|
||||
cmd,
|
||||
cmd_file=self.env['run_cmd_file'],
|
||||
cmd_files=[self.env['run_cmd_file'], os.path.join(self.env['out_dir'], self.env['run_cmd_file_basename'])],
|
||||
extra_env=extra_env,
|
||||
out_file=out_file,
|
||||
raise_on_failure=False,
|
||||
show_stdout=show_stdout,
|
||||
stdin_path=self.env['stdin_file'],
|
||||
)
|
||||
self.sh.cp(self.env['run_cmd_file'], self.env['out_dir'], quiet=True)
|
||||
if self.env['debug_vm_rr']:
|
||||
rr_cmd = ['rr', 'replay', LF, '-o', '-q', LF]
|
||||
for arg in shlex.split(self.env['debug_vm_args']):
|
||||
|
||||
@@ -243,6 +243,7 @@ class ShellHelpers:
|
||||
cmd,
|
||||
cwd=None,
|
||||
cmd_file=None,
|
||||
cmd_files=None,
|
||||
extra_env=None,
|
||||
extra_paths=None,
|
||||
force_oneline=False,
|
||||
@@ -268,7 +269,11 @@ class ShellHelpers:
|
||||
)
|
||||
if not self.quiet:
|
||||
self._print_thread_safe('+ ' + cmd_string)
|
||||
if cmd_files is None:
|
||||
cmd_files = []
|
||||
if cmd_file is not None:
|
||||
cmd_files.append(cmd_file)
|
||||
for cmd_file in cmd_files:
|
||||
os.makedirs(os.path.dirname(cmd_file), exist_ok=True)
|
||||
with open(cmd_file, 'w') as f:
|
||||
f.write('#!/usr/bin/env bash\n')
|
||||
@@ -287,6 +292,7 @@ class ShellHelpers:
|
||||
self,
|
||||
cmd,
|
||||
cmd_file=None,
|
||||
cmd_files=None,
|
||||
out_file=None,
|
||||
show_stdout=True,
|
||||
show_cmd=True,
|
||||
@@ -310,6 +316,10 @@ class ShellHelpers:
|
||||
:param cmd_file: if not None, write the command to be run to that file
|
||||
:type cmd_file: str
|
||||
|
||||
:param cmd_files: if not None, write the command to be run to all files in this list
|
||||
cmd_file gets appended to that list if given.
|
||||
:type cmd_files: List[str]
|
||||
|
||||
:param out_file: if not None, write the stdout and stderr of the command the file
|
||||
:type out_file: str
|
||||
|
||||
@@ -358,6 +368,7 @@ class ShellHelpers:
|
||||
cmd,
|
||||
cwd=cwd,
|
||||
cmd_file=cmd_file,
|
||||
cmd_files=cmd_files,
|
||||
extra_env=extra_env,
|
||||
extra_paths=extra_paths,
|
||||
stdin_path=stdin_path
|
||||
|
||||
Reference in New Issue
Block a user