00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 00036 /* ==================================================================== 00037 * ==================================================================== 00038 * 00039 * Module: cwh_stats.c 00040 * $Revision: 00041 * $Date$ 00042 * $Author$ 00043 * $Source: 00044 * 00045 * Revision history: 00046 * dd-mmm-95 - Original Version 00047 * 00048 * Description: Accumulates and prints statistics about the 00049 * conversion. Essentially a bunch of counters, 00050 * and associated strings. 00051 * 00052 * Counters for TYs are defined, 00053 * but there's no reason others couldn't be 00054 * added. Enums and macros in cwh_stats.h 00055 * define the counter groups and cwh_stats.i contains 00056 * the local definitions and strings. 00057 * 00058 * ==================================================================== 00059 * ==================================================================== 00060 */ 00061 00062 static char *source_file = __FILE__; 00063 00064 #ifdef _KEEP_RCS_ID 00065 static char *rcs_id = "$Source$ $Revision$"; 00066 #endif /* _KEEP_RCS_ID */ 00067 00068 00069 /* sgi includes */ 00070 00071 #include "defs.h" 00072 #include "stab.h" 00073 #include "tracing.h" 00074 00075 /* conversion includes */ 00076 00077 #include "cwh_stats.h" 00078 #include "cwh_stats.i" 00079 00080 /*================================================================ 00081 * 00082 * cwh_stats_print 00083 * 00084 * Top level routine to print stats. Calls one routine 00085 * for each group of items to print. Pass in the PU's ST. 00086 * 00087 * Only TY details are printed just now. 00088 * 00089 * invoked via -ttIRB:16 00090 * 00091 * ================================================================ 00092 */ 00093 extern void 00094 cwh_stats_print(ST * st) 00095 { 00096 CTR * cp ; 00097 00098 fprintf (TFile,"\n%s (last TY id %d) ",ST_name(st),SYMTAB_last_type_id(Global_Symtab)); 00099 00100 if (ST_pu_is_nested_func(st)) 00101 fprintf (TFile," (internal) "); 00102 00103 fprintf (TFile," \n \n"); 00104 00105 cwh_stats_print_details(&ty_c) ; 00106 00107 } 00108 00109 /*================================================================ 00110 * 00111 * cwh_stats_print_details 00112 * 00113 * Walk through array of counters 00114 * 00115 * a) print the values 00116 * b) save current values to compute increments per PU. 00117 * c) sum the values. 00118 * 00119 * ================================================================ 00120 */ 00121 static void 00122 cwh_stats_print_details( CTR * cp ) 00123 { 00124 00125 int sum,i,val ; 00126 sum = 0 ; 00127 00128 fprintf (TFile,CTR_misc_str(cp,0)); 00129 00130 for (i = 0 ; i < CTR_num(cp) ; i ++) { 00131 00132 val = CTR_count(cp,i); 00133 00134 if (CTR_add_to_sum(cp,i)) 00135 sum += val ; 00136 00137 if (val != 0) 00138 fprintf (TFile,CTR_str(cp,i),val,val-CTR_saved(cp,i)); 00139 00140 CTR_saved(cp,i) = val; 00141 00142 } 00143 00144 fprintf (TFile,CTR_misc_str(cp,1)); 00145 fprintf (TFile,CTR_misc_str(cp,2),sum,sum-CTR_saved_sum(cp)) ; 00146 CTR_saved_sum(cp) = sum; 00147 00148 } 00149
1.5.6