diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-07-21 12:53:24 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-07-21 12:53:24 +0000 |
commit | f849b30409d21372859539aaf556603b9381d9f5 (patch) | |
tree | eef1207376dc477d160873669c74c74324425d59 /contrib | |
parent | 2a0661791ad935f8febdce3025cfdb2df51c11e1 (diff) | |
download | gcc-f849b30409d21372859539aaf556603b9381d9f5.tar.gz |
Do not divide by zero in analyze_brprob.py
* analyze_brprob.py: If there's no loop, do not calculate
average number of loop iterations.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238590 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ChangeLog | 5 | ||||
-rwxr-xr-x | contrib/analyze_brprob.py | 13 |
2 files changed, 12 insertions, 6 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog index d5f194af4d3..aff5df80314 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2016-07-21 Martin Liska <mliska@suse.cz> + + * analyze_brprob.py: If there's no loop, do not calculate + average number of loop iterations. + 2016-06-24 Martin Liska <mliska@suse.cz> * analyze_brprob.py: Parse and display average number diff --git a/contrib/analyze_brprob.py b/contrib/analyze_brprob.py index c276d810a4f..c083d2bffb0 100755 --- a/contrib/analyze_brprob.py +++ b/contrib/analyze_brprob.py @@ -149,12 +149,13 @@ class Profile: percentage(v.hits, v.count), percentage(v.fits, v.count), v.count, v.count_formatted(), percentage(v.count, self.count_max()) )) - print ('\nLoop count: %d' % len(self.niter_vector)), - print(' avg. # of iter: %.2f' % average(self.niter_vector)) - print(' median # of iter: %.2f' % median(self.niter_vector)) - for v in [1, 5, 10, 20, 30]: - cut = 0.01 * v - print(' avg. (%d%% cutoff) # of iter: %.2f' % (v, average_cutoff(self.niter_vector, cut))) + if len(self.niter_vector) > 0: + print ('\nLoop count: %d' % len(self.niter_vector)), + print(' avg. # of iter: %.2f' % average(self.niter_vector)) + print(' median # of iter: %.2f' % median(self.niter_vector)) + for v in [1, 5, 10, 20, 30]: + cut = 0.01 * v + print(' avg. (%d%% cutoff) # of iter: %.2f' % (v, average_cutoff(self.niter_vector, cut))) parser = argparse.ArgumentParser() parser.add_argument('dump_file', metavar = 'dump_file', help = 'IPA profile dump file') |