Skip to content

Commit

Permalink
Add performance profiling stats (#460)
Browse files Browse the repository at this point in the history
* Add performance profiling stats

* Break lines

* Break lines

* Switch off by default

* [MegaLinter] Apply linters automatic fixes (#22)

Co-authored-by: vkucera <vkucera@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: vkucera <vkucera@users.noreply.github.com>
  • Loading branch information
3 people authored May 31, 2024
1 parent b886ad8 commit 72e1d68
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions codeHF/config_tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DOPOSTPROCESS=1 # Run output postprocessing. (Comparison plots. Requires DOA

DATABASE_O2="workflows.yml" # Workflow specification database
MAKE_GRAPH=0 # Make topology graph.
MAKE_PERF_STATS=0 # Produce performance profiling stats.

# Activation of O2 workflows
# Trigger selection
Expand Down Expand Up @@ -506,6 +507,7 @@ function MakeScriptO2 {
[ "$DEBUG" -eq 1 ] && OPT_MAKECMD+=" -d"
[ $SAVETREES -eq 1 ] && OPT_MAKECMD+=" -t"
[ $MAKE_GRAPH -eq 1 ] && OPT_MAKECMD+=" -g"
[ $MAKE_PERF_STATS -eq 1 ] && OPT_MAKECMD+=" -p"

# Make a copy of the default workflow database file before modifying it.
DATABASE_O2_EDIT="${DATABASE_O2/.yml/_edit.yml}"
Expand Down
2 changes: 2 additions & 0 deletions codeJE/config_tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DOPOSTPROCESS=1 # Run output postprocessing. (Comparison plots. Requires DOA

DATABASE_O2="workflows.yml" # Workflow specification database
MAKE_GRAPH=0 # Make topology graph.
MAKE_PERF_STATS=0 # Produce performance profiling stats.

# Activation of O2 workflows
# Table producers
Expand Down Expand Up @@ -164,6 +165,7 @@ function MakeScriptO2 {
[ "$DEBUG" -eq 1 ] && OPT_MAKECMD+=" -d"
[ $SAVETREES -eq 1 ] && OPT_MAKECMD+=" -t"
[ $MAKE_GRAPH -eq 1 ] && OPT_MAKECMD+=" -g"
[ $MAKE_PERF_STATS -eq 1 ] && OPT_MAKECMD+=" -p"

# Make a copy of the default workflow database file before modifying it.
DATABASE_O2_EDIT="${DATABASE_O2/.yml/_edit.yml}"
Expand Down
4 changes: 3 additions & 1 deletion config/config_tasks_dummy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ DOPOSTPROCESS=1 # Run output postprocessing. (Comparison plots. Requires DOA
[ "$INPUT_IS_O2" -eq 1 ] && { DOCONVERT=0; DOALI=0; }

DATABASE_O2="workflows_dummy.yml" # Workflow specification database
MAKE_GRAPH=0 # Make topology graph.
MAKE_GRAPH=0 # Make topology graph.
MAKE_PERF_STATS=0 # Produce performance profiling stats.

# Activation of O2 workflows
# Trigger selection
Expand Down Expand Up @@ -133,6 +134,7 @@ function MakeScriptO2 {
[ "$DEBUG" -eq 1 ] && OPT_MAKECMD+=" -d"
[ $SAVETREES -eq 1 ] && OPT_MAKECMD+=" -t"
[ $MAKE_GRAPH -eq 1 ] && OPT_MAKECMD+=" -g"
[ $MAKE_PERF_STATS -eq 1 ] && OPT_MAKECMD+=" -p"

# Make a copy of the default workflow database file before modifying it.
DATABASE_O2_EDIT="${DATABASE_O2/.yml/_edit.yml}"
Expand Down
16 changes: 15 additions & 1 deletion exec/make_command_o2.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,15 @@ def main():
parser.add_argument("-t", "--tables", action="store_true", help="save table into trees")
parser.add_argument("-g", "--graph", action="store_true", help="make topology graph")
parser.add_argument("-d", "--debug", action="store_true", help="print debugging info")
parser.add_argument("-p", "--perf", action="store_true", help="produce performance profiling stats")
args = parser.parse_args()
path_file_database = args.database
debug = args.debug
workflows_add = args.workflows.split() if args.workflows else ""
mc_mode = args.mc
save_tables = args.tables
make_graph = args.graph
perf = args.perf

# Open database input file.
if debug:
Expand All @@ -171,6 +173,13 @@ def main():
msg_warn("MC mode is on.")
if save_tables:
msg_warn("Tables will be saved in trees.")
if perf:
msg_warn(
"Performance profiling stats will be saved in perf.data files.\n"
" Convert them with: perf script --demangle -i perf.data --no-inline |"
" c++filt -r -t > profile.linux-perf.txt\n"
" and upload the output to https://www.speedscope.app/."
)

# Get workflow-independent options.
dic_opt = dic_in["options"]
Expand Down Expand Up @@ -271,6 +280,10 @@ def main():
msg_fatal("Nothing to do!")
# Remove the leading "| \\\n".
command = command[4:]
# Append performance profiling options.
if perf:
opt_perf = "perf record -F 99 -g --call-graph dwarf --user-callchains"
command = command.replace(string_wf, f"{opt_perf} {string_wf}")
# Append global options.
if opt_global:
command += " " + opt_global
Expand Down Expand Up @@ -311,4 +324,5 @@ def main():
eprint("Produce graph with Graphviz: dot -T%s %s -o %s" % (ext_graph, path_file_dot, path_file_graph))


main()
if __name__ == "__main__":
main()

0 comments on commit 72e1d68

Please sign in to comment.