text.cc (6129:05405c5b8c16) | text.cc (6130:0fb959250892) |
---|---|
1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 137 unchanged lines hidden (view full) --- 146 (*i)->visit(*this); 147 ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n"); 148 stream->flush(); 149} 150 151bool 152Text::noOutput(const Info &info) 153{ | 1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 137 unchanged lines hidden (view full) --- 146 (*i)->visit(*this); 147 ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n"); 148 stream->flush(); 149} 150 151bool 152Text::noOutput(const Info &info) 153{ |
154 if (!(info.flags & print)) | 154 if (!info.flags.isSet(print)) |
155 return true; 156 157 if (info.prereq && info.prereq->zero()) 158 return true; 159 160 return false; 161} 162 --- 18 unchanged lines hidden (view full) --- 181 return val.str(); 182} 183 184struct ScalarPrint 185{ 186 Result value; 187 string name; 188 string desc; | 155 return true; 156 157 if (info.prereq && info.prereq->zero()) 158 return true; 159 160 return false; 161} 162 --- 18 unchanged lines hidden (view full) --- 181 return val.str(); 182} 183 184struct ScalarPrint 185{ 186 Result value; 187 string name; 188 string desc; |
189 StatFlags flags; | 189 Flags flags; |
190 bool descriptions; 191 int precision; 192 Result pdf; 193 Result cdf; 194 195 void operator()(ostream &stream) const; 196}; 197 198void 199ScalarPrint::operator()(ostream &stream) const 200{ | 190 bool descriptions; 191 int precision; 192 Result pdf; 193 Result cdf; 194 195 void operator()(ostream &stream) const; 196}; 197 198void 199ScalarPrint::operator()(ostream &stream) const 200{ |
201 if ((flags & nozero && value == 0.0) || 202 (flags & nonan && isnan(value))) | 201 if ((flags.isSet(nozero) && value == 0.0) || 202 (flags.isSet(nonan) && isnan(value))) |
203 return; 204 205 stringstream pdfstr, cdfstr; 206 207 if (!isnan(pdf)) 208 ccprintf(pdfstr, "%.2f%%", pdf * 100.0); 209 210 if (!isnan(cdf)) --- 10 unchanged lines hidden (view full) --- 221} 222 223struct VectorPrint 224{ 225 string name; 226 string desc; 227 vector<string> subnames; 228 vector<string> subdescs; | 203 return; 204 205 stringstream pdfstr, cdfstr; 206 207 if (!isnan(pdf)) 208 ccprintf(pdfstr, "%.2f%%", pdf * 100.0); 209 210 if (!isnan(cdf)) --- 10 unchanged lines hidden (view full) --- 221} 222 223struct VectorPrint 224{ 225 string name; 226 string desc; 227 vector<string> subnames; 228 vector<string> subdescs; |
229 StatFlags flags; | 229 Flags flags; |
230 bool descriptions; 231 int precision; 232 VResult vec; 233 Result total; 234 235 void operator()(ostream &stream) const; 236}; 237 238void 239VectorPrint::operator()(std::ostream &stream) const 240{ 241 size_type _size = vec.size(); 242 Result _total = 0.0; 243 | 230 bool descriptions; 231 int precision; 232 VResult vec; 233 Result total; 234 235 void operator()(ostream &stream) const; 236}; 237 238void 239VectorPrint::operator()(std::ostream &stream) const 240{ 241 size_type _size = vec.size(); 242 Result _total = 0.0; 243 |
244 if (flags & (pdf | cdf)) { | 244 if (flags.isSet(pdf | cdf)) { |
245 for (off_type i = 0; i < _size; ++i) { 246 _total += vec[i]; 247 } 248 } 249 250 string base = name + "::"; 251 252 ScalarPrint print; --- 16 unchanged lines hidden (view full) --- 269 for (off_type i = 0; i < _size; ++i) { 270 if (havesub && (i >= subnames.size() || subnames[i].empty())) 271 continue; 272 273 print.name = base + (havesub ? subnames[i] : to_string(i)); 274 print.desc = subdescs.empty() ? desc : subdescs[i]; 275 print.value = vec[i]; 276 | 245 for (off_type i = 0; i < _size; ++i) { 246 _total += vec[i]; 247 } 248 } 249 250 string base = name + "::"; 251 252 ScalarPrint print; --- 16 unchanged lines hidden (view full) --- 269 for (off_type i = 0; i < _size; ++i) { 270 if (havesub && (i >= subnames.size() || subnames[i].empty())) 271 continue; 272 273 print.name = base + (havesub ? subnames[i] : to_string(i)); 274 print.desc = subdescs.empty() ? desc : subdescs[i]; 275 print.value = vec[i]; 276 |
277 if (_total && flags & pdf) { | 277 if (_total && flags.isSet(pdf)) { |
278 print.pdf = vec[i] / _total; 279 print.cdf += print.pdf; 280 } 281 282 print(stream); 283 } 284 | 278 print.pdf = vec[i] / _total; 279 print.cdf += print.pdf; 280 } 281 282 print(stream); 283 } 284 |
285 if (flags & ::Stats::total) { | 285 if (flags.isSet(::Stats::total)) { |
286 print.pdf = NAN; 287 print.cdf = NAN; 288 print.name = base + "total"; 289 print.desc = desc; 290 print.value = total; 291 print(stream); 292 } 293} 294 295struct DistPrint 296{ 297 string name; 298 string desc; | 286 print.pdf = NAN; 287 print.cdf = NAN; 288 print.name = base + "total"; 289 print.desc = desc; 290 print.value = total; 291 print(stream); 292 } 293} 294 295struct DistPrint 296{ 297 string name; 298 string desc; |
299 StatFlags flags; | 299 Flags flags; |
300 bool descriptions; 301 int precision; 302 303 Counter min; 304 Counter max; 305 Counter bucket_size; 306 size_type size; 307 bool fancy; --- 255 unchanged lines hidden (view full) --- 563 print.name = info.name + "_" + 564 (havesub ? info.subnames[i] : to_string(i)); 565 print.desc = info.desc; 566 print.vec = yvec; 567 print.total = total; 568 print(*stream); 569 } 570 | 300 bool descriptions; 301 int precision; 302 303 Counter min; 304 Counter max; 305 Counter bucket_size; 306 size_type size; 307 bool fancy; --- 255 unchanged lines hidden (view full) --- 563 print.name = info.name + "_" + 564 (havesub ? info.subnames[i] : to_string(i)); 565 print.desc = info.desc; 566 print.vec = yvec; 567 print.total = total; 568 print(*stream); 569 } 570 |
571 if ((info.flags & ::Stats::total) && (info.x > 1)) { | 571 if (info.flags.isSet(::Stats::total) && (info.x > 1)) { |
572 print.name = info.name; 573 print.desc = info.desc; 574 print.vec = tot_vec; 575 print.total = super_total; 576 print(*stream); 577 } 578} 579 --- 48 unchanged lines hidden --- | 572 print.name = info.name; 573 print.desc = info.desc; 574 print.vec = tot_vec; 575 print.total = super_total; 576 print(*stream); 577 } 578} 579 --- 48 unchanged lines hidden --- |