text.cc revision 6128
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
39695SN/A#include <iostream>
402621SN/A#include <sstream>
41695SN/A#include <fstream>
42695SN/A#include <string>
43695SN/A
44695SN/A#include "base/misc.hh"
45695SN/A#include "base/statistics.hh"
46695SN/A#include "base/stats/text.hh"
47695SN/A#include "base/stats/visit.hh"
48695SN/A
49695SN/Ausing namespace std;
50695SN/A
51695SN/A#ifndef NAN
52695SN/Afloat __nan();
53695SN/A/** Define Not a number. */
54695SN/A#define NAN (__nan())
55695SN/A/** Need to define __nan() */
56695SN/A#define __M5_NAN
57695SN/A#endif
58695SN/A
59695SN/A#ifdef __M5_NAN
60695SN/Afloat
61695SN/A__nan()
62695SN/A{
63695SN/A    union {
64695SN/A        uint32_t ui;
65695SN/A        float f;
66695SN/A    } nan;
67695SN/A
68695SN/A    nan.ui = 0x7fc00000;
69695SN/A    return nan.f;
70695SN/A}
71695SN/A#endif
72695SN/A
73729SN/Anamespace Stats {
74695SN/A
75695SN/AText::Text()
766126Snate@binkert.org    : mystream(false), stream(NULL), descriptions(false)
77695SN/A{
78695SN/A}
79695SN/A
80695SN/AText::Text(std::ostream &stream)
816126Snate@binkert.org    : mystream(false), stream(NULL), descriptions(false)
82695SN/A{
83695SN/A    open(stream);
84695SN/A}
85695SN/A
86695SN/AText::Text(const std::string &file)
876126Snate@binkert.org    : mystream(false), stream(NULL), descriptions(false)
88695SN/A{
89695SN/A    open(file);
90695SN/A}
91695SN/A
92695SN/A
93695SN/AText::~Text()
94695SN/A{
95695SN/A    if (mystream) {
96695SN/A        assert(stream);
97695SN/A        delete stream;
98695SN/A    }
99695SN/A}
100695SN/A
101695SN/Avoid
102695SN/AText::open(std::ostream &_stream)
103695SN/A{
104695SN/A    if (stream)
105695SN/A        panic("stream already set!");
106695SN/A
107695SN/A    mystream = false;
108695SN/A    stream = &_stream;
1095581Ssaidi@eecs.umich.edu    if (!valid())
1105581Ssaidi@eecs.umich.edu        fatal("Unable to open output stream for writing\n");
111695SN/A}
112695SN/A
113695SN/Avoid
114695SN/AText::open(const std::string &file)
115695SN/A{
116695SN/A    if (stream)
117695SN/A        panic("stream already set!");
118695SN/A
119695SN/A    mystream = true;
120695SN/A    stream = new ofstream(file.c_str(), ios::trunc);
1215581Ssaidi@eecs.umich.edu    if (!valid())
1225581Ssaidi@eecs.umich.edu        fatal("Unable to open statistics file for writing\n");
123695SN/A}
124695SN/A
125695SN/Abool
126695SN/AText::valid() const
127695SN/A{
1285581Ssaidi@eecs.umich.edu    return stream != NULL && stream->good();
129695SN/A}
130695SN/A
131695SN/Avoid
132695SN/AText::output()
133695SN/A{
134695SN/A    ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n");
1355887Snate@binkert.org    list<Info *>::const_iterator i, end = statsList().end();
1365887Snate@binkert.org    for (i = statsList().begin(); i != end; ++i)
1372343SN/A        (*i)->visit(*this);
138695SN/A    ccprintf(*stream, "\n---------- End Simulation Statistics   ----------\n");
139695SN/A    stream->flush();
140695SN/A}
141695SN/A
142695SN/Abool
1435886Snate@binkert.orgText::noOutput(const Info &info)
144695SN/A{
1455886Snate@binkert.org    if (!(info.flags & print))
146695SN/A        return true;
147695SN/A
1485886Snate@binkert.org    if (info.prereq && info.prereq->zero())
149695SN/A        return true;
150695SN/A
151695SN/A    return false;
152695SN/A}
153695SN/A
154695SN/Astring
1556126Snate@binkert.orgValueToString(Result value, int precision)
156695SN/A{
157695SN/A    stringstream val;
158695SN/A
159695SN/A    if (!isnan(value)) {
160695SN/A        if (precision != -1)
161695SN/A            val.precision(precision);
162695SN/A        else if (value == rint(value))
163695SN/A            val.precision(0);
164695SN/A
165695SN/A        val.unsetf(ios::showpoint);
166695SN/A        val.setf(ios::fixed);
167695SN/A        val << value;
168695SN/A    } else {
1696126Snate@binkert.org        val << "no_value";
170695SN/A    }
171695SN/A
172695SN/A    return val.str();
173695SN/A}
174695SN/A
175695SN/Astruct ScalarPrint
176695SN/A{
177695SN/A    Result value;
178695SN/A    string name;
179695SN/A    string desc;
180695SN/A    StatFlags flags;
181695SN/A    bool descriptions;
182695SN/A    int precision;
183695SN/A    Result pdf;
184695SN/A    Result cdf;
185695SN/A
186695SN/A    void operator()(ostream &stream) const;
187695SN/A};
188695SN/A
189695SN/Avoid
190695SN/AScalarPrint::operator()(ostream &stream) const
191695SN/A{
1925570Snate@binkert.org    if ((flags & nozero && value == 0.0) ||
1935570Snate@binkert.org        (flags & nonan && isnan(value)))
194695SN/A        return;
195695SN/A
196695SN/A    stringstream pdfstr, cdfstr;
197695SN/A
198695SN/A    if (!isnan(pdf))
199695SN/A        ccprintf(pdfstr, "%.2f%%", pdf * 100.0);
200695SN/A
201695SN/A    if (!isnan(cdf))
202695SN/A        ccprintf(cdfstr, "%.2f%%", cdf * 100.0);
203695SN/A
2046126Snate@binkert.org    ccprintf(stream, "%-40s %12s %10s %10s", name,
2056126Snate@binkert.org             ValueToString(value, precision), pdfstr, cdfstr);
206695SN/A
207695SN/A    if (descriptions) {
208695SN/A        if (!desc.empty())
209695SN/A            ccprintf(stream, " # %s", desc);
210695SN/A    }
211695SN/A    stream << endl;
212695SN/A}
213695SN/A
214695SN/Astruct VectorPrint
215695SN/A{
216695SN/A    string name;
217695SN/A    string desc;
218695SN/A    vector<string> subnames;
219695SN/A    vector<string> subdescs;
220695SN/A    StatFlags flags;
221695SN/A    bool descriptions;
222695SN/A    int precision;
223695SN/A    VResult vec;
224695SN/A    Result total;
225695SN/A
226695SN/A    void operator()(ostream &stream) const;
227695SN/A};
228695SN/A
229695SN/Avoid
230695SN/AVectorPrint::operator()(std::ostream &stream) const
231695SN/A{
2325599Snate@binkert.org    size_type _size = vec.size();
233695SN/A    Result _total = 0.0;
234695SN/A
235695SN/A    if (flags & (pdf | cdf)) {
2365599Snate@binkert.org        for (off_type i = 0; i < _size; ++i) {
237695SN/A            _total += vec[i];
238695SN/A        }
239695SN/A    }
240695SN/A
2416126Snate@binkert.org    string base = name + "::";
242695SN/A
243695SN/A    ScalarPrint print;
244695SN/A    print.name = name;
245695SN/A    print.desc = desc;
246695SN/A    print.precision = precision;
247695SN/A    print.descriptions = descriptions;
248695SN/A    print.flags = flags;
249695SN/A    print.pdf = NAN;
250695SN/A    print.cdf = NAN;
251695SN/A
252695SN/A    bool havesub = !subnames.empty();
253695SN/A
254695SN/A    if (_size == 1) {
255695SN/A        print.value = vec[0];
256695SN/A        print(stream);
2576126Snate@binkert.org        return;
2586126Snate@binkert.org    }
259695SN/A
2606126Snate@binkert.org    for (off_type i = 0; i < _size; ++i) {
2616126Snate@binkert.org        if (havesub && (i >= subnames.size() || subnames[i].empty()))
2626126Snate@binkert.org            continue;
263695SN/A
2646126Snate@binkert.org        print.name = base + (havesub ? subnames[i] : to_string(i));
2656126Snate@binkert.org        print.desc = subdescs.empty() ? desc : subdescs[i];
2666126Snate@binkert.org        print.value = vec[i];
267695SN/A
2686126Snate@binkert.org        if (_total && flags & pdf) {
2696126Snate@binkert.org            print.pdf = vec[i] / _total;
2706126Snate@binkert.org            print.cdf += print.pdf;
271695SN/A        }
272695SN/A
2736126Snate@binkert.org        print(stream);
2746126Snate@binkert.org    }
275695SN/A
2766126Snate@binkert.org    if (flags & ::Stats::total) {
2776126Snate@binkert.org        print.pdf = NAN;
2786126Snate@binkert.org        print.cdf = NAN;
2796126Snate@binkert.org        print.name = base + "total";
2806126Snate@binkert.org        print.desc = desc;
2816126Snate@binkert.org        print.value = total;
2826126Snate@binkert.org        print(stream);
283695SN/A    }
284695SN/A}
285695SN/A
286695SN/Astruct DistPrint
287695SN/A{
288695SN/A    string name;
289695SN/A    string desc;
290695SN/A    StatFlags flags;
291695SN/A    bool descriptions;
292695SN/A    int precision;
293695SN/A
294695SN/A    Counter min;
295695SN/A    Counter max;
296695SN/A    Counter bucket_size;
2975599Snate@binkert.org    size_type size;
298695SN/A    bool fancy;
299695SN/A
3006004Snate@binkert.org    const DistData &data;
3016004Snate@binkert.org
3026128Snate@binkert.org    DistPrint(const Text *text, const DistInfo &info);
3036128Snate@binkert.org    DistPrint(const Text *text, const VectorDistInfo &info, int i);
3046125Snate@binkert.org    void init(const Text *text, const Info &info, const DistParams *params);
305695SN/A    void operator()(ostream &stream) const;
306695SN/A};
307695SN/A
3086128Snate@binkert.orgDistPrint::DistPrint(const Text *text, const DistInfo &info)
3096004Snate@binkert.org    : data(info.data)
3106004Snate@binkert.org{
3116125Snate@binkert.org    init(text, info, safe_cast<const DistParams *>(info.storageParams));
3126004Snate@binkert.org}
3136004Snate@binkert.org
3146128Snate@binkert.orgDistPrint::DistPrint(const Text *text, const VectorDistInfo &info, int i)
3156004Snate@binkert.org    : data(info.data[i])
3166004Snate@binkert.org{
3176125Snate@binkert.org    init(text, info, safe_cast<const DistParams *>(info.storageParams));
3186004Snate@binkert.org
3196004Snate@binkert.org    name = info.name + "_" +
3206004Snate@binkert.org        (info.subnames[i].empty() ? (to_string(i)) : info.subnames[i]);
3216004Snate@binkert.org
3226004Snate@binkert.org    if (!info.subdescs[i].empty())
3236004Snate@binkert.org        desc = info.subdescs[i];
3246004Snate@binkert.org}
3256004Snate@binkert.org
3266004Snate@binkert.orgvoid
3276125Snate@binkert.orgDistPrint::init(const Text *text, const Info &info, const DistParams *params)
3286004Snate@binkert.org{
3296004Snate@binkert.org    name = info.name;
3306004Snate@binkert.org    desc = info.desc;
3316004Snate@binkert.org    flags = info.flags;
3326004Snate@binkert.org    precision = info.precision;
3336125Snate@binkert.org    descriptions = text->descriptions;
3346004Snate@binkert.org
3356004Snate@binkert.org    fancy = params->fancy;
3366004Snate@binkert.org    min = params->min;
3376004Snate@binkert.org    max = params->max;
3386004Snate@binkert.org    bucket_size = params->bucket_size;
3396004Snate@binkert.org    size = params->buckets;
3406004Snate@binkert.org}
3416004Snate@binkert.org
342695SN/Avoid
343695SN/ADistPrint::operator()(ostream &stream) const
344695SN/A{
3456004Snate@binkert.org    Result stdev = NAN;
3466004Snate@binkert.org    if (data.samples)
3476004Snate@binkert.org        stdev = sqrt((data.samples * data.squares - data.sum * data.sum) /
3486004Snate@binkert.org                     (data.samples * (data.samples - 1.0)));
3496004Snate@binkert.org
350695SN/A    if (fancy) {
351695SN/A        ScalarPrint print;
3526126Snate@binkert.org        string base = name + "::";
353695SN/A
354695SN/A        print.precision = precision;
355695SN/A        print.flags = flags;
356695SN/A        print.descriptions = descriptions;
357695SN/A        print.desc = desc;
358695SN/A        print.pdf = NAN;
359695SN/A        print.cdf = NAN;
360695SN/A
361695SN/A        print.name = base + "mean";
3626004Snate@binkert.org        print.value = data.samples ? data.sum / data.samples : NAN;
363695SN/A        print(stream);
364695SN/A
365695SN/A        print.name = base + "stdev";
3666004Snate@binkert.org        print.value = stdev;
367695SN/A        print(stream);
368695SN/A
369695SN/A        print.name = "**Ignore: " + base + "TOT";
3706004Snate@binkert.org        print.value = data.samples;
371695SN/A        print(stream);
372695SN/A        return;
373695SN/A    }
374695SN/A
3756004Snate@binkert.org    assert(size == data.cvec.size());
376695SN/A
377695SN/A    Result total = 0.0;
378695SN/A
3796004Snate@binkert.org    total += data.underflow;
3805599Snate@binkert.org    for (off_type i = 0; i < size; ++i)
3816004Snate@binkert.org        total += data.cvec[i];
3826004Snate@binkert.org    total += data.overflow;
383695SN/A
3846126Snate@binkert.org    string base = name + "::";
385695SN/A
386695SN/A    ScalarPrint print;
3876126Snate@binkert.org    print.desc = desc;
388695SN/A    print.flags = flags;
389695SN/A    print.descriptions = descriptions;
390695SN/A    print.precision = precision;
391695SN/A    print.pdf = NAN;
392695SN/A    print.cdf = NAN;
393695SN/A
394695SN/A    print.name = base + "samples";
3956004Snate@binkert.org    print.value = data.samples;
396695SN/A    print(stream);
397695SN/A
398695SN/A    print.name = base + "min_value";
3996004Snate@binkert.org    print.value = data.min_val;
400695SN/A    print(stream);
401695SN/A
4026126Snate@binkert.org    print.name = base + "underflows";
4036126Snate@binkert.org    print.value = data.underflow;
4046126Snate@binkert.org    if (total) {
4056126Snate@binkert.org        print.pdf = data.underflow / total;
4066126Snate@binkert.org        print.cdf += print.pdf;
4076126Snate@binkert.org    }
4086126Snate@binkert.org    print(stream);
4096126Snate@binkert.org
4106126Snate@binkert.org    for (off_type i = 0; i < size; ++i) {
4116126Snate@binkert.org        stringstream namestr;
4126126Snate@binkert.org        namestr << base;
4136126Snate@binkert.org
4146126Snate@binkert.org        Counter low = i * bucket_size + min;
4156126Snate@binkert.org        Counter high = ::min(low + bucket_size, max);
4166126Snate@binkert.org        namestr << low;
4176126Snate@binkert.org        if (low < high)
4186126Snate@binkert.org            namestr << "-" << high;
4196126Snate@binkert.org
4206126Snate@binkert.org        print.name = namestr.str();
4216126Snate@binkert.org        print.value = data.cvec[i];
4226126Snate@binkert.org        if (total) {
4236126Snate@binkert.org            print.pdf = data.cvec[i] / total;
424695SN/A            print.cdf += print.pdf;
425695SN/A        }
426695SN/A        print(stream);
427695SN/A    }
428695SN/A
4296126Snate@binkert.org    print.name = base + "overflows";
4306126Snate@binkert.org    print.value = data.overflow;
4316126Snate@binkert.org    if (total) {
4326126Snate@binkert.org        print.pdf = data.overflow / total;
4336126Snate@binkert.org        print.cdf += print.pdf;
434695SN/A    } else {
4356126Snate@binkert.org        print.pdf = NAN;
4366126Snate@binkert.org        print.cdf = NAN;
437695SN/A    }
4386126Snate@binkert.org    print(stream);
439695SN/A
440695SN/A    print.pdf = NAN;
441695SN/A    print.cdf = NAN;
442695SN/A
4436126Snate@binkert.org    print.name = base + "total";
4446126Snate@binkert.org    print.value = total;
4456126Snate@binkert.org    print(stream);
446695SN/A
447695SN/A    print.name = base + "max_value";
4486004Snate@binkert.org    print.value = data.max_val;
449695SN/A    print(stream);
450695SN/A
4516126Snate@binkert.org    print.name = base + "mean";
4526126Snate@binkert.org    print.value = data.sum / data.samples;
4536126Snate@binkert.org    print(stream);
454695SN/A
4556126Snate@binkert.org    print.name = base + "stdev";
4566126Snate@binkert.org    print.value = stdev;
4576126Snate@binkert.org    print(stream);
458695SN/A}
459695SN/A
460695SN/Avoid
4616128Snate@binkert.orgText::visit(const ScalarInfo &info)
462695SN/A{
4635886Snate@binkert.org    if (noOutput(info))
464695SN/A        return;
465695SN/A
466695SN/A    ScalarPrint print;
4675886Snate@binkert.org    print.value = info.result();
4685886Snate@binkert.org    print.name = info.name;
4695886Snate@binkert.org    print.desc = info.desc;
4705886Snate@binkert.org    print.flags = info.flags;
471695SN/A    print.descriptions = descriptions;
4725886Snate@binkert.org    print.precision = info.precision;
473695SN/A    print.pdf = NAN;
474695SN/A    print.cdf = NAN;
475695SN/A
476695SN/A    print(*stream);
477695SN/A}
478695SN/A
479695SN/Avoid
4806128Snate@binkert.orgText::visit(const VectorInfo &info)
481695SN/A{
4825886Snate@binkert.org    if (noOutput(info))
483695SN/A        return;
484695SN/A
4855886Snate@binkert.org    size_type size = info.size();
486695SN/A    VectorPrint print;
487695SN/A
4885886Snate@binkert.org    print.name = info.name;
4895886Snate@binkert.org    print.desc = info.desc;
4905886Snate@binkert.org    print.flags = info.flags;
491695SN/A    print.descriptions = descriptions;
4925886Snate@binkert.org    print.precision = info.precision;
4935886Snate@binkert.org    print.vec = info.result();
4945886Snate@binkert.org    print.total = info.total();
495695SN/A
4965886Snate@binkert.org    if (!info.subnames.empty()) {
4975599Snate@binkert.org        for (off_type i = 0; i < size; ++i) {
4985886Snate@binkert.org            if (!info.subnames[i].empty()) {
4995886Snate@binkert.org                print.subnames = info.subnames;
500695SN/A                print.subnames.resize(size);
5015599Snate@binkert.org                for (off_type i = 0; i < size; ++i) {
5025886Snate@binkert.org                    if (!info.subnames[i].empty() &&
5035886Snate@binkert.org                        !info.subdescs[i].empty()) {
5045886Snate@binkert.org                        print.subdescs = info.subdescs;
505695SN/A                        print.subdescs.resize(size);
506695SN/A                        break;
507695SN/A                    }
508695SN/A                }
509695SN/A                break;
510695SN/A            }
511695SN/A        }
512695SN/A    }
513695SN/A
514695SN/A    print(*stream);
515695SN/A}
516695SN/A
517695SN/Avoid
5186128Snate@binkert.orgText::visit(const Vector2dInfo &info)
519695SN/A{
5205886Snate@binkert.org    if (noOutput(info))
521695SN/A        return;
522695SN/A
523695SN/A    bool havesub = false;
524695SN/A    VectorPrint print;
525695SN/A
5265886Snate@binkert.org    print.subnames = info.y_subnames;
5275886Snate@binkert.org    print.flags = info.flags;
528695SN/A    print.descriptions = descriptions;
5295886Snate@binkert.org    print.precision = info.precision;
530695SN/A
5315886Snate@binkert.org    if (!info.subnames.empty()) {
5325886Snate@binkert.org        for (off_type i = 0; i < info.x; ++i)
5335886Snate@binkert.org            if (!info.subnames[i].empty())
534695SN/A                havesub = true;
535695SN/A    }
536695SN/A
5375886Snate@binkert.org    VResult tot_vec(info.y);
538695SN/A    Result super_total = 0.0;
5395886Snate@binkert.org    for (off_type i = 0; i < info.x; ++i) {
5405886Snate@binkert.org        if (havesub && (i >= info.subnames.size() || info.subnames[i].empty()))
541695SN/A            continue;
542695SN/A
5435886Snate@binkert.org        off_type iy = i * info.y;
5445886Snate@binkert.org        VResult yvec(info.y);
545695SN/A
546695SN/A        Result total = 0.0;
5475886Snate@binkert.org        for (off_type j = 0; j < info.y; ++j) {
5485886Snate@binkert.org            yvec[j] = info.cvec[iy + j];
549695SN/A            tot_vec[j] += yvec[j];
550695SN/A            total += yvec[j];
551695SN/A            super_total += yvec[j];
552695SN/A        }
553695SN/A
5545886Snate@binkert.org        print.name = info.name + "_" +
5555886Snate@binkert.org            (havesub ? info.subnames[i] : to_string(i));
5565886Snate@binkert.org        print.desc = info.desc;
557695SN/A        print.vec = yvec;
558695SN/A        print.total = total;
559695SN/A        print(*stream);
560695SN/A    }
561695SN/A
5625886Snate@binkert.org    if ((info.flags & ::Stats::total) && (info.x > 1)) {
5635886Snate@binkert.org        print.name = info.name;
5645886Snate@binkert.org        print.desc = info.desc;
565695SN/A        print.vec = tot_vec;
566695SN/A        print.total = super_total;
567695SN/A        print(*stream);
568695SN/A    }
569695SN/A}
570695SN/A
571695SN/Avoid
5726128Snate@binkert.orgText::visit(const DistInfo &info)
573695SN/A{
5745886Snate@binkert.org    if (noOutput(info))
575695SN/A        return;
576695SN/A
5776125Snate@binkert.org    DistPrint print(this, info);
578695SN/A    print(*stream);
579695SN/A}
580695SN/A
581695SN/Avoid
5826128Snate@binkert.orgText::visit(const VectorDistInfo &info)
583695SN/A{
5845886Snate@binkert.org    if (noOutput(info))
585695SN/A        return;
586695SN/A
5875886Snate@binkert.org    for (off_type i = 0; i < info.size(); ++i) {
5886125Snate@binkert.org        DistPrint print(this, info, i);
589695SN/A        print(*stream);
590695SN/A    }
591695SN/A}
592695SN/A
593695SN/Avoid
5946128Snate@binkert.orgText::visit(const FormulaInfo &info)
595695SN/A{
5966128Snate@binkert.org    visit((const VectorInfo &)info);
597695SN/A}
598695SN/A
5994078Sbinkertn@umich.edubool
6006126Snate@binkert.orginitText(const string &filename, bool desc)
6014078Sbinkertn@umich.edu{
6024078Sbinkertn@umich.edu    static Text text;
6034078Sbinkertn@umich.edu    static bool connected = false;
6044078Sbinkertn@umich.edu
6054078Sbinkertn@umich.edu    if (connected)
6064078Sbinkertn@umich.edu        return false;
6074078Sbinkertn@umich.edu
6084078Sbinkertn@umich.edu    extern list<Output *> OutputList;
6094078Sbinkertn@umich.edu
6104078Sbinkertn@umich.edu    text.open(*simout.find(filename));
6114078Sbinkertn@umich.edu    text.descriptions = desc;
6124078Sbinkertn@umich.edu    OutputList.push_back(&text);
6134078Sbinkertn@umich.edu    connected = true;
6144078Sbinkertn@umich.edu
6154078Sbinkertn@umich.edu    return true;
6164078Sbinkertn@umich.edu}
6174078Sbinkertn@umich.edu
618729SN/A/* namespace Stats */ }
619