FYI: I regressed and checked in this patch:
http://repo.gem5.org/gem5/rev/94dac7d7bb88.  Mainline should work again for
gcc/g++ versions 4.4 through 4.7.

  Joel



On Wed, Sep 11, 2013 at 12:39 AM, Joel Hestness <[email protected]>wrote:

> Hey guys,
>
>   I ran into a bigger problem with these changes that stems from the way
> the STL allocators work, and I've come up with a solution (attached).  The
> basic problem is that STL vector allocation (used in a call to resize())
> uses copy constructors executed on the first element in the vector to
> create further elements.  Since Stats variables should be allocated in the
> body of each SimObject (so you don't try funny things with pointers or
> reallocation), simulation panics in InfoAccess::setInfo signaling that you
> are trying to use the same InfoAccess member twice for different stats.
>  I've tested that this problem affects gcc/g++ version 4.4.7 and 4.6.3.
>
>   I noticed that in the changes that Nilay introduced, all of the resize
> calls in SimpleNetwork, Switch and Throttle just resize the stats vectors
> to MessageSizeType_NUM, which is a value set in generated code before
> compilation, so stats variables can just be allocated in statically sized
> arrays.  The attached patch makes this change.
>
> @Nilay: I'm pretty sure this will work with gcc 4.7 also, but do you mind
> giving it a try?
>
>   Thanks,
>   Joel
>
>
> ---------------------------------------------------------
> diff -r 55ab2ce9227c -r c57ddb23da63
> src/mem/ruby/network/simple/SimpleNetwork.cc
> --- a/src/mem/ruby/network/simple/SimpleNetwork.cc Tue Sep 10 13:02:40
> 2013 -0500
> +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc Wed Sep 11 00:18:48
> 2013 -0500
> @@ -208,9 +208,6 @@
>  void
>  SimpleNetwork::regStats()
>  {
> -    m_msg_counts.resize(MessageSizeType_NUM);
> -    m_msg_bytes.resize(MessageSizeType_NUM);
> -
>      for (MessageSizeType type = MessageSizeType_FIRST;
>           type < MessageSizeType_NUM; ++type) {
>          m_msg_counts[(unsigned int) type]
> diff -r 55ab2ce9227c -r c57ddb23da63
> src/mem/ruby/network/simple/SimpleNetwork.hh
> --- a/src/mem/ruby/network/simple/SimpleNetwork.hh Tue Sep 10 13:02:40
> 2013 -0500
> +++ b/src/mem/ruby/network/simple/SimpleNetwork.hh Wed Sep 11 00:18:48
> 2013 -0500
> @@ -111,8 +111,8 @@
>      bool m_adaptive_routing;
>
>      //Statistical variables
> -    std::vector<Stats::Formula> m_msg_counts;
> -    std::vector<Stats::Formula> m_msg_bytes;
> +    Stats::Formula m_msg_counts[MessageSizeType_NUM];
> +    Stats::Formula m_msg_bytes[MessageSizeType_NUM];
>  };
>
>  inline std::ostream&
> diff -r 55ab2ce9227c -r c57ddb23da63 src/mem/ruby/network/simple/Switch.cc
> --- a/src/mem/ruby/network/simple/Switch.cc Tue Sep 10 13:02:40 2013 -0500
> +++ b/src/mem/ruby/network/simple/Switch.cc Wed Sep 11 00:18:48 2013 -0500
> @@ -30,7 +30,6 @@
>
>  #include "base/cast.hh"
>  #include "base/stl_helpers.hh"
> -#include "mem/protocol/MessageSizeType.hh"
>  #include "mem/ruby/buffers/MessageBuffer.hh"
>  #include "mem/ruby/network/simple/PerfectSwitch.hh"
>  #include "mem/ruby/network/simple/SimpleNetwork.hh"
> @@ -44,8 +43,6 @@
>  Switch::Switch(const Params *p) : BasicRouter(p)
>  {
>      m_perfect_switch = new PerfectSwitch(m_id, this, p->virt_nets);
> -    m_msg_counts.resize(MessageSizeType_NUM);
> -    m_msg_bytes.resize(MessageSizeType_NUM);
>  }
>
>  Switch::~Switch()
> diff -r 55ab2ce9227c -r c57ddb23da63 src/mem/ruby/network/simple/Switch.hh
> --- a/src/mem/ruby/network/simple/Switch.hh Tue Sep 10 13:02:40 2013 -0500
> +++ b/src/mem/ruby/network/simple/Switch.hh Wed Sep 11 00:18:48 2013 -0500
> @@ -43,6 +43,7 @@
>  #include <vector>
>
>  #include "mem/packet.hh"
> +#include "mem/protocol/MessageSizeType.hh"
>  #include "mem/ruby/common/TypeDefines.hh"
>  #include "mem/ruby/network/BasicRouter.hh"
>  #include "params/Switch.hh"
> @@ -92,8 +93,8 @@
>
>      // Statistical variables
>      Stats::Formula m_avg_utilization;
> -    std::vector<Stats::Formula> m_msg_counts;
> -    std::vector<Stats::Formula> m_msg_bytes;
> +    Stats::Formula m_msg_counts[MessageSizeType_NUM];
> +    Stats::Formula m_msg_bytes[MessageSizeType_NUM];
>  };
>
>  inline std::ostream&
> diff -r 55ab2ce9227c -r c57ddb23da63
> src/mem/ruby/network/simple/Throttle.cc
> --- a/src/mem/ruby/network/simple/Throttle.cc Tue Sep 10 13:02:40 2013
> -0500
> +++ b/src/mem/ruby/network/simple/Throttle.cc Wed Sep 11 00:18:48 2013
> -0500
> @@ -80,9 +80,6 @@
>
>      m_wakeups_wo_switch = 0;
>
> -    m_msg_counts.resize(MessageSizeType_NUM);
> -    m_msg_bytes.resize(MessageSizeType_NUM);
> -
>      m_link_utilization_proxy = 0;
>  }
>
> diff -r 55ab2ce9227c -r c57ddb23da63
> src/mem/ruby/network/simple/Throttle.hh
> --- a/src/mem/ruby/network/simple/Throttle.hh Tue Sep 10 13:02:40 2013
> -0500
> +++ b/src/mem/ruby/network/simple/Throttle.hh Wed Sep 11 00:18:48 2013
> -0500
> @@ -104,8 +104,8 @@
>
>      // Statistical variables
>      Stats::Scalar m_link_utilization;
> -    std::vector<Stats::Vector> m_msg_counts;
> -    std::vector<Stats::Formula> m_msg_bytes;
> +    Stats::Vector m_msg_counts[MessageSizeType_NUM];
> +    Stats::Formula m_msg_bytes[MessageSizeType_NUM];
>
>      double m_link_utilization_proxy;
>  };
> ---------------------------------------------------------
>
>
>
>
> On Mon, Sep 9, 2013 at 4:24 PM, Joel Hestness <[email protected]>wrote:
>
>> Hey guys,
>>
>>   I was just able to reproduce this linker error and Nilay helped to find
>> a fix for it.  Here's the full error message:
>>
>> build/MOESI_hammer/mem/ruby/network/simple/SimpleNetwork.o: In function
>> `operator=':
>> /home/joel/research/gem5/gem5-latest/build/MOESI_hammer/base/statistics.hh:330:
>> undefined reference to `Stats::DataWrap<Stats::Formula,
>> Stats::FormulaInfoProxy>::operator=(Stats::DataWrap<Stats::Formula,
>> Stats::FormulaInfoProxy> const&)'
>> build/MOESI_hammer/mem/ruby/network/simple/Throttle.o: In function
>> `operator=':
>> /home/joel/research/gem5/gem5-latest/build/MOESI_hammer/base/statistics.hh:330:
>> undefined reference to `Stats::DataWrap<Stats::Vector,
>> Stats::VectorInfoProxy>::operator=(Stats::DataWrap<Stats::Vector,
>> Stats::VectorInfoProxy> const&)'
>> collect2: ld returned 1 exit status
>>
>>
>>   The problem is that the operator= functions for the Throttle and
>> SimpleNetwork call the DataWrapVec operator= function, which isn't defined.
>>  In gcc/g++ 4.4.7, this manifests in the linker error, while it appears
>> that later versions of gcc/g++ assume the operator= function to be empty
>> (Nilay is using 4.7.3).
>>
>>   The simple fix is to explicitly define the empty operator= in
>> DataWrapVec:
>>
>> -----------------------------
>> diff --git a/src/base/statistics.hh b/src/base/statistics.hh
>> --- a/src/base/statistics.hh
>> +++ b/src/base/statistics.hh
>> @@ -337,6 +337,9 @@
>>      DataWrapVec(const DataWrapVec &ref)
>>      {}
>>
>> +    void operator=(const DataWrapVec &)
>>  +    {}
>> +
>>      // The following functions are specific to vectors.  If you use them
>>      // in a non vector context, you will get a nice compiler error!
>> -----------------------------
>>
>>
>>   Joel
>>
>>
>>
>>
>> On Mon, Sep 9, 2013 at 12:32 PM, Rio Xiangyu Dong 
>> <[email protected]>wrote:
>>
>>> Hi all,
>>>
>>> I got a compilation error after pulling in some latest changesets.  Does
>>> anyone see the same error?
>>>
>>> build/ARM/base/statistics.hh:330: undefined reference to
>>> `Stats::DataWrap<Stats::Vector,
>>> Stats::VectorInfoProxy>::operator=(Stats::DataWrap<Stats::Vector,
>>> Stats::VectorInfoProxy> const&)'
>>> collect2: ld returned 1 exit status
>>> scons: *** [build/ARM/gem5.opt] Error 1
>>>
>>> Best,
>>> Xiangyu
>>>
>>> -----Original Message-----
>>> From: [email protected] [mailto:[email protected]] On
>>> Behalf
>>> Of Nilay Vaish
>>> Sent: Friday, September 06, 2013 2:23 PM
>>> To: [email protected]
>>> Subject: [gem5-dev] changeset in gem5: ruby: network: convert to gem5
>>> style
>>> stats
>>>
>>> changeset 9483739f83ee in /z/repo/gem5
>>> details: http://repo.gem5.org/gem5?cmd=changeset;node=9483739f83ee
>>> description:
>>>         ruby: network: convert to gem5 style stats
>>>
>>> diffstat:
>>>
>>>  src/base/statistics.hh                                         |    6 +
>>>  src/mem/ruby/network/Network.cc                                |    3 +
>>>  src/mem/ruby/network/Network.hh                                |   26 +-
>>>  src/mem/ruby/network/garnet/BaseGarnetNetwork.cc               |  101
>>> +++----
>>>  src/mem/ruby/network/garnet/BaseGarnetNetwork.hh               |   24 +-
>>>  src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc  |  103
>>> ++++----
>>>  src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh  |   23 +-
>>>  src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh      |   21 +-
>>>  src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc    |   12 -
>>>  src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh    |   19 +-
>>>  src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc         |    4 +-
>>>  src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh         |   20 +-
>>>  src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh    |   21 +-
>>>  src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc |   58
>>> +---
>>>  src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh |    9 +-
>>>  src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc   |   19 +-
>>>  src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh   |   19 +-
>>>  src/mem/ruby/network/orion/NetworkPower.cc                     |   46
>>> +--
>>>  src/mem/ruby/network/simple/PerfectSwitch.cc                   |   39
>>> +--
>>>  src/mem/ruby/network/simple/PerfectSwitch.hh                   |    7 +-
>>>  src/mem/ruby/network/simple/SimpleNetwork.cc                   |   83
>>> +----
>>>  src/mem/ruby/network/simple/SimpleNetwork.hh                   |   10 +-
>>>  src/mem/ruby/network/simple/Switch.cc                          |  122
>>> +++------
>>>  src/mem/ruby/network/simple/Switch.hh                          |   16 +-
>>>  src/mem/ruby/network/simple/Throttle.cc                        |   65
>>> ++--
>>>  src/mem/ruby/network/simple/Throttle.hh                        |   35 +-
>>>  src/mem/ruby/system/System.cc                                  |    3 -
>>>  src/mem/ruby/system/System.hh                                  |    3 -
>>>  28 files changed, 388 insertions(+), 529 deletions(-)
>>>
>>> diffs (truncated from 1597 to 300 lines):
>>>
>>> diff -r 54d6728d99cf -r 9483739f83ee src/base/statistics.hh
>>> --- a/src/base/statistics.hh    Fri Sep 06 16:21:33 2013 -0500
>>> +++ b/src/base/statistics.hh    Fri Sep 06 16:21:35 2013 -0500
>>> @@ -331,6 +331,12 @@
>>>    public:
>>>      typedef InfoProxyType<Derived> Info;
>>>
>>> +    DataWrapVec()
>>> +    {}
>>> +
>>> +    DataWrapVec(const DataWrapVec &ref)
>>> +    {}
>>> +
>>>      // The following functions are specific to vectors.  If you use them
>>>      // in a non vector context, you will get a nice compiler error!
>>>
>>> diff -r 54d6728d99cf -r 9483739f83ee src/mem/ruby/network/Network.cc
>>> --- a/src/mem/ruby/network/Network.cc   Fri Sep 06 16:21:33 2013 -0500
>>> +++ b/src/mem/ruby/network/Network.cc   Fri Sep 06 16:21:35 2013 -0500
>>> @@ -59,6 +59,9 @@
>>>          AbstractController *abs_cntrl = ext_link->params()->ext_node;
>>>          abs_cntrl->initNetworkPtr(this);
>>>      }
>>> +
>>> +    // Register a callback function for combining the statistics
>>> +    Stats::registerDumpCallback(new StatsCallback(this));
>>>  }
>>>
>>>  void
>>> diff -r 54d6728d99cf -r 9483739f83ee src/mem/ruby/network/Network.hh
>>> --- a/src/mem/ruby/network/Network.hh   Fri Sep 06 16:21:33 2013 -0500
>>> +++ b/src/mem/ruby/network/Network.hh   Fri Sep 06 16:21:35 2013 -0500
>>> @@ -88,8 +88,7 @@
>>>                                    LinkDirection direction,
>>>                                    const NetDest& routing_table_entry) =
>>> 0;
>>>
>>> -    virtual void printStats(std::ostream& out) const = 0;
>>> -    virtual void clearStats() = 0;
>>> +    virtual void collateStats() = 0;
>>>      virtual void print(std::ostream& out) const = 0;
>>>
>>>      /*
>>> @@ -107,13 +106,30 @@
>>>      Network(const Network& obj);
>>>      Network& operator=(const Network& obj);
>>>
>>> -  protected:
>>> -    const std::string m_name;
>>> -    int m_nodes;
>>> +    uint32_t m_nodes;
>>>      static uint32_t m_virtual_networks;
>>>      Topology* m_topology_ptr;
>>>      static uint32_t m_control_msg_size;
>>>      static uint32_t m_data_msg_size;
>>> +
>>> +  private:
>>> +    //! Callback class used for collating statistics from all the
>>> +    //! controller of this type.
>>> +    class StatsCallback : public Callback
>>> +    {
>>> +      private:
>>> +        Network *ctr;
>>> +
>>> +      public:
>>> +        virtual ~StatsCallback() {}
>>> +
>>> +        StatsCallback(Network *_ctr)
>>> +            : ctr(_ctr)
>>> +        {
>>> +        }
>>> +
>>> +        void process() {ctr->collateStats();}
>>> +    };
>>>  };
>>>
>>>  inline std::ostream&
>>> diff -r 54d6728d99cf -r 9483739f83ee
>>> src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
>>> --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc  Fri Sep 06
>>> 16:21:33
>>> 2013 -0500
>>> +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc  Fri Sep 06
>>> 16:21:35
>>> 2013 -0500
>>> @@ -71,17 +71,9 @@
>>>
>>>      m_in_use.resize(m_virtual_networks);
>>>      m_ordered.resize(m_virtual_networks);
>>> -    m_flits_received.resize(m_virtual_networks);
>>> -    m_flits_injected.resize(m_virtual_networks);
>>> -    m_network_latency.resize(m_virtual_networks);
>>> -    m_queueing_latency.resize(m_virtual_networks);
>>>      for (int i = 0; i < m_virtual_networks; i++) {
>>>          m_in_use[i] = false;
>>>          m_ordered[i] = false;
>>> -        m_flits_received[i] = 0;
>>> -        m_flits_injected[i] = 0;
>>> -        m_network_latency[i] = 0.0;
>>> -        m_queueing_latency[i] = 0.0;
>>>      }
>>>
>>>      for (int node = 0; node < m_nodes; node++) { @@ -121,60 +113,55 @@
>>>  }
>>>
>>>  void
>>> -BaseGarnetNetwork::clearStats()
>>> +BaseGarnetNetwork::regStats()
>>>  {
>>> -}
>>> +    m_flits_received
>>> +        .init(m_virtual_networks)
>>> +        .name(name() + ".flits_received")
>>> +        .flags(Stats::pdf | Stats::total | Stats::nozero |
>>> Stats::oneline)
>>> +        ;
>>>
>>> -void
>>> -BaseGarnetNetwork::printStats(ostream& out) const -{
>>> -    out << endl;
>>> -    out << "Network Stats" << endl;
>>> -    out << "-------------" << endl;
>>> -    out << endl;
>>> -    printPerformanceStats(out);
>>> -    printLinkStats(out);
>>> -    printPowerStats(out);
>>> -}
>>> +    m_flits_injected
>>> +        .init(m_virtual_networks)
>>> +        .name(name() + ".flits_injected")
>>> +        .flags(Stats::pdf | Stats::total | Stats::nozero |
>>> Stats::oneline)
>>> +        ;
>>>
>>> -void
>>> -BaseGarnetNetwork::printPerformanceStats(ostream& out) const -{
>>> -    int total_flits_injected = 0;
>>> -    int total_flits_received = 0;
>>> -    int total_network_latency = 0.0;
>>> -    int total_queueing_latency = 0.0;
>>> +    m_network_latency
>>> +        .init(m_virtual_networks)
>>> +        .name(name() + ".network_latency")
>>> +        .flags(Stats::oneline)
>>> +        ;
>>> +
>>> +    m_queueing_latency
>>> +        .init(m_virtual_networks)
>>> +        .name(name() + ".queueing_latency")
>>> +        .flags(Stats::oneline)
>>> +        ;
>>>
>>>      for (int i = 0; i < m_virtual_networks; i++) {
>>> -        if (!m_in_use[i])
>>> -            continue;
>>> +        m_flits_received.subname(i, csprintf("vnet-%i", i));
>>> +        m_flits_injected.subname(i, csprintf("vnet-%i", i));
>>> +        m_network_latency.subname(i, csprintf("vnet-%i", i));
>>> +        m_queueing_latency.subname(i, csprintf("vnet-%i", i));
>>> +    }
>>>
>>> -        out << "[Vnet " << i << "]: flits injected = "
>>> -            << m_flits_injected[i] << endl;
>>> -        out << "[Vnet " << i << "]: flits received = "
>>> -            << m_flits_received[i] << endl;
>>> -        out << "[Vnet " << i << "]: average network latency = "
>>> -            << ((double) m_network_latency[i] / (double)
>>> m_flits_received[i])
>>> -            << endl;
>>> -        out << "[Vnet " << i << "]: average queueing (at source NI)
>>> latency
>>> = "
>>> -            << ((double) m_queueing_latency[i] / (double)
>>> m_flits_received[i])
>>> -            << endl;
>>> +    m_avg_vnet_latency
>>> +        .name(name() + ".average_vnet_latency")
>>> +        .flags(Stats::oneline);
>>> +    m_avg_vnet_latency = m_network_latency / m_flits_received;
>>>
>>> -        out << endl;
>>> -        total_flits_injected += m_flits_injected[i];
>>> -        total_flits_received += m_flits_received[i];
>>> -        total_network_latency += m_network_latency[i];
>>> -        total_queueing_latency += m_queueing_latency[i];
>>> -    }
>>> -    out << "Total flits injected = " << total_flits_injected << endl;
>>> -    out << "Total flits received = " << total_flits_received << endl;
>>> -    out << "Average network latency = "
>>> -        << ((double) total_network_latency/ (double)
>>> total_flits_received)
>>> << endl;
>>> -    out << "Average queueing (at source NI) latency = "
>>> -        << ((double) total_queueing_latency/ (double)
>>> total_flits_received)
>>> << endl;
>>> -    out << "Average latency = "
>>> -        << ((double)  (total_queueing_latency + total_network_latency) /
>>> -            (double) total_flits_received)<< endl;
>>> -    out << "-------------" << endl;
>>> -    out << endl;
>>> +    m_avg_vqueue_latency
>>> +        .name(name() + ".average_vqueue_latency")
>>> +        .flags(Stats::oneline);
>>> +    m_avg_vqueue_latency = m_queueing_latency / m_flits_received;
>>> +
>>> +    m_avg_network_latency.name(name() + ".average_network_latency");
>>> +    m_avg_network_latency = sum(m_network_latency) /
>>> + sum(m_flits_received);
>>> +
>>> +    m_avg_queueing_latency.name(name() + ".average_queueing_latency");
>>> +    m_avg_queueing_latency = sum(m_queueing_latency) /
>>> + sum(m_flits_received);
>>> +
>>> +    m_avg_latency.name(name() + ".average_latency");
>>> +    m_avg_latency = m_avg_network_latency + m_avg_queueing_latency;
>>>  }
>>> diff -r 54d6728d99cf -r 9483739f83ee
>>> src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
>>> --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh  Fri Sep 06
>>> 16:21:33
>>> 2013 -0500
>>> +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh  Fri Sep 06
>>> 16:21:35
>>> 2013 -0500
>>> @@ -80,27 +80,31 @@
>>>      virtual void checkNetworkAllocation(NodeID id, bool ordered,
>>>          int network_num, std::string vnet_type) = 0;
>>>
>>> -    void clearStats();
>>> -    void printStats(std::ostream& out) const;
>>> -    void printPerformanceStats(std::ostream& out) const;
>>> -    virtual void printLinkStats(std::ostream& out) const = 0;
>>> -    virtual void printPowerStats(std::ostream& out) const = 0;
>>> +    virtual void regStats();
>>> +    virtual void collateStats() {}
>>>
>>>    protected:
>>>      int m_ni_flit_size;
>>>      int m_vcs_per_vnet;
>>>      bool m_enable_fault_model;
>>>
>>> -    std::vector<int> m_flits_received;
>>> -    std::vector<int> m_flits_injected;
>>> -    std::vector<double> m_network_latency;
>>> -    std::vector<double> m_queueing_latency;
>>> -
>>>      std::vector<bool> m_in_use;
>>>      std::vector<bool> m_ordered;
>>>
>>>      std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
>>>      std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
>>> +
>>> +    // Statistical variables
>>> +    Stats::Vector m_flits_received;
>>> +    Stats::Vector m_flits_injected;
>>> +    Stats::Vector m_network_latency;
>>> +    Stats::Vector m_queueing_latency;
>>> +
>>> +    Stats::Formula m_avg_vnet_latency;
>>> +    Stats::Formula m_avg_vqueue_latency;
>>> +    Stats::Formula m_avg_network_latency;
>>> +    Stats::Formula m_avg_queueing_latency;
>>> +    Stats::Formula m_avg_latency;
>>>  };
>>>
>>>  #endif // __MEM_RUBY_NETWORK_GARNET_BASEGARNETNETWORK_HH__
>>> diff -r 54d6728d99cf -r 9483739f83ee
>>> src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
>>> --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
>>> Fri
>>> Sep 06 16:21:33 2013 -0500
>>> +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
>>> Fri
>>> Sep 06 16:21:35 2013 -0500
>>> @@ -221,81 +221,82 @@
>>>  }
>>>
>>>  void
>>> -GarnetNetwork_d::printLinkStats(ostream& out) const
>>> +GarnetNetwork_d::regStats()
>>>  {
>>> -    double average_link_utilization = 0;
>>> -    vector<double> average_vc_load;
>>> -    average_vc_load.resize(m_virtual_networks*m_vcs_per_vnet);
>>> +    BaseGarnetNetwork::regStats();
>>> +    regLinkStats();
>>> +    regPowerStats();
>>> +}
>>>
>>> -    for (int i = 0; i < m_virtual_networks*m_vcs_per_vnet; i++) {
>>> -        average_vc_load[i] = 0;
>>> -    }
>>> +void
>>> +GarnetNetwork_d::regLinkStats()
>>> +{
>>> +    m_average_link_utilization.name(name() + ".avg_link_utilization");
>>>
>>> -    out << endl;
>>> +    m_average_vc_load
>>> +        .init(m_virtual_networks * m_vcs_per_vnet)
>>> +        .name(name() + ".avg_vc_load")
>>> +        .flags(Stats::pdf | Stats::total | Stats::nozero |
>>> Stats::oneline)
>>> +        ;
>>> +}
>>> +
>>> +void
>>> +GarnetNetwork_d::regPowerStats()
>>> +{
>>> +    m_dynamic_link_power.name(name() + ".link_dynamic_power");
>>> +    m_static_link_power.name(name() + ".link_static_power");
>>> +
>>> +    m_total_link_power.name(name() + ".link_total_power");
>>> +    m_total_link_power = m_dynamic_link_power + m_static_link_power;
>>> +
>>> +    m_dynamic_router_power.name(name() + ".router_dynamic_power");
>>> +    m_static_router_power.name(name() + ".router_static_power");
>>> +    m_clk_power.name(name() + ".clk_power");
>>> +
>>> +    m_total_router_power.name(name() + ".router_total_power");
>>> +    m_total_router_power = m_dynamic_router_power +
>>> +                           m_static_router_power +
>>> +                           m_clk_power; }
>>> +
>>> _______________________________________________
>>> gem5-dev mailing list
>>> [email protected]
>>> http://m5sim.org/mailman/listinfo/gem5-dev
>>>
>>> _______________________________________________
>>> gem5-dev mailing list
>>> [email protected]
>>> http://m5sim.org/mailman/listinfo/gem5-dev
>>>
>>
>>
>>
>> --
>>   Joel Hestness
>>   PhD Student, Computer Architecture
>>   Dept. of Computer Science, University of Wisconsin - Madison
>>   http://pages.cs.wisc.edu/~hestness/
>>
>
>
>
> --
>   Joel Hestness
>   PhD Student, Computer Architecture
>   Dept. of Computer Science, University of Wisconsin - Madison
>   http://pages.cs.wisc.edu/~hestness/
>



-- 
  Joel Hestness
  PhD Student, Computer Architecture
  Dept. of Computer Science, University of Wisconsin - Madison
  http://pages.cs.wisc.edu/~hestness/
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to