#!/bin/tcsh -f # # Counts symbols in the CDF Production Executable # and tries to assign them to code packages that we can change, # for example in the CDF code itself or in the ZOOM code or in the ROOT code # # Run this script via commands similar to: # # > source ~cdfsoft/cdf2.cshrc # > setup cdfsoft2 # > $CDFSOFT2_DIR/Validation/count_symbols # # This script relies upon environmental varables # PROJECT_DIR, SRT_SUBDIR, SRT_BASE_RELEASE and BFARCH # being defined. # # It takes about 20 seconds to run for kai, longer for gcc # # Written by Eric Wicklund # August 24th, 2001 # # Updated for gcc by Eric Wicklund # September 10th, 2002 # # Based on tips from Bill Ashmanskas # # Watch out for wide variety of nm programs. # Use a version of nm which reports line numbers # when the -l qualifier is specified. # # Note: this script does not currently run on fcdfsgi2.fnal.gov # since the nm there does not support the -l qualifier # # For other reasons, it might help to get a different version of # nm installed on fcdfsgi2.fnal.gov. # # Perhaps we should standardize on the nm from the GNU binutils product # # # # 20010910 kreymer # # Added argument to specify name of executeable, default to ProductionExe # Added . to path, for testing local count_symbols.pl # Change from using CDFSOFT2_DIR to # using PROJECT_DIR and SRT_BASE_RELEASE # Reversed order of sort, largest last on the screen. # Added initial message. # # # Select executable to analyze # if ( $#argv == 0 ) then setenv CS_NAME ProductionExe setenv CS_IMAGE $PROJECT_DIR/bin/$BFARCH/ProductionExe else setenv CS_NAME $argv[1] setenv CS_IMAGE $argv[1] endif # # Select compiler # if ( $BFARCH =~ Linux2-GCC* ) then setenv CS_NM $GCC_DIR/bin/nm setenv CS_TYPE gcc endif # if ( $BFARCH =~ Linux2-KCC* ) then setenv CS_NM $KCC_BASE/bin/nm setenv CS_TYPE kai endif # # Select path for count_symbols.pl # set path = ( . ${PROJECT_DIR}/Release/Scripts $path ) # # Start the counting # Only count lines with T or t in second column, which are code segments. # printf " OK - counting symbols in $CS_NAME in $CS_TYPE $SRT_BASE_RELEASE \n" $CS_NM -l $CS_IMAGE | \ awk '{if (($2 == "T") || ($2 == "t")) print $0}' | \ awk '{if ($4 != "") print $4}' | \ count_symbols.pl | sort -n -k 1 exit