text.cc revision 6129
1695SN/A/* 21762SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan 3695SN/A * All rights reserved. 4695SN/A * 5695SN/A * Redistribution and use in source and binary forms, with or without 6695SN/A * modification, are permitted provided that the following conditions are 7695SN/A * met: redistributions of source code must retain the above copyright 8695SN/A * notice, this list of conditions and the following disclaimer; 9695SN/A * redistributions in binary form must reproduce the above copyright 10695SN/A * notice, this list of conditions and the following disclaimer in the 11695SN/A * documentation and/or other materials provided with the distribution; 12695SN/A * neither the name of the copyright holders nor the names of its 13695SN/A * contributors may be used to endorse or promote products derived from 14695SN/A * this software without specific prior written permission. 15695SN/A * 16695SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17695SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18695SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19695SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20695SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21695SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22695SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23695SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24695SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25695SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26695SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert 29695SN/A */ 30695SN/A 31873SN/A#if defined(__APPLE__) 32873SN/A#define _GLIBCPP_USE_C99 1 33873SN/A#endif 34873SN/A 353918Ssaidi@eecs.umich.edu#if defined(__sun) 363918Ssaidi@eecs.umich.edu#include <math.h> 373918Ssaidi@eecs.umich.edu#endif 383918Ssaidi@eecs.umich.edu 396129Snate@binkert.org#include <cassert> 406129Snate@binkert.org#ifdef __SUNPRO_CC 416129Snate@binkert.org#include <math.h> 426129Snate@binkert.org#endif 436129Snate@binkert.org#include <cmath> 44695SN/A#include <iostream> 452621SN/A#include <sstream> 46695SN/A#include <fstream> 47695SN/A#include <string> 48695SN/A 496129Snate@binkert.org#include "base/cast.hh" 50695SN/A#include "base/misc.hh" 516129Snate@binkert.org#include "base/str.hh" 526129Snate@binkert.org#include "base/stats/info.hh" 53695SN/A#include "base/stats/text.hh" 54695SN/A#include "base/stats/visit.hh" 55695SN/A 56695SN/Ausing namespace std; 57695SN/A 58695SN/A#ifndef NAN 59695SN/Afloat __nan(); 60695SN/A/** Define Not a number. */ 61695SN/A#define NAN (__nan()) 62695SN/A/** Need to define __nan() */ 63695SN/A#define __M5_NAN 64695SN/A#endif 65695SN/A 66695SN/A#ifdef __M5_NAN 67695SN/Afloat 68695SN/A__nan() 69695SN/A{ 70695SN/A union { 71695SN/A uint32_t ui; 72695SN/A float f; 73695SN/A } nan; 74695SN/A 75695SN/A nan.ui = 0x7fc00000; 76695SN/A return nan.f; 77695SN/A} 78695SN/A#endif 79695SN/A 80729SN/Anamespace Stats { 81695SN/A 826129Snate@binkert.orgstd::list<Info *> &statsList(); 836129Snate@binkert.org 84695SN/AText::Text() 856126Snate@binkert.org : mystream(false), stream(NULL), descriptions(false) 86695SN/A{ 87695SN/A} 88695SN/A 89695SN/AText::Text(std::ostream &stream) 906126Snate@binkert.org : mystream(false), stream(NULL), descriptions(false) 91695SN/A{ 92695SN/A open(stream); 93695SN/A} 94695SN/A 95695SN/AText::Text(const std::string &file) 966126Snate@binkert.org : mystream(false), stream(NULL), descriptions(false) 97695SN/A{ 98695SN/A open(file); 99695SN/A} 100695SN/A 101695SN/A 102695SN/AText::~Text() 103695SN/A{ 104695SN/A if (mystream) { 105695SN/A assert(stream); 106695SN/A delete stream; 107695SN/A } 108695SN/A} 109695SN/A 110695SN/Avoid 111695SN/AText::open(std::ostream &_stream) 112695SN/A{ 113695SN/A if (stream) 114695SN/A panic("stream already set!"); 115695SN/A 116695SN/A mystream = false; 117695SN/A stream = &_stream; 1185581Ssaidi@eecs.umich.edu if (!valid()) 1195581Ssaidi@eecs.umich.edu fatal("Unable to open output stream for writing\n"); 120695SN/A} 121695SN/A 122695SN/Avoid 123695SN/AText::open(const std::string &file) 124695SN/A{ 125695SN/A if (stream) 126695SN/A panic("stream already set!"); 127695SN/A 128695SN/A mystream = true; 129695SN/A stream = new ofstream(file.c_str(), ios::trunc); 1305581Ssaidi@eecs.umich.edu if (!valid()) 1315581Ssaidi@eecs.umich.edu fatal("Unable to open statistics file for writing\n"); 132695SN/A} 133695SN/A 134695SN/Abool 135695SN/AText::valid() const 136695SN/A{ 1375581Ssaidi@eecs.umich.edu return stream != NULL && stream->good(); 138695SN/A} 139695SN/A 140695SN/Avoid 141695SN/AText::output() 142695SN/A{ 143695SN/A ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n"); 1445887Snate@binkert.org list<Info *>::const_iterator i, end = statsList().end(); 1455887Snate@binkert.org for (i = statsList().begin(); i != end; ++i) 1462343SN/A (*i)->visit(*this); 147695SN/A ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n"); 148695SN/A stream->flush(); 149695SN/A} 150695SN/A 151695SN/Abool 1525886Snate@binkert.orgText::noOutput(const Info &info) 153695SN/A{ 1545886Snate@binkert.org if (!(info.flags & print)) 155695SN/A return true; 156695SN/A 1575886Snate@binkert.org if (info.prereq && info.prereq->zero()) 158695SN/A return true; 159695SN/A 160695SN/A return false; 161695SN/A} 162695SN/A 163695SN/Astring 1646126Snate@binkert.orgValueToString(Result value, int precision) 165695SN/A{ 166695SN/A stringstream val; 167695SN/A 168695SN/A if (!isnan(value)) { 169695SN/A if (precision != -1) 170695SN/A val.precision(precision); 171695SN/A else if (value == rint(value)) 172695SN/A val.precision(0); 173695SN/A 174695SN/A val.unsetf(ios::showpoint); 175695SN/A val.setf(ios::fixed); 176695SN/A val << value; 177695SN/A } else { 1786126Snate@binkert.org val << "no_value"; 179695SN/A } 180695SN/A 181695SN/A return val.str(); 182695SN/A} 183695SN/A 184695SN/Astruct ScalarPrint 185695SN/A{ 186695SN/A Result value; 187695SN/A string name; 188695SN/A string desc; 189695SN/A StatFlags flags; 190695SN/A bool descriptions; 191695SN/A int precision; 192695SN/A Result pdf; 193695SN/A Result cdf; 194695SN/A 195695SN/A void operator()(ostream &stream) const; 196695SN/A}; 197695SN/A 198695SN/Avoid 199695SN/AScalarPrint::operator()(ostream &stream) const 200695SN/A{ 2015570Snate@binkert.org if ((flags & nozero && value == 0.0) || 2025570Snate@binkert.org (flags & nonan && isnan(value))) 203695SN/A return; 204695SN/A 205695SN/A stringstream pdfstr, cdfstr; 206695SN/A 207695SN/A if (!isnan(pdf)) 208695SN/A ccprintf(pdfstr, "%.2f%%", pdf * 100.0); 209695SN/A 210695SN/A if (!isnan(cdf)) 211695SN/A ccprintf(cdfstr, "%.2f%%", cdf * 100.0); 212695SN/A 2136126Snate@binkert.org ccprintf(stream, "%-40s %12s %10s %10s", name, 2146126Snate@binkert.org ValueToString(value, precision), pdfstr, cdfstr); 215695SN/A 216695SN/A if (descriptions) { 217695SN/A if (!desc.empty()) 218695SN/A ccprintf(stream, " # %s", desc); 219695SN/A } 220695SN/A stream << endl; 221695SN/A} 222695SN/A 223695SN/Astruct VectorPrint 224695SN/A{ 225695SN/A string name; 226695SN/A string desc; 227695SN/A vector<string> subnames; 228695SN/A vector<string> subdescs; 229695SN/A StatFlags flags; 230695SN/A bool descriptions; 231695SN/A int precision; 232695SN/A VResult vec; 233695SN/A Result total; 234695SN/A 235695SN/A void operator()(ostream &stream) const; 236695SN/A}; 237695SN/A 238695SN/Avoid 239695SN/AVectorPrint::operator()(std::ostream &stream) const 240695SN/A{ 2415599Snate@binkert.org size_type _size = vec.size(); 242695SN/A Result _total = 0.0; 243695SN/A 244695SN/A if (flags & (pdf | cdf)) { 2455599Snate@binkert.org for (off_type i = 0; i < _size; ++i) { 246695SN/A _total += vec[i]; 247695SN/A } 248695SN/A } 249695SN/A 2506126Snate@binkert.org string base = name + "::"; 251695SN/A 252695SN/A ScalarPrint print; 253695SN/A print.name = name; 254695SN/A print.desc = desc; 255695SN/A print.precision = precision; 256695SN/A print.descriptions = descriptions; 257695SN/A print.flags = flags; 258695SN/A print.pdf = NAN; 259695SN/A print.cdf = NAN; 260695SN/A 261695SN/A bool havesub = !subnames.empty(); 262695SN/A 263695SN/A if (_size == 1) { 264695SN/A print.value = vec[0]; 265695SN/A print(stream); 2666126Snate@binkert.org return; 2676126Snate@binkert.org } 268695SN/A 2696126Snate@binkert.org for (off_type i = 0; i < _size; ++i) { 2706126Snate@binkert.org if (havesub && (i >= subnames.size() || subnames[i].empty())) 2716126Snate@binkert.org continue; 272695SN/A 2736126Snate@binkert.org print.name = base + (havesub ? subnames[i] : to_string(i)); 2746126Snate@binkert.org print.desc = subdescs.empty() ? desc : subdescs[i]; 2756126Snate@binkert.org print.value = vec[i]; 276695SN/A 2776126Snate@binkert.org if (_total && flags & pdf) { 2786126Snate@binkert.org print.pdf = vec[i] / _total; 2796126Snate@binkert.org print.cdf += print.pdf; 280695SN/A } 281695SN/A 2826126Snate@binkert.org print(stream); 2836126Snate@binkert.org } 284695SN/A 2856126Snate@binkert.org if (flags & ::Stats::total) { 2866126Snate@binkert.org print.pdf = NAN; 2876126Snate@binkert.org print.cdf = NAN; 2886126Snate@binkert.org print.name = base + "total"; 2896126Snate@binkert.org print.desc = desc; 2906126Snate@binkert.org print.value = total; 2916126Snate@binkert.org print(stream); 292695SN/A } 293695SN/A} 294695SN/A 295695SN/Astruct DistPrint 296695SN/A{ 297695SN/A string name; 298695SN/A string desc; 299695SN/A StatFlags flags; 300695SN/A bool descriptions; 301695SN/A int precision; 302695SN/A 303695SN/A Counter min; 304695SN/A Counter max; 305695SN/A Counter bucket_size; 3065599Snate@binkert.org size_type size; 307695SN/A bool fancy; 308695SN/A 3096004Snate@binkert.org const DistData &data; 3106004Snate@binkert.org 3116128Snate@binkert.org DistPrint(const Text *text, const DistInfo &info); 3126128Snate@binkert.org DistPrint(const Text *text, const VectorDistInfo &info, int i); 3136125Snate@binkert.org void init(const Text *text, const Info &info, const DistParams *params); 314695SN/A void operator()(ostream &stream) const; 315695SN/A}; 316695SN/A 3176128Snate@binkert.orgDistPrint::DistPrint(const Text *text, const DistInfo &info) 3186004Snate@binkert.org : data(info.data) 3196004Snate@binkert.org{ 3206125Snate@binkert.org init(text, info, safe_cast<const DistParams *>(info.storageParams)); 3216004Snate@binkert.org} 3226004Snate@binkert.org 3236128Snate@binkert.orgDistPrint::DistPrint(const Text *text, const VectorDistInfo &info, int i) 3246004Snate@binkert.org : data(info.data[i]) 3256004Snate@binkert.org{ 3266125Snate@binkert.org init(text, info, safe_cast<const DistParams *>(info.storageParams)); 3276004Snate@binkert.org 3286004Snate@binkert.org name = info.name + "_" + 3296004Snate@binkert.org (info.subnames[i].empty() ? (to_string(i)) : info.subnames[i]); 3306004Snate@binkert.org 3316004Snate@binkert.org if (!info.subdescs[i].empty()) 3326004Snate@binkert.org desc = info.subdescs[i]; 3336004Snate@binkert.org} 3346004Snate@binkert.org 3356004Snate@binkert.orgvoid 3366125Snate@binkert.orgDistPrint::init(const Text *text, const Info &info, const DistParams *params) 3376004Snate@binkert.org{ 3386004Snate@binkert.org name = info.name; 3396004Snate@binkert.org desc = info.desc; 3406004Snate@binkert.org flags = info.flags; 3416004Snate@binkert.org precision = info.precision; 3426125Snate@binkert.org descriptions = text->descriptions; 3436004Snate@binkert.org 3446004Snate@binkert.org fancy = params->fancy; 3456004Snate@binkert.org min = params->min; 3466004Snate@binkert.org max = params->max; 3476004Snate@binkert.org bucket_size = params->bucket_size; 3486004Snate@binkert.org size = params->buckets; 3496004Snate@binkert.org} 3506004Snate@binkert.org 351695SN/Avoid 352695SN/ADistPrint::operator()(ostream &stream) const 353695SN/A{ 3546004Snate@binkert.org Result stdev = NAN; 3556004Snate@binkert.org if (data.samples) 3566004Snate@binkert.org stdev = sqrt((data.samples * data.squares - data.sum * data.sum) / 3576004Snate@binkert.org (data.samples * (data.samples - 1.0))); 3586004Snate@binkert.org 359695SN/A if (fancy) { 360695SN/A ScalarPrint print; 3616126Snate@binkert.org string base = name + "::"; 362695SN/A 363695SN/A print.precision = precision; 364695SN/A print.flags = flags; 365695SN/A print.descriptions = descriptions; 366695SN/A print.desc = desc; 367695SN/A print.pdf = NAN; 368695SN/A print.cdf = NAN; 369695SN/A 370695SN/A print.name = base + "mean"; 3716004Snate@binkert.org print.value = data.samples ? data.sum / data.samples : NAN; 372695SN/A print(stream); 373695SN/A 374695SN/A print.name = base + "stdev"; 3756004Snate@binkert.org print.value = stdev; 376695SN/A print(stream); 377695SN/A 378695SN/A print.name = "**Ignore: " + base + "TOT"; 3796004Snate@binkert.org print.value = data.samples; 380695SN/A print(stream); 381695SN/A return; 382695SN/A } 383695SN/A 3846004Snate@binkert.org assert(size == data.cvec.size()); 385695SN/A 386695SN/A Result total = 0.0; 387695SN/A 3886004Snate@binkert.org total += data.underflow; 3895599Snate@binkert.org for (off_type i = 0; i < size; ++i) 3906004Snate@binkert.org total += data.cvec[i]; 3916004Snate@binkert.org total += data.overflow; 392695SN/A 3936126Snate@binkert.org string base = name + "::"; 394695SN/A 395695SN/A ScalarPrint print; 3966126Snate@binkert.org print.desc = desc; 397695SN/A print.flags = flags; 398695SN/A print.descriptions = descriptions; 399695SN/A print.precision = precision; 400695SN/A print.pdf = NAN; 401695SN/A print.cdf = NAN; 402695SN/A 403695SN/A print.name = base + "samples"; 4046004Snate@binkert.org print.value = data.samples; 405695SN/A print(stream); 406695SN/A 407695SN/A print.name = base + "min_value"; 4086004Snate@binkert.org print.value = data.min_val; 409695SN/A print(stream); 410695SN/A 4116126Snate@binkert.org print.name = base + "underflows"; 4126126Snate@binkert.org print.value = data.underflow; 4136126Snate@binkert.org if (total) { 4146126Snate@binkert.org print.pdf = data.underflow / total; 4156126Snate@binkert.org print.cdf += print.pdf; 4166126Snate@binkert.org } 4176126Snate@binkert.org print(stream); 4186126Snate@binkert.org 4196126Snate@binkert.org for (off_type i = 0; i < size; ++i) { 4206126Snate@binkert.org stringstream namestr; 4216126Snate@binkert.org namestr << base; 4226126Snate@binkert.org 4236126Snate@binkert.org Counter low = i * bucket_size + min; 4246126Snate@binkert.org Counter high = ::min(low + bucket_size, max); 4256126Snate@binkert.org namestr << low; 4266126Snate@binkert.org if (low < high) 4276126Snate@binkert.org namestr << "-" << high; 4286126Snate@binkert.org 4296126Snate@binkert.org print.name = namestr.str(); 4306126Snate@binkert.org print.value = data.cvec[i]; 4316126Snate@binkert.org if (total) { 4326126Snate@binkert.org print.pdf = data.cvec[i] / total; 433695SN/A print.cdf += print.pdf; 434695SN/A } 435695SN/A print(stream); 436695SN/A } 437695SN/A 4386126Snate@binkert.org print.name = base + "overflows"; 4396126Snate@binkert.org print.value = data.overflow; 4406126Snate@binkert.org if (total) { 4416126Snate@binkert.org print.pdf = data.overflow / total; 4426126Snate@binkert.org print.cdf += print.pdf; 443695SN/A } else { 4446126Snate@binkert.org print.pdf = NAN; 4456126Snate@binkert.org print.cdf = NAN; 446695SN/A } 4476126Snate@binkert.org print(stream); 448695SN/A 449695SN/A print.pdf = NAN; 450695SN/A print.cdf = NAN; 451695SN/A 4526126Snate@binkert.org print.name = base + "total"; 4536126Snate@binkert.org print.value = total; 4546126Snate@binkert.org print(stream); 455695SN/A 456695SN/A print.name = base + "max_value"; 4576004Snate@binkert.org print.value = data.max_val; 458695SN/A print(stream); 459695SN/A 4606126Snate@binkert.org print.name = base + "mean"; 4616126Snate@binkert.org print.value = data.sum / data.samples; 4626126Snate@binkert.org print(stream); 463695SN/A 4646126Snate@binkert.org print.name = base + "stdev"; 4656126Snate@binkert.org print.value = stdev; 4666126Snate@binkert.org print(stream); 467695SN/A} 468695SN/A 469695SN/Avoid 4706128Snate@binkert.orgText::visit(const ScalarInfo &info) 471695SN/A{ 4725886Snate@binkert.org if (noOutput(info)) 473695SN/A return; 474695SN/A 475695SN/A ScalarPrint print; 4765886Snate@binkert.org print.value = info.result(); 4775886Snate@binkert.org print.name = info.name; 4785886Snate@binkert.org print.desc = info.desc; 4795886Snate@binkert.org print.flags = info.flags; 480695SN/A print.descriptions = descriptions; 4815886Snate@binkert.org print.precision = info.precision; 482695SN/A print.pdf = NAN; 483695SN/A print.cdf = NAN; 484695SN/A 485695SN/A print(*stream); 486695SN/A} 487695SN/A 488695SN/Avoid 4896128Snate@binkert.orgText::visit(const VectorInfo &info) 490695SN/A{ 4915886Snate@binkert.org if (noOutput(info)) 492695SN/A return; 493695SN/A 4945886Snate@binkert.org size_type size = info.size(); 495695SN/A VectorPrint print; 496695SN/A 4975886Snate@binkert.org print.name = info.name; 4985886Snate@binkert.org print.desc = info.desc; 4995886Snate@binkert.org print.flags = info.flags; 500695SN/A print.descriptions = descriptions; 5015886Snate@binkert.org print.precision = info.precision; 5025886Snate@binkert.org print.vec = info.result(); 5035886Snate@binkert.org print.total = info.total(); 504695SN/A 5055886Snate@binkert.org if (!info.subnames.empty()) { 5065599Snate@binkert.org for (off_type i = 0; i < size; ++i) { 5075886Snate@binkert.org if (!info.subnames[i].empty()) { 5085886Snate@binkert.org print.subnames = info.subnames; 509695SN/A print.subnames.resize(size); 5105599Snate@binkert.org for (off_type i = 0; i < size; ++i) { 5115886Snate@binkert.org if (!info.subnames[i].empty() && 5125886Snate@binkert.org !info.subdescs[i].empty()) { 5135886Snate@binkert.org print.subdescs = info.subdescs; 514695SN/A print.subdescs.resize(size); 515695SN/A break; 516695SN/A } 517695SN/A } 518695SN/A break; 519695SN/A } 520695SN/A } 521695SN/A } 522695SN/A 523695SN/A print(*stream); 524695SN/A} 525695SN/A 526695SN/Avoid 5276128Snate@binkert.orgText::visit(const Vector2dInfo &info) 528695SN/A{ 5295886Snate@binkert.org if (noOutput(info)) 530695SN/A return; 531695SN/A 532695SN/A bool havesub = false; 533695SN/A VectorPrint print; 534695SN/A 5355886Snate@binkert.org print.subnames = info.y_subnames; 5365886Snate@binkert.org print.flags = info.flags; 537695SN/A print.descriptions = descriptions; 5385886Snate@binkert.org print.precision = info.precision; 539695SN/A 5405886Snate@binkert.org if (!info.subnames.empty()) { 5415886Snate@binkert.org for (off_type i = 0; i < info.x; ++i) 5425886Snate@binkert.org if (!info.subnames[i].empty()) 543695SN/A havesub = true; 544695SN/A } 545695SN/A 5465886Snate@binkert.org VResult tot_vec(info.y); 547695SN/A Result super_total = 0.0; 5485886Snate@binkert.org for (off_type i = 0; i < info.x; ++i) { 5495886Snate@binkert.org if (havesub && (i >= info.subnames.size() || info.subnames[i].empty())) 550695SN/A continue; 551695SN/A 5525886Snate@binkert.org off_type iy = i * info.y; 5535886Snate@binkert.org VResult yvec(info.y); 554695SN/A 555695SN/A Result total = 0.0; 5565886Snate@binkert.org for (off_type j = 0; j < info.y; ++j) { 5575886Snate@binkert.org yvec[j] = info.cvec[iy + j]; 558695SN/A tot_vec[j] += yvec[j]; 559695SN/A total += yvec[j]; 560695SN/A super_total += yvec[j]; 561695SN/A } 562695SN/A 5635886Snate@binkert.org print.name = info.name + "_" + 5645886Snate@binkert.org (havesub ? info.subnames[i] : to_string(i)); 5655886Snate@binkert.org print.desc = info.desc; 566695SN/A print.vec = yvec; 567695SN/A print.total = total; 568695SN/A print(*stream); 569695SN/A } 570695SN/A 5715886Snate@binkert.org if ((info.flags & ::Stats::total) && (info.x > 1)) { 5725886Snate@binkert.org print.name = info.name; 5735886Snate@binkert.org print.desc = info.desc; 574695SN/A print.vec = tot_vec; 575695SN/A print.total = super_total; 576695SN/A print(*stream); 577695SN/A } 578695SN/A} 579695SN/A 580695SN/Avoid 5816128Snate@binkert.orgText::visit(const DistInfo &info) 582695SN/A{ 5835886Snate@binkert.org if (noOutput(info)) 584695SN/A return; 585695SN/A 5866125Snate@binkert.org DistPrint print(this, info); 587695SN/A print(*stream); 588695SN/A} 589695SN/A 590695SN/Avoid 5916128Snate@binkert.orgText::visit(const VectorDistInfo &info) 592695SN/A{ 5935886Snate@binkert.org if (noOutput(info)) 594695SN/A return; 595695SN/A 5965886Snate@binkert.org for (off_type i = 0; i < info.size(); ++i) { 5976125Snate@binkert.org DistPrint print(this, info, i); 598695SN/A print(*stream); 599695SN/A } 600695SN/A} 601695SN/A 602695SN/Avoid 6036128Snate@binkert.orgText::visit(const FormulaInfo &info) 604695SN/A{ 6056128Snate@binkert.org visit((const VectorInfo &)info); 606695SN/A} 607695SN/A 6084078Sbinkertn@umich.edubool 6096126Snate@binkert.orginitText(const string &filename, bool desc) 6104078Sbinkertn@umich.edu{ 6114078Sbinkertn@umich.edu static Text text; 6124078Sbinkertn@umich.edu static bool connected = false; 6134078Sbinkertn@umich.edu 6144078Sbinkertn@umich.edu if (connected) 6154078Sbinkertn@umich.edu return false; 6164078Sbinkertn@umich.edu 6174078Sbinkertn@umich.edu extern list<Output *> OutputList; 6184078Sbinkertn@umich.edu 6194078Sbinkertn@umich.edu text.open(*simout.find(filename)); 6204078Sbinkertn@umich.edu text.descriptions = desc; 6214078Sbinkertn@umich.edu OutputList.push_back(&text); 6224078Sbinkertn@umich.edu connected = true; 6234078Sbinkertn@umich.edu 6244078Sbinkertn@umich.edu return true; 6254078Sbinkertn@umich.edu} 6264078Sbinkertn@umich.edu 627729SN/A/* namespace Stats */ } 628