#!/bin/bash # # Usage: # process_plot_taskthreadpools nprocess time-range-ms # # Description: # Process all the tasks thread and threadpool info in the current directory # creating graphs for steps and threads. # # The input files are created by a run using the "-y interval" and # "-Y interval" flags, with the same interval. The output files # from these stages will be named "thread_info-step.dat" # and "threadpool_info-step.dat" in the current directory. # All located files will be processed using "nprocess" concurrent # processes and all plots will have the given time range. An output # HTML file "threadtaskpools.html" will be created to view all the plots. # # This file is part of SWIFT: # # Copyright (C) 2017 Peter W. Draper (p.w.draper@durham.ac.uk) # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # Handle command-line if test "$2" == ""; then echo "Usage: $0 nprocess time-range-ms" exit 1 fi NPROCS=$1 TIMERANGE=$2 # Locate script. SCRIPTHOME=$(dirname "$0") # Find all thread info files. Use version sort to get into correct order. taskfiles=$(ls -v thread_info-step*.dat) if test $? != 0; then echo "Failed to find any thread info files" exit 1 fi # Construct the expected names of the threadpool files and merge. list="" for f in $taskfiles; do s=$(echo $f| sed 's,thread_info-step\(.*\).dat,\1,') p="threadpool_info-step${s}.dat" if ! test -f "$p"; then exit "Cannot find threadpool file: $p, that matches $f" fi list="$list $f $p $s" done echo "Processing thread info files..." echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/process_plot_taskthreadpools_helper $TIMERANGE \$0 \$1 \$2 " output="taskpool.html" echo "Writing output $output file" # Construct document - serial. cat < $output SWIFT task and threadpool graphs

SWIFT task and threadpool graphs

EOF echo $list | xargs -n 3 | while read f p s; do cat <> $output

Step $s

EOF cat <> $output EOF cat < taskpoolstep${s}r${i}.html EOF done cat <> $output EOF echo "Finished" exit