github.com/vmware/govmomi@v0.51.0/scripts/debug-ls.sh (about) 1 #!/bin/bash 2 3 # © Broadcom. All Rights Reserved. 4 # The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 5 # SPDX-License-Identifier: Apache-2.0 6 7 set -e 8 9 # This script shows for every request in a debug trace how long it took 10 # and the name of the request body. 11 12 function body-name { 13 ( 14 xmllint --shell $1 <<EOS 15 setns soapenv=http://schemas.xmlsoap.org/soap/envelope/ 16 xpath name(//soapenv:Body/*) 17 EOS 18 ) | head -1 | sed 's/.*Object is a string : \(.*\)$/\1/' 19 } 20 21 if [ -n "$1" ]; then 22 cd $1 23 fi 24 25 for req in $(find . -name '*.req.xml'); do 26 base=$(basename $req .req.xml) 27 session=$(echo $base | awk -F'-' "{printf \"%d\", \$1}") 28 number=$(echo $base | awk -F'-' "{printf \"%d\", \$2}") 29 client_log=$(dirname $req)/${session}-client.log 30 took=$(awk "/ ${number} took / { print \$4 }" ${client_log}) 31 32 printf "%s %8s: %s\n" ${base} ${took} $(body-name $req) 33 done