comm_monitor.hh revision 9294
18981Sandreas.hansson@arm.com/* 28981Sandreas.hansson@arm.com * Copyright (c) 2012 ARM Limited 38981Sandreas.hansson@arm.com * All rights reserved 48981Sandreas.hansson@arm.com * 58981Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall 68981Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual 78981Sandreas.hansson@arm.com * property including but not limited to intellectual property relating 88981Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software 98981Sandreas.hansson@arm.com * licensed hereunder. You may use the software subject to the license 108981Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated 118981Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software, 128981Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form. 138981Sandreas.hansson@arm.com * 148981Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without 158981Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are 168981Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright 178981Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer; 188981Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright 198981Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the 208981Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution; 218981Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its 228981Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from 238981Sandreas.hansson@arm.com * this software without specific prior written permission. 248981Sandreas.hansson@arm.com * 258981Sandreas.hansson@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 268981Sandreas.hansson@arm.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 278981Sandreas.hansson@arm.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 288981Sandreas.hansson@arm.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 298981Sandreas.hansson@arm.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 308981Sandreas.hansson@arm.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 318981Sandreas.hansson@arm.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 328981Sandreas.hansson@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 338981Sandreas.hansson@arm.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 348981Sandreas.hansson@arm.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 358981Sandreas.hansson@arm.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 368981Sandreas.hansson@arm.com * 378981Sandreas.hansson@arm.com * Authors: Thomas Grass 388981Sandreas.hansson@arm.com * Andreas Hansson 398981Sandreas.hansson@arm.com */ 408981Sandreas.hansson@arm.com 418981Sandreas.hansson@arm.com#ifndef __MEM_COMM_MONITOR_HH__ 428981Sandreas.hansson@arm.com#define __MEM_COMM_MONITOR_HH__ 438981Sandreas.hansson@arm.com 448981Sandreas.hansson@arm.com#include "base/statistics.hh" 458981Sandreas.hansson@arm.com#include "base/time.hh" 468981Sandreas.hansson@arm.com#include "mem/mem_object.hh" 478981Sandreas.hansson@arm.com#include "params/CommMonitor.hh" 488981Sandreas.hansson@arm.com 498981Sandreas.hansson@arm.com/** 508981Sandreas.hansson@arm.com * The communication monitor is a MemObject which can monitor statistics of 518981Sandreas.hansson@arm.com * the communication happening between two ports in the memory system. 528981Sandreas.hansson@arm.com * 538981Sandreas.hansson@arm.com * Currently the following stats are implemented: Histograms of read/write 548981Sandreas.hansson@arm.com * transactions, read/write burst lengths, read/write bandwidth, 558981Sandreas.hansson@arm.com * outstanding read/write requests, read latency and inter transaction time 568981Sandreas.hansson@arm.com * (read-read, write-write, read/write-read/write). Furthermore it allows 578981Sandreas.hansson@arm.com * to capture the number of accesses to an address over time ("heat map"). 588981Sandreas.hansson@arm.com * All stats can be disabled from Python. 598981Sandreas.hansson@arm.com */ 608981Sandreas.hansson@arm.comclass CommMonitor : public MemObject 618981Sandreas.hansson@arm.com{ 628981Sandreas.hansson@arm.com 638981Sandreas.hansson@arm.com public: 648981Sandreas.hansson@arm.com 658981Sandreas.hansson@arm.com /** Parameters of communication monitor */ 668981Sandreas.hansson@arm.com typedef CommMonitorParams Params; 678981Sandreas.hansson@arm.com const Params* params() const 688981Sandreas.hansson@arm.com { return reinterpret_cast<const Params*>(_params); } 698981Sandreas.hansson@arm.com 708981Sandreas.hansson@arm.com /** 718981Sandreas.hansson@arm.com * Constructor based on the Python params 728981Sandreas.hansson@arm.com * 738981Sandreas.hansson@arm.com * @param params Python parameters 748981Sandreas.hansson@arm.com */ 758981Sandreas.hansson@arm.com CommMonitor(Params* params); 768981Sandreas.hansson@arm.com 778981Sandreas.hansson@arm.com /** Destructor */ 788981Sandreas.hansson@arm.com ~CommMonitor() { } 798981Sandreas.hansson@arm.com 809294Sandreas.hansson@arm.com virtual BaseMasterPort& getMasterPort(const std::string& if_name, 819294Sandreas.hansson@arm.com PortID idx = InvalidPortID); 828981Sandreas.hansson@arm.com 839294Sandreas.hansson@arm.com virtual BaseSlavePort& getSlavePort(const std::string& if_name, 849294Sandreas.hansson@arm.com PortID idx = InvalidPortID); 858981Sandreas.hansson@arm.com 868981Sandreas.hansson@arm.com virtual void init(); 878981Sandreas.hansson@arm.com 888981Sandreas.hansson@arm.com /** Register statistics */ 898981Sandreas.hansson@arm.com void regStats(); 908981Sandreas.hansson@arm.com 918981Sandreas.hansson@arm.com private: 928981Sandreas.hansson@arm.com 938981Sandreas.hansson@arm.com /** 948981Sandreas.hansson@arm.com * Sender state class for the monitor so that we can annotate 958981Sandreas.hansson@arm.com * packets with a transmit time and receive time. 968981Sandreas.hansson@arm.com */ 978981Sandreas.hansson@arm.com class CommMonitorSenderState : public Packet::SenderState 988981Sandreas.hansson@arm.com { 998981Sandreas.hansson@arm.com 1008981Sandreas.hansson@arm.com public: 1018981Sandreas.hansson@arm.com 1028981Sandreas.hansson@arm.com /** 1038981Sandreas.hansson@arm.com * Construct a new sender state and remember the original one 1048981Sandreas.hansson@arm.com * so that we can implement a stack. 1058981Sandreas.hansson@arm.com * 1068981Sandreas.hansson@arm.com * @param _origSenderState Sender state to remember 1078981Sandreas.hansson@arm.com * @param _transmitTime Time of packet transmission 1088981Sandreas.hansson@arm.com */ 1098981Sandreas.hansson@arm.com CommMonitorSenderState(SenderState* _origSenderState, 1108981Sandreas.hansson@arm.com Tick _transmitTime) 1118981Sandreas.hansson@arm.com : origSenderState(_origSenderState), transmitTime(_transmitTime) 1128981Sandreas.hansson@arm.com { } 1138981Sandreas.hansson@arm.com 1148981Sandreas.hansson@arm.com /** Destructor */ 1158981Sandreas.hansson@arm.com ~CommMonitorSenderState() { } 1168981Sandreas.hansson@arm.com 1178981Sandreas.hansson@arm.com /** Pointer to old sender state of packet */ 1188981Sandreas.hansson@arm.com SenderState* origSenderState; 1198981Sandreas.hansson@arm.com 1208981Sandreas.hansson@arm.com /** Tick when request is transmitted */ 1218981Sandreas.hansson@arm.com Tick transmitTime; 1228981Sandreas.hansson@arm.com 1238981Sandreas.hansson@arm.com }; 1248981Sandreas.hansson@arm.com 1258981Sandreas.hansson@arm.com /** 1268981Sandreas.hansson@arm.com * This is the master port of the communication monitor. All recv 1278981Sandreas.hansson@arm.com * functions call a function in CommMonitor, where the 1288981Sandreas.hansson@arm.com * send function of the slave port is called. Besides this, these 1298981Sandreas.hansson@arm.com * functions can also perform actions for capturing statistics. 1308981Sandreas.hansson@arm.com */ 1318981Sandreas.hansson@arm.com class MonitorMasterPort : public MasterPort 1328981Sandreas.hansson@arm.com { 1338981Sandreas.hansson@arm.com 1348981Sandreas.hansson@arm.com public: 1358981Sandreas.hansson@arm.com 1368981Sandreas.hansson@arm.com MonitorMasterPort(const std::string& _name, CommMonitor& _mon) 1378981Sandreas.hansson@arm.com : MasterPort(_name, &_mon), mon(_mon) 1388981Sandreas.hansson@arm.com { } 1398981Sandreas.hansson@arm.com 1408981Sandreas.hansson@arm.com protected: 1418981Sandreas.hansson@arm.com 1428981Sandreas.hansson@arm.com void recvFunctionalSnoop(PacketPtr pkt) 1438981Sandreas.hansson@arm.com { 1448981Sandreas.hansson@arm.com mon.recvFunctionalSnoop(pkt); 1458981Sandreas.hansson@arm.com } 1468981Sandreas.hansson@arm.com 1478981Sandreas.hansson@arm.com Tick recvAtomicSnoop(PacketPtr pkt) 1488981Sandreas.hansson@arm.com { 1498981Sandreas.hansson@arm.com return mon.recvAtomicSnoop(pkt); 1508981Sandreas.hansson@arm.com } 1518981Sandreas.hansson@arm.com 1528981Sandreas.hansson@arm.com bool recvTimingResp(PacketPtr pkt) 1538981Sandreas.hansson@arm.com { 1548981Sandreas.hansson@arm.com return mon.recvTimingResp(pkt); 1558981Sandreas.hansson@arm.com } 1568981Sandreas.hansson@arm.com 1578981Sandreas.hansson@arm.com void recvTimingSnoopReq(PacketPtr pkt) 1588981Sandreas.hansson@arm.com { 1598981Sandreas.hansson@arm.com mon.recvTimingSnoopReq(pkt); 1608981Sandreas.hansson@arm.com } 1618981Sandreas.hansson@arm.com 1628981Sandreas.hansson@arm.com void recvRangeChange() 1638981Sandreas.hansson@arm.com { 1648981Sandreas.hansson@arm.com mon.recvRangeChange(); 1658981Sandreas.hansson@arm.com } 1668981Sandreas.hansson@arm.com 1678981Sandreas.hansson@arm.com bool isSnooping() const 1688981Sandreas.hansson@arm.com { 1698981Sandreas.hansson@arm.com return mon.isSnooping(); 1708981Sandreas.hansson@arm.com } 1718981Sandreas.hansson@arm.com 1728981Sandreas.hansson@arm.com unsigned deviceBlockSize() const 1738981Sandreas.hansson@arm.com { 1748981Sandreas.hansson@arm.com return mon.deviceBlockSizeMaster(); 1758981Sandreas.hansson@arm.com } 1768981Sandreas.hansson@arm.com 1778981Sandreas.hansson@arm.com void recvRetry() 1788981Sandreas.hansson@arm.com { 1798981Sandreas.hansson@arm.com mon.recvRetryMaster(); 1808981Sandreas.hansson@arm.com } 1818981Sandreas.hansson@arm.com 1828981Sandreas.hansson@arm.com private: 1838981Sandreas.hansson@arm.com 1848981Sandreas.hansson@arm.com CommMonitor& mon; 1858981Sandreas.hansson@arm.com 1868981Sandreas.hansson@arm.com }; 1878981Sandreas.hansson@arm.com 1888981Sandreas.hansson@arm.com /** Instance of master port, facing the memory side */ 1898981Sandreas.hansson@arm.com MonitorMasterPort masterPort; 1908981Sandreas.hansson@arm.com 1918981Sandreas.hansson@arm.com /** 1928981Sandreas.hansson@arm.com * This is the slave port of the communication monitor. All recv 1938981Sandreas.hansson@arm.com * functions call a function in CommMonitor, where the 1948981Sandreas.hansson@arm.com * send function of the master port is called. Besides this, these 1958981Sandreas.hansson@arm.com * functions can also perform actions for capturing statistics. 1968981Sandreas.hansson@arm.com */ 1978981Sandreas.hansson@arm.com class MonitorSlavePort : public SlavePort 1988981Sandreas.hansson@arm.com { 1998981Sandreas.hansson@arm.com 2008981Sandreas.hansson@arm.com public: 2018981Sandreas.hansson@arm.com 2028981Sandreas.hansson@arm.com MonitorSlavePort(const std::string& _name, CommMonitor& _mon) 2038981Sandreas.hansson@arm.com : SlavePort(_name, &_mon), mon(_mon) 2048981Sandreas.hansson@arm.com { } 2058981Sandreas.hansson@arm.com 2068981Sandreas.hansson@arm.com protected: 2078981Sandreas.hansson@arm.com 2088981Sandreas.hansson@arm.com void recvFunctional(PacketPtr pkt) 2098981Sandreas.hansson@arm.com { 2108981Sandreas.hansson@arm.com mon.recvFunctional(pkt); 2118981Sandreas.hansson@arm.com } 2128981Sandreas.hansson@arm.com 2138981Sandreas.hansson@arm.com Tick recvAtomic(PacketPtr pkt) 2148981Sandreas.hansson@arm.com { 2158981Sandreas.hansson@arm.com return mon.recvAtomic(pkt); 2168981Sandreas.hansson@arm.com } 2178981Sandreas.hansson@arm.com 2188981Sandreas.hansson@arm.com bool recvTimingReq(PacketPtr pkt) 2198981Sandreas.hansson@arm.com { 2208981Sandreas.hansson@arm.com return mon.recvTimingReq(pkt); 2218981Sandreas.hansson@arm.com } 2228981Sandreas.hansson@arm.com 2238981Sandreas.hansson@arm.com bool recvTimingSnoopResp(PacketPtr pkt) 2248981Sandreas.hansson@arm.com { 2258981Sandreas.hansson@arm.com return mon.recvTimingSnoopResp(pkt); 2268981Sandreas.hansson@arm.com } 2278981Sandreas.hansson@arm.com 2288981Sandreas.hansson@arm.com unsigned deviceBlockSize() const 2298981Sandreas.hansson@arm.com { 2308981Sandreas.hansson@arm.com return mon.deviceBlockSizeSlave(); 2318981Sandreas.hansson@arm.com } 2328981Sandreas.hansson@arm.com 2339090Sandreas.hansson@arm.com AddrRangeList getAddrRanges() const 2348981Sandreas.hansson@arm.com { 2358981Sandreas.hansson@arm.com return mon.getAddrRanges(); 2368981Sandreas.hansson@arm.com } 2378981Sandreas.hansson@arm.com 2388981Sandreas.hansson@arm.com void recvRetry() 2398981Sandreas.hansson@arm.com { 2408981Sandreas.hansson@arm.com mon.recvRetrySlave(); 2418981Sandreas.hansson@arm.com } 2428981Sandreas.hansson@arm.com 2438981Sandreas.hansson@arm.com private: 2448981Sandreas.hansson@arm.com 2458981Sandreas.hansson@arm.com CommMonitor& mon; 2468981Sandreas.hansson@arm.com 2478981Sandreas.hansson@arm.com }; 2488981Sandreas.hansson@arm.com 2498981Sandreas.hansson@arm.com /** Instance of slave port, i.e. on the CPU side */ 2508981Sandreas.hansson@arm.com MonitorSlavePort slavePort; 2518981Sandreas.hansson@arm.com 2528981Sandreas.hansson@arm.com void recvFunctional(PacketPtr pkt); 2538981Sandreas.hansson@arm.com 2548981Sandreas.hansson@arm.com void recvFunctionalSnoop(PacketPtr pkt); 2558981Sandreas.hansson@arm.com 2568981Sandreas.hansson@arm.com Tick recvAtomic(PacketPtr pkt); 2578981Sandreas.hansson@arm.com 2588981Sandreas.hansson@arm.com Tick recvAtomicSnoop(PacketPtr pkt); 2598981Sandreas.hansson@arm.com 2608981Sandreas.hansson@arm.com bool recvTimingReq(PacketPtr pkt); 2618981Sandreas.hansson@arm.com 2628981Sandreas.hansson@arm.com bool recvTimingResp(PacketPtr pkt); 2638981Sandreas.hansson@arm.com 2648981Sandreas.hansson@arm.com void recvTimingSnoopReq(PacketPtr pkt); 2658981Sandreas.hansson@arm.com 2668981Sandreas.hansson@arm.com bool recvTimingSnoopResp(PacketPtr pkt); 2678981Sandreas.hansson@arm.com 2688981Sandreas.hansson@arm.com unsigned deviceBlockSizeMaster(); 2698981Sandreas.hansson@arm.com 2708981Sandreas.hansson@arm.com unsigned deviceBlockSizeSlave(); 2718981Sandreas.hansson@arm.com 2729090Sandreas.hansson@arm.com AddrRangeList getAddrRanges() const; 2738981Sandreas.hansson@arm.com 2748981Sandreas.hansson@arm.com bool isSnooping() const; 2758981Sandreas.hansson@arm.com 2768981Sandreas.hansson@arm.com void recvRetryMaster(); 2778981Sandreas.hansson@arm.com 2788981Sandreas.hansson@arm.com void recvRetrySlave(); 2798981Sandreas.hansson@arm.com 2808981Sandreas.hansson@arm.com void recvRangeChange(); 2818981Sandreas.hansson@arm.com 2828981Sandreas.hansson@arm.com void periodicTraceDump(); 2838981Sandreas.hansson@arm.com 2848981Sandreas.hansson@arm.com /** Stats declarations, all in a struct for convenience. */ 2858981Sandreas.hansson@arm.com struct MonitorStats 2868981Sandreas.hansson@arm.com { 2878981Sandreas.hansson@arm.com 2888981Sandreas.hansson@arm.com /** Disable flag for burst length historgrams **/ 2898981Sandreas.hansson@arm.com bool disableBurstLengthHists; 2908981Sandreas.hansson@arm.com 2918981Sandreas.hansson@arm.com /** Histogram of read burst lengths */ 2928981Sandreas.hansson@arm.com Stats::Histogram readBurstLengthHist; 2938981Sandreas.hansson@arm.com 2948981Sandreas.hansson@arm.com /** Histogram of write burst lengths */ 2958981Sandreas.hansson@arm.com Stats::Histogram writeBurstLengthHist; 2968981Sandreas.hansson@arm.com 2978981Sandreas.hansson@arm.com /** Disable flag for the bandwidth histograms */ 2988981Sandreas.hansson@arm.com bool disableBandwidthHists; 2998981Sandreas.hansson@arm.com 3008981Sandreas.hansson@arm.com /** 3018981Sandreas.hansson@arm.com * Histogram for read bandwidth per sample window. The 3028981Sandreas.hansson@arm.com * internal counter is an unsigned int rather than a stat. 3038981Sandreas.hansson@arm.com */ 3048981Sandreas.hansson@arm.com unsigned int readBytes; 3058981Sandreas.hansson@arm.com Stats::Histogram readBandwidthHist; 3068981Sandreas.hansson@arm.com Stats::Formula averageReadBW; 3078981Sandreas.hansson@arm.com Stats::Scalar totalReadBytes; 3088981Sandreas.hansson@arm.com 3098981Sandreas.hansson@arm.com /** 3108981Sandreas.hansson@arm.com * Histogram for write bandwidth per sample window. The 3118981Sandreas.hansson@arm.com * internal counter is an unsigned int rather than a stat. 3128981Sandreas.hansson@arm.com */ 3138981Sandreas.hansson@arm.com unsigned int writtenBytes; 3148981Sandreas.hansson@arm.com Stats::Histogram writeBandwidthHist; 3158981Sandreas.hansson@arm.com Stats::Formula averageWriteBW; 3168981Sandreas.hansson@arm.com Stats::Scalar totalWrittenBytes; 3178981Sandreas.hansson@arm.com 3188981Sandreas.hansson@arm.com /** Disable flag for latency histograms. */ 3198981Sandreas.hansson@arm.com bool disableLatencyHists; 3208981Sandreas.hansson@arm.com 3218981Sandreas.hansson@arm.com /** Histogram of read request-to-response latencies */ 3228981Sandreas.hansson@arm.com Stats::Histogram readLatencyHist; 3238981Sandreas.hansson@arm.com 3248981Sandreas.hansson@arm.com /** Histogram of write request-to-response latencies */ 3258981Sandreas.hansson@arm.com Stats::Histogram writeLatencyHist; 3268981Sandreas.hansson@arm.com 3278981Sandreas.hansson@arm.com /** Disable flag for ITT distributions. */ 3288981Sandreas.hansson@arm.com bool disableITTDists; 3298981Sandreas.hansson@arm.com 3308981Sandreas.hansson@arm.com /** 3318981Sandreas.hansson@arm.com * Inter transaction time (ITT) distributions. There are 3328981Sandreas.hansson@arm.com * histograms of the time between two read, write or arbitrary 3338981Sandreas.hansson@arm.com * accesses. The time of a request is the tick at which the 3348981Sandreas.hansson@arm.com * request is forwarded by the monitor. 3358981Sandreas.hansson@arm.com */ 3368981Sandreas.hansson@arm.com Stats::Distribution ittReadRead; 3378981Sandreas.hansson@arm.com Stats::Distribution ittWriteWrite; 3388981Sandreas.hansson@arm.com Stats::Distribution ittReqReq; 3398981Sandreas.hansson@arm.com Tick timeOfLastRead; 3408981Sandreas.hansson@arm.com Tick timeOfLastWrite; 3418981Sandreas.hansson@arm.com Tick timeOfLastReq; 3428981Sandreas.hansson@arm.com 3438981Sandreas.hansson@arm.com /** Disable flag for outstanding histograms. */ 3448981Sandreas.hansson@arm.com bool disableOutstandingHists; 3458981Sandreas.hansson@arm.com 3468981Sandreas.hansson@arm.com /** 3478981Sandreas.hansson@arm.com * Histogram of outstanding read requests. Counter for 3488981Sandreas.hansson@arm.com * outstanding read requests is an unsigned integer because 3498981Sandreas.hansson@arm.com * it should not be reset when stats are reset. 3508981Sandreas.hansson@arm.com */ 3518981Sandreas.hansson@arm.com Stats::Histogram outstandingReadsHist; 3528981Sandreas.hansson@arm.com unsigned int outstandingReadReqs; 3538981Sandreas.hansson@arm.com 3548981Sandreas.hansson@arm.com /** 3558981Sandreas.hansson@arm.com * Histogram of outstanding write requests. Counter for 3568981Sandreas.hansson@arm.com * outstanding write requests is an unsigned integer because 3578981Sandreas.hansson@arm.com * it should not be reset when stats are reset. 3588981Sandreas.hansson@arm.com */ 3598981Sandreas.hansson@arm.com Stats::Histogram outstandingWritesHist; 3608981Sandreas.hansson@arm.com unsigned int outstandingWriteReqs; 3618981Sandreas.hansson@arm.com 3628981Sandreas.hansson@arm.com /** Disable flag for transaction histograms. */ 3638981Sandreas.hansson@arm.com bool disableTransactionHists; 3648981Sandreas.hansson@arm.com 3658981Sandreas.hansson@arm.com /** Histogram of number of read transactions per time bin */ 3668981Sandreas.hansson@arm.com Stats::Histogram readTransHist; 3678981Sandreas.hansson@arm.com unsigned int readTrans; 3688981Sandreas.hansson@arm.com 3698981Sandreas.hansson@arm.com /** Histogram of number of timing write transactions per time bin */ 3708981Sandreas.hansson@arm.com Stats::Histogram writeTransHist; 3718981Sandreas.hansson@arm.com unsigned int writeTrans; 3728981Sandreas.hansson@arm.com 3738981Sandreas.hansson@arm.com /** Disable flag for address distributions. */ 3748981Sandreas.hansson@arm.com bool disableAddrDists; 3758981Sandreas.hansson@arm.com 3768981Sandreas.hansson@arm.com /** 3778981Sandreas.hansson@arm.com * Histogram of number of read accesses to addresses over 3788981Sandreas.hansson@arm.com * time. 3798981Sandreas.hansson@arm.com */ 3808981Sandreas.hansson@arm.com Stats::SparseHistogram readAddrDist; 3818981Sandreas.hansson@arm.com 3828981Sandreas.hansson@arm.com /** 3838981Sandreas.hansson@arm.com * Histogram of number of write accesses to addresses over 3848981Sandreas.hansson@arm.com * time. 3858981Sandreas.hansson@arm.com */ 3868981Sandreas.hansson@arm.com Stats::SparseHistogram writeAddrDist; 3878981Sandreas.hansson@arm.com 3888981Sandreas.hansson@arm.com /** 3898981Sandreas.hansson@arm.com * Create the monitor stats and initialise all the members 3908981Sandreas.hansson@arm.com * that are not statistics themselves, but used to control the 3918981Sandreas.hansson@arm.com * stats or track values during a sample period. 3928981Sandreas.hansson@arm.com */ 3938981Sandreas.hansson@arm.com MonitorStats(const CommMonitorParams* params) : 3948981Sandreas.hansson@arm.com disableBurstLengthHists(params->disable_burst_length_hists), 3958981Sandreas.hansson@arm.com disableBandwidthHists(params->disable_bandwidth_hists), 3968981Sandreas.hansson@arm.com readBytes(0), writtenBytes(0), 3978981Sandreas.hansson@arm.com disableLatencyHists(params->disable_latency_hists), 3988981Sandreas.hansson@arm.com disableITTDists(params->disable_itt_dists), 3998981Sandreas.hansson@arm.com timeOfLastRead(0), timeOfLastWrite(0), timeOfLastReq(0), 4008981Sandreas.hansson@arm.com disableOutstandingHists(params->disable_outstanding_hists), 4018981Sandreas.hansson@arm.com outstandingReadReqs(0), outstandingWriteReqs(0), 4028981Sandreas.hansson@arm.com disableTransactionHists(params->disable_transaction_hists), 4038981Sandreas.hansson@arm.com readTrans(0), writeTrans(0), 4048981Sandreas.hansson@arm.com disableAddrDists(params->disable_addr_dists) 4058981Sandreas.hansson@arm.com { } 4068981Sandreas.hansson@arm.com 4078981Sandreas.hansson@arm.com }; 4088981Sandreas.hansson@arm.com 4098981Sandreas.hansson@arm.com /** This function is called periodically at the end of each time bin */ 4108981Sandreas.hansson@arm.com void samplePeriodic(); 4118981Sandreas.hansson@arm.com 4128981Sandreas.hansson@arm.com /** Schedule the first periodic event */ 4138981Sandreas.hansson@arm.com void startup(); 4148981Sandreas.hansson@arm.com 4158981Sandreas.hansson@arm.com /** Periodic event called at the end of each simulation time bin */ 4168981Sandreas.hansson@arm.com EventWrapper<CommMonitor, &CommMonitor::samplePeriodic> samplePeriodicEvent; 4178981Sandreas.hansson@arm.com 4188981Sandreas.hansson@arm.com /** Length of simulation time bin*/ 4198981Sandreas.hansson@arm.com Tick samplePeriodTicks; 4208981Sandreas.hansson@arm.com Time samplePeriod; 4218981Sandreas.hansson@arm.com 4228981Sandreas.hansson@arm.com /** Address mask for sources of read accesses to be captured */ 4238981Sandreas.hansson@arm.com Addr readAddrMask; 4248981Sandreas.hansson@arm.com 4258981Sandreas.hansson@arm.com /** Address mask for sources of write accesses to be captured */ 4268981Sandreas.hansson@arm.com Addr writeAddrMask; 4278981Sandreas.hansson@arm.com 4288981Sandreas.hansson@arm.com /** Instantiate stats */ 4298981Sandreas.hansson@arm.com MonitorStats stats; 4308981Sandreas.hansson@arm.com}; 4318981Sandreas.hansson@arm.com 4328981Sandreas.hansson@arm.com#endif //__MEM_COMM_MONITOR_HH__ 433