Home | History | Annotate | Line # | Download | only in experiments
      1 #
      2 #   Copyright (C) 2021-2026 Free Software Foundation, Inc.
      3 #
      4 # This file is free software; you can redistribute it and/or modify
      5 # it under the terms of the GNU General Public License as published by
      6 # the Free Software Foundation; either version 3 of the License, or
      7 # (at your option) any later version.
      8 #
      9 # This program is distributed in the hope that it will be useful,
     10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 # GNU General Public License for more details.
     13 #
     14 # You should have received a copy of the GNU General Public License
     15 # along with this program; see the file COPYING3.  If not see
     16 # <http://www.gnu.org/licenses/>.
     17 #
     18 #------------------------------------------------------------------------------
     19 # This script demonstrates how to use gprofng.
     20 #
     21 # After the experiment data has been generated, several views into the data
     22 # are shown.
     23 #------------------------------------------------------------------------------
     24 
     25 #------------------------------------------------------------------------------
     26 # Define the executable, algorithm parameters and gprofng settings.
     27 #------------------------------------------------------------------------------
     28 exe=../experiments/mxv-pthreads
     29 rows=4000
     30 columns=2000
     31 threads=2
     32 exp_directory=experiment.$threads.thr.er
     33 
     34 #------------------------------------------------------------------------------
     35 # Check if gprofng has been installed and can be executed.
     36 #------------------------------------------------------------------------------
     37 which gprofng > /dev/null 2>&1
     38 if (test $? -eq 0) then
     39   echo  ""
     40   echo "Version information of the gprofng release used:"
     41   echo  ""
     42   gprofng --version
     43   echo  ""
     44 else
     45   echo "Error: gprofng cannot be found - if it was installed, check your path"
     46   exit
     47 fi
     48 
     49 #------------------------------------------------------------------------------
     50 # Check if the executable is present.
     51 #------------------------------------------------------------------------------
     52 if (! test -x $exe) then
     53   echo "Error: executable $exe not found - check the make install command"
     54   exit
     55 fi
     56 
     57 echo "-------------- Collect the experiment data -----------------------------"
     58 gprofng collect app -O $exp_directory $exe -m $rows -n $columns -t $threads
     59 
     60 #------------------------------------------------------------------------------
     61 # Make sure that the collect experiment succeeded and created an experiment
     62 # directory with the performance data.
     63 #------------------------------------------------------------------------------
     64 if (! test -d $exp_directory) then
     65   echo "Error: experiment directory $exp_directory not found"
     66   exit
     67 fi
     68 
     69 echo "-------------- Show the function overview  -----------------------------"
     70 gprofng display text -functions $exp_directory
     71 
     72 echo "-------------- Show the function overview limit to the top 5 -----------"
     73 gprofng display text -limit 5 -functions $exp_directory
     74 
     75 echo "-------------- Show the source listing of mxv_core ---------------------"
     76 gprofng display text -metrics e.totalcpu -source mxv_core $exp_directory
     77 
     78 echo "-------------- Show the disassembly listing of mxv_core ----------------"
     79 gprofng display text -metrics e.totalcpu -disasm mxv_core $exp_directory
     80