From 090bb7498580ecdb05133890bcd921db50281ef1 Mon Sep 17 00:00:00 2001 From: Md Rahman Date: Mon, 24 Jan 2022 22:52:52 -0600 Subject: [PATCH] Pshmem symbol check script (#1041) * Script to check profiling symbols Signed-off-by: Md Rahman * Removed recursive rm * Added a comment on the so file requirement * Added a check for grep in case profiling is not enabled --- scripts/pshmem_symbol_check.sh | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 scripts/pshmem_symbol_check.sh diff --git a/scripts/pshmem_symbol_check.sh b/scripts/pshmem_symbol_check.sh new file mode 100755 index 000000000..cec68c9b2 --- /dev/null +++ b/scripts/pshmem_symbol_check.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# Simple script to check for missing profiling symbols in +# SHMEM library. The readelf tool requires the library to +# be a shared object. +# +# Example usage: pshmem_symbol_check.sh +# +# Exit if any command fails +set -e + +if [ $# != 1 ] ; then + echo "Usage: $0 SHMEM_LIBRARY" + exit 1 +fi + +SHMEM_LIB=$1 + +readelf --syms --wide $SHMEM_LIB | grep 'shmem_' | awk '{print $8}' > symbols +cat symbols | sort | uniq -d > shmem_symbols + +if grep -q -R "pshmem_" shmem_symbols +then + grep -R "pshmem_" shmem_symbols > pshmem_symbols_uniq + echo "Number of pshmem symbols found: `wc -l pshmem_symbols_uniq | awk '{print $1}'`" +else + echo "No PSHMEM symbols found" + exit 0 +fi + +sed -n '/^pshmem_/d' shmem_symbols + +for i in $(cat ./pshmem_symbols_uniq) +do + search_str=$(echo $i | cut -c 2-) + sed "/${search_str}/d" -i ./shmem_symbols +done + +rm symbols +rm pshmem_symbols_uniq + +echo "APIs that dont have profiling symbols:" +echo "--------------------------------------" +cat shmem_symbols + +rm shmem_symbols