comm_monitor.hh revision 9785
18981Sandreas.hansson@arm.com/* 29785Sandreas.hansson@arm.com * Copyright (c) 2012-2013 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" 489398Sandreas.hansson@arm.com#include "proto/protoio.hh" 498981Sandreas.hansson@arm.com 508981Sandreas.hansson@arm.com/** 518981Sandreas.hansson@arm.com * The communication monitor is a MemObject which can monitor statistics of 528981Sandreas.hansson@arm.com * the communication happening between two ports in the memory system. 538981Sandreas.hansson@arm.com * 548981Sandreas.hansson@arm.com * Currently the following stats are implemented: Histograms of read/write 558981Sandreas.hansson@arm.com * transactions, read/write burst lengths, read/write bandwidth, 568981Sandreas.hansson@arm.com * outstanding read/write requests, read latency and inter transaction time 578981Sandreas.hansson@arm.com * (read-read, write-write, read/write-read/write). Furthermore it allows 588981Sandreas.hansson@arm.com * to capture the number of accesses to an address over time ("heat map"). 598981Sandreas.hansson@arm.com * All stats can be disabled from Python. 608981Sandreas.hansson@arm.com */ 618981Sandreas.hansson@arm.comclass CommMonitor : public MemObject 628981Sandreas.hansson@arm.com{ 638981Sandreas.hansson@arm.com 648981Sandreas.hansson@arm.com public: 658981Sandreas.hansson@arm.com 668981Sandreas.hansson@arm.com /** Parameters of communication monitor */ 678981Sandreas.hansson@arm.com typedef CommMonitorParams Params; 688981Sandreas.hansson@arm.com const Params* params() const 698981Sandreas.hansson@arm.com { return reinterpret_cast<const Params*>(_params); } 708981Sandreas.hansson@arm.com 718981Sandreas.hansson@arm.com /** 728981Sandreas.hansson@arm.com * Constructor based on the Python params 738981Sandreas.hansson@arm.com * 748981Sandreas.hansson@arm.com * @param params Python parameters 758981Sandreas.hansson@arm.com */ 768981Sandreas.hansson@arm.com CommMonitor(Params* params); 778981Sandreas.hansson@arm.com 788981Sandreas.hansson@arm.com /** Destructor */ 799398Sandreas.hansson@arm.com ~CommMonitor() {} 809398Sandreas.hansson@arm.com 819398Sandreas.hansson@arm.com /** 829398Sandreas.hansson@arm.com * Callback to flush and close all open output streams on exit. If 839398Sandreas.hansson@arm.com * we were calling the destructor it could be done there. 849398Sandreas.hansson@arm.com */ 859398Sandreas.hansson@arm.com void closeStreams(); 868981Sandreas.hansson@arm.com 879294Sandreas.hansson@arm.com virtual BaseMasterPort& getMasterPort(const std::string& if_name, 889294Sandreas.hansson@arm.com PortID idx = InvalidPortID); 898981Sandreas.hansson@arm.com 909294Sandreas.hansson@arm.com virtual BaseSlavePort& getSlavePort(const std::string& if_name, 919294Sandreas.hansson@arm.com PortID idx = InvalidPortID); 928981Sandreas.hansson@arm.com 938981Sandreas.hansson@arm.com virtual void init(); 948981Sandreas.hansson@arm.com 958981Sandreas.hansson@arm.com /** Register statistics */ 968981Sandreas.hansson@arm.com void regStats(); 978981Sandreas.hansson@arm.com 988981Sandreas.hansson@arm.com private: 998981Sandreas.hansson@arm.com 1008981Sandreas.hansson@arm.com /** 1018981Sandreas.hansson@arm.com * Sender state class for the monitor so that we can annotate 1028981Sandreas.hansson@arm.com * packets with a transmit time and receive time. 1038981Sandreas.hansson@arm.com */ 1048981Sandreas.hansson@arm.com class CommMonitorSenderState : public Packet::SenderState 1058981Sandreas.hansson@arm.com { 1068981Sandreas.hansson@arm.com 1078981Sandreas.hansson@arm.com public: 1088981Sandreas.hansson@arm.com 1098981Sandreas.hansson@arm.com /** 1109542Sandreas.hansson@arm.com * Construct a new sender state and store the time so we can 1119542Sandreas.hansson@arm.com * calculate round-trip latency. 1128981Sandreas.hansson@arm.com * 1138981Sandreas.hansson@arm.com * @param _transmitTime Time of packet transmission 1148981Sandreas.hansson@arm.com */ 1159542Sandreas.hansson@arm.com CommMonitorSenderState(Tick _transmitTime) 1169542Sandreas.hansson@arm.com : transmitTime(_transmitTime) 1178981Sandreas.hansson@arm.com { } 1188981Sandreas.hansson@arm.com 1198981Sandreas.hansson@arm.com /** Destructor */ 1208981Sandreas.hansson@arm.com ~CommMonitorSenderState() { } 1218981Sandreas.hansson@arm.com 1228981Sandreas.hansson@arm.com /** Tick when request is transmitted */ 1238981Sandreas.hansson@arm.com Tick transmitTime; 1248981Sandreas.hansson@arm.com 1258981Sandreas.hansson@arm.com }; 1268981Sandreas.hansson@arm.com 1278981Sandreas.hansson@arm.com /** 1288981Sandreas.hansson@arm.com * This is the master port of the communication monitor. All recv 1298981Sandreas.hansson@arm.com * functions call a function in CommMonitor, where the 1308981Sandreas.hansson@arm.com * send function of the slave port is called. Besides this, these 1318981Sandreas.hansson@arm.com * functions can also perform actions for capturing statistics. 1328981Sandreas.hansson@arm.com */ 1338981Sandreas.hansson@arm.com class MonitorMasterPort : public MasterPort 1348981Sandreas.hansson@arm.com { 1358981Sandreas.hansson@arm.com 1368981Sandreas.hansson@arm.com public: 1378981Sandreas.hansson@arm.com 1388981Sandreas.hansson@arm.com MonitorMasterPort(const std::string& _name, CommMonitor& _mon) 1398981Sandreas.hansson@arm.com : MasterPort(_name, &_mon), mon(_mon) 1408981Sandreas.hansson@arm.com { } 1418981Sandreas.hansson@arm.com 1428981Sandreas.hansson@arm.com protected: 1438981Sandreas.hansson@arm.com 1448981Sandreas.hansson@arm.com void recvFunctionalSnoop(PacketPtr pkt) 1458981Sandreas.hansson@arm.com { 1468981Sandreas.hansson@arm.com mon.recvFunctionalSnoop(pkt); 1478981Sandreas.hansson@arm.com } 1488981Sandreas.hansson@arm.com 1498981Sandreas.hansson@arm.com Tick recvAtomicSnoop(PacketPtr pkt) 1508981Sandreas.hansson@arm.com { 1518981Sandreas.hansson@arm.com return mon.recvAtomicSnoop(pkt); 1528981Sandreas.hansson@arm.com } 1538981Sandreas.hansson@arm.com 1548981Sandreas.hansson@arm.com bool recvTimingResp(PacketPtr pkt) 1558981Sandreas.hansson@arm.com { 1568981Sandreas.hansson@arm.com return mon.recvTimingResp(pkt); 1578981Sandreas.hansson@arm.com } 1588981Sandreas.hansson@arm.com 1598981Sandreas.hansson@arm.com void recvTimingSnoopReq(PacketPtr pkt) 1608981Sandreas.hansson@arm.com { 1618981Sandreas.hansson@arm.com mon.recvTimingSnoopReq(pkt); 1628981Sandreas.hansson@arm.com } 1638981Sandreas.hansson@arm.com 1648981Sandreas.hansson@arm.com void recvRangeChange() 1658981Sandreas.hansson@arm.com { 1668981Sandreas.hansson@arm.com mon.recvRangeChange(); 1678981Sandreas.hansson@arm.com } 1688981Sandreas.hansson@arm.com 1698981Sandreas.hansson@arm.com bool isSnooping() const 1708981Sandreas.hansson@arm.com { 1718981Sandreas.hansson@arm.com return mon.isSnooping(); 1728981Sandreas.hansson@arm.com } 1738981Sandreas.hansson@arm.com 1748981Sandreas.hansson@arm.com unsigned deviceBlockSize() const 1758981Sandreas.hansson@arm.com { 1768981Sandreas.hansson@arm.com return mon.deviceBlockSizeMaster(); 1778981Sandreas.hansson@arm.com } 1788981Sandreas.hansson@arm.com 1798981Sandreas.hansson@arm.com void recvRetry() 1808981Sandreas.hansson@arm.com { 1818981Sandreas.hansson@arm.com mon.recvRetryMaster(); 1828981Sandreas.hansson@arm.com } 1838981Sandreas.hansson@arm.com 1848981Sandreas.hansson@arm.com private: 1858981Sandreas.hansson@arm.com 1868981Sandreas.hansson@arm.com CommMonitor& mon; 1878981Sandreas.hansson@arm.com 1888981Sandreas.hansson@arm.com }; 1898981Sandreas.hansson@arm.com 1908981Sandreas.hansson@arm.com /** Instance of master port, facing the memory side */ 1918981Sandreas.hansson@arm.com MonitorMasterPort masterPort; 1928981Sandreas.hansson@arm.com 1938981Sandreas.hansson@arm.com /** 1948981Sandreas.hansson@arm.com * This is the slave port of the communication monitor. All recv 1958981Sandreas.hansson@arm.com * functions call a function in CommMonitor, where the 1968981Sandreas.hansson@arm.com * send function of the master port is called. Besides this, these 1978981Sandreas.hansson@arm.com * functions can also perform actions for capturing statistics. 1988981Sandreas.hansson@arm.com */ 1998981Sandreas.hansson@arm.com class MonitorSlavePort : public SlavePort 2008981Sandreas.hansson@arm.com { 2018981Sandreas.hansson@arm.com 2028981Sandreas.hansson@arm.com public: 2038981Sandreas.hansson@arm.com 2048981Sandreas.hansson@arm.com MonitorSlavePort(const std::string& _name, CommMonitor& _mon) 2058981Sandreas.hansson@arm.com : SlavePort(_name, &_mon), mon(_mon) 2068981Sandreas.hansson@arm.com { } 2078981Sandreas.hansson@arm.com 2088981Sandreas.hansson@arm.com protected: 2098981Sandreas.hansson@arm.com 2108981Sandreas.hansson@arm.com void recvFunctional(PacketPtr pkt) 2118981Sandreas.hansson@arm.com { 2128981Sandreas.hansson@arm.com mon.recvFunctional(pkt); 2138981Sandreas.hansson@arm.com } 2148981Sandreas.hansson@arm.com 2158981Sandreas.hansson@arm.com Tick recvAtomic(PacketPtr pkt) 2168981Sandreas.hansson@arm.com { 2178981Sandreas.hansson@arm.com return mon.recvAtomic(pkt); 2188981Sandreas.hansson@arm.com } 2198981Sandreas.hansson@arm.com 2208981Sandreas.hansson@arm.com bool recvTimingReq(PacketPtr pkt) 2218981Sandreas.hansson@arm.com { 2228981Sandreas.hansson@arm.com return mon.recvTimingReq(pkt); 2238981Sandreas.hansson@arm.com } 2248981Sandreas.hansson@arm.com 2258981Sandreas.hansson@arm.com bool recvTimingSnoopResp(PacketPtr pkt) 2268981Sandreas.hansson@arm.com { 2278981Sandreas.hansson@arm.com return mon.recvTimingSnoopResp(pkt); 2288981Sandreas.hansson@arm.com } 2298981Sandreas.hansson@arm.com 2308981Sandreas.hansson@arm.com unsigned deviceBlockSize() const 2318981Sandreas.hansson@arm.com { 2328981Sandreas.hansson@arm.com return mon.deviceBlockSizeSlave(); 2338981Sandreas.hansson@arm.com } 2348981Sandreas.hansson@arm.com 2359090Sandreas.hansson@arm.com AddrRangeList getAddrRanges() const 2368981Sandreas.hansson@arm.com { 2378981Sandreas.hansson@arm.com return mon.getAddrRanges(); 2388981Sandreas.hansson@arm.com } 2398981Sandreas.hansson@arm.com 2408981Sandreas.hansson@arm.com void recvRetry() 2418981Sandreas.hansson@arm.com { 2428981Sandreas.hansson@arm.com mon.recvRetrySlave(); 2438981Sandreas.hansson@arm.com } 2448981Sandreas.hansson@arm.com 2458981Sandreas.hansson@arm.com private: 2468981Sandreas.hansson@arm.com 2478981Sandreas.hansson@arm.com CommMonitor& mon; 2488981Sandreas.hansson@arm.com 2498981Sandreas.hansson@arm.com }; 2508981Sandreas.hansson@arm.com 2518981Sandreas.hansson@arm.com /** Instance of slave port, i.e. on the CPU side */ 2528981Sandreas.hansson@arm.com MonitorSlavePort slavePort; 2538981Sandreas.hansson@arm.com 2548981Sandreas.hansson@arm.com void recvFunctional(PacketPtr pkt); 2558981Sandreas.hansson@arm.com 2568981Sandreas.hansson@arm.com void recvFunctionalSnoop(PacketPtr pkt); 2578981Sandreas.hansson@arm.com 2588981Sandreas.hansson@arm.com Tick recvAtomic(PacketPtr pkt); 2598981Sandreas.hansson@arm.com 2608981Sandreas.hansson@arm.com Tick recvAtomicSnoop(PacketPtr pkt); 2618981Sandreas.hansson@arm.com 2628981Sandreas.hansson@arm.com bool recvTimingReq(PacketPtr pkt); 2638981Sandreas.hansson@arm.com 2648981Sandreas.hansson@arm.com bool recvTimingResp(PacketPtr pkt); 2658981Sandreas.hansson@arm.com 2668981Sandreas.hansson@arm.com void recvTimingSnoopReq(PacketPtr pkt); 2678981Sandreas.hansson@arm.com 2688981Sandreas.hansson@arm.com bool recvTimingSnoopResp(PacketPtr pkt); 2698981Sandreas.hansson@arm.com 2708981Sandreas.hansson@arm.com unsigned deviceBlockSizeMaster(); 2718981Sandreas.hansson@arm.com 2728981Sandreas.hansson@arm.com unsigned deviceBlockSizeSlave(); 2738981Sandreas.hansson@arm.com 2749090Sandreas.hansson@arm.com AddrRangeList getAddrRanges() const; 2758981Sandreas.hansson@arm.com 2768981Sandreas.hansson@arm.com bool isSnooping() const; 2778981Sandreas.hansson@arm.com 2788981Sandreas.hansson@arm.com void recvRetryMaster(); 2798981Sandreas.hansson@arm.com 2808981Sandreas.hansson@arm.com void recvRetrySlave(); 2818981Sandreas.hansson@arm.com 2828981Sandreas.hansson@arm.com void recvRangeChange(); 2838981Sandreas.hansson@arm.com 2848981Sandreas.hansson@arm.com void periodicTraceDump(); 2858981Sandreas.hansson@arm.com 2868981Sandreas.hansson@arm.com /** Stats declarations, all in a struct for convenience. */ 2878981Sandreas.hansson@arm.com struct MonitorStats 2888981Sandreas.hansson@arm.com { 2898981Sandreas.hansson@arm.com 2908981Sandreas.hansson@arm.com /** Disable flag for burst length historgrams **/ 2918981Sandreas.hansson@arm.com bool disableBurstLengthHists; 2928981Sandreas.hansson@arm.com 2938981Sandreas.hansson@arm.com /** Histogram of read burst lengths */ 2948981Sandreas.hansson@arm.com Stats::Histogram readBurstLengthHist; 2958981Sandreas.hansson@arm.com 2968981Sandreas.hansson@arm.com /** Histogram of write burst lengths */ 2978981Sandreas.hansson@arm.com Stats::Histogram writeBurstLengthHist; 2988981Sandreas.hansson@arm.com 2998981Sandreas.hansson@arm.com /** Disable flag for the bandwidth histograms */ 3008981Sandreas.hansson@arm.com bool disableBandwidthHists; 3018981Sandreas.hansson@arm.com 3028981Sandreas.hansson@arm.com /** 3038981Sandreas.hansson@arm.com * Histogram for read bandwidth per sample window. The 3048981Sandreas.hansson@arm.com * internal counter is an unsigned int rather than a stat. 3058981Sandreas.hansson@arm.com */ 3068981Sandreas.hansson@arm.com unsigned int readBytes; 3078981Sandreas.hansson@arm.com Stats::Histogram readBandwidthHist; 3088981Sandreas.hansson@arm.com Stats::Formula averageReadBW; 3098981Sandreas.hansson@arm.com Stats::Scalar totalReadBytes; 3108981Sandreas.hansson@arm.com 3118981Sandreas.hansson@arm.com /** 3128981Sandreas.hansson@arm.com * Histogram for write bandwidth per sample window. The 3138981Sandreas.hansson@arm.com * internal counter is an unsigned int rather than a stat. 3148981Sandreas.hansson@arm.com */ 3158981Sandreas.hansson@arm.com unsigned int writtenBytes; 3168981Sandreas.hansson@arm.com Stats::Histogram writeBandwidthHist; 3178981Sandreas.hansson@arm.com Stats::Formula averageWriteBW; 3188981Sandreas.hansson@arm.com Stats::Scalar totalWrittenBytes; 3198981Sandreas.hansson@arm.com 3208981Sandreas.hansson@arm.com /** Disable flag for latency histograms. */ 3218981Sandreas.hansson@arm.com bool disableLatencyHists; 3228981Sandreas.hansson@arm.com 3238981Sandreas.hansson@arm.com /** Histogram of read request-to-response latencies */ 3248981Sandreas.hansson@arm.com Stats::Histogram readLatencyHist; 3258981Sandreas.hansson@arm.com 3268981Sandreas.hansson@arm.com /** Histogram of write request-to-response latencies */ 3278981Sandreas.hansson@arm.com Stats::Histogram writeLatencyHist; 3288981Sandreas.hansson@arm.com 3298981Sandreas.hansson@arm.com /** Disable flag for ITT distributions. */ 3308981Sandreas.hansson@arm.com bool disableITTDists; 3318981Sandreas.hansson@arm.com 3328981Sandreas.hansson@arm.com /** 3338981Sandreas.hansson@arm.com * Inter transaction time (ITT) distributions. There are 3348981Sandreas.hansson@arm.com * histograms of the time between two read, write or arbitrary 3358981Sandreas.hansson@arm.com * accesses. The time of a request is the tick at which the 3368981Sandreas.hansson@arm.com * request is forwarded by the monitor. 3378981Sandreas.hansson@arm.com */ 3388981Sandreas.hansson@arm.com Stats::Distribution ittReadRead; 3398981Sandreas.hansson@arm.com Stats::Distribution ittWriteWrite; 3408981Sandreas.hansson@arm.com Stats::Distribution ittReqReq; 3418981Sandreas.hansson@arm.com Tick timeOfLastRead; 3428981Sandreas.hansson@arm.com Tick timeOfLastWrite; 3438981Sandreas.hansson@arm.com Tick timeOfLastReq; 3448981Sandreas.hansson@arm.com 3458981Sandreas.hansson@arm.com /** Disable flag for outstanding histograms. */ 3468981Sandreas.hansson@arm.com bool disableOutstandingHists; 3478981Sandreas.hansson@arm.com 3488981Sandreas.hansson@arm.com /** 3498981Sandreas.hansson@arm.com * Histogram of outstanding read requests. Counter for 3508981Sandreas.hansson@arm.com * outstanding read requests is an unsigned integer because 3518981Sandreas.hansson@arm.com * it should not be reset when stats are reset. 3528981Sandreas.hansson@arm.com */ 3538981Sandreas.hansson@arm.com Stats::Histogram outstandingReadsHist; 3548981Sandreas.hansson@arm.com unsigned int outstandingReadReqs; 3558981Sandreas.hansson@arm.com 3568981Sandreas.hansson@arm.com /** 3578981Sandreas.hansson@arm.com * Histogram of outstanding write requests. Counter for 3588981Sandreas.hansson@arm.com * outstanding write requests is an unsigned integer because 3598981Sandreas.hansson@arm.com * it should not be reset when stats are reset. 3608981Sandreas.hansson@arm.com */ 3618981Sandreas.hansson@arm.com Stats::Histogram outstandingWritesHist; 3628981Sandreas.hansson@arm.com unsigned int outstandingWriteReqs; 3638981Sandreas.hansson@arm.com 3648981Sandreas.hansson@arm.com /** Disable flag for transaction histograms. */ 3658981Sandreas.hansson@arm.com bool disableTransactionHists; 3668981Sandreas.hansson@arm.com 3678981Sandreas.hansson@arm.com /** Histogram of number of read transactions per time bin */ 3688981Sandreas.hansson@arm.com Stats::Histogram readTransHist; 3698981Sandreas.hansson@arm.com unsigned int readTrans; 3708981Sandreas.hansson@arm.com 3718981Sandreas.hansson@arm.com /** Histogram of number of timing write transactions per time bin */ 3728981Sandreas.hansson@arm.com Stats::Histogram writeTransHist; 3738981Sandreas.hansson@arm.com unsigned int writeTrans; 3748981Sandreas.hansson@arm.com 3758981Sandreas.hansson@arm.com /** Disable flag for address distributions. */ 3768981Sandreas.hansson@arm.com bool disableAddrDists; 3778981Sandreas.hansson@arm.com 3788981Sandreas.hansson@arm.com /** 3798981Sandreas.hansson@arm.com * Histogram of number of read accesses to addresses over 3808981Sandreas.hansson@arm.com * time. 3818981Sandreas.hansson@arm.com */ 3828981Sandreas.hansson@arm.com Stats::SparseHistogram readAddrDist; 3838981Sandreas.hansson@arm.com 3848981Sandreas.hansson@arm.com /** 3858981Sandreas.hansson@arm.com * Histogram of number of write accesses to addresses over 3868981Sandreas.hansson@arm.com * time. 3878981Sandreas.hansson@arm.com */ 3888981Sandreas.hansson@arm.com Stats::SparseHistogram writeAddrDist; 3898981Sandreas.hansson@arm.com 3908981Sandreas.hansson@arm.com /** 3918981Sandreas.hansson@arm.com * Create the monitor stats and initialise all the members 3928981Sandreas.hansson@arm.com * that are not statistics themselves, but used to control the 3938981Sandreas.hansson@arm.com * stats or track values during a sample period. 3948981Sandreas.hansson@arm.com */ 3958981Sandreas.hansson@arm.com MonitorStats(const CommMonitorParams* params) : 3968981Sandreas.hansson@arm.com disableBurstLengthHists(params->disable_burst_length_hists), 3978981Sandreas.hansson@arm.com disableBandwidthHists(params->disable_bandwidth_hists), 3988981Sandreas.hansson@arm.com readBytes(0), writtenBytes(0), 3998981Sandreas.hansson@arm.com disableLatencyHists(params->disable_latency_hists), 4008981Sandreas.hansson@arm.com disableITTDists(params->disable_itt_dists), 4018981Sandreas.hansson@arm.com timeOfLastRead(0), timeOfLastWrite(0), timeOfLastReq(0), 4028981Sandreas.hansson@arm.com disableOutstandingHists(params->disable_outstanding_hists), 4038981Sandreas.hansson@arm.com outstandingReadReqs(0), outstandingWriteReqs(0), 4048981Sandreas.hansson@arm.com disableTransactionHists(params->disable_transaction_hists), 4058981Sandreas.hansson@arm.com readTrans(0), writeTrans(0), 4068981Sandreas.hansson@arm.com disableAddrDists(params->disable_addr_dists) 4078981Sandreas.hansson@arm.com { } 4088981Sandreas.hansson@arm.com 4098981Sandreas.hansson@arm.com }; 4108981Sandreas.hansson@arm.com 4118981Sandreas.hansson@arm.com /** This function is called periodically at the end of each time bin */ 4128981Sandreas.hansson@arm.com void samplePeriodic(); 4138981Sandreas.hansson@arm.com 4148981Sandreas.hansson@arm.com /** Schedule the first periodic event */ 4158981Sandreas.hansson@arm.com void startup(); 4168981Sandreas.hansson@arm.com 4178981Sandreas.hansson@arm.com /** Periodic event called at the end of each simulation time bin */ 4188981Sandreas.hansson@arm.com EventWrapper<CommMonitor, &CommMonitor::samplePeriodic> samplePeriodicEvent; 4198981Sandreas.hansson@arm.com 4208981Sandreas.hansson@arm.com /** Length of simulation time bin*/ 4218981Sandreas.hansson@arm.com Tick samplePeriodTicks; 4228981Sandreas.hansson@arm.com Time samplePeriod; 4238981Sandreas.hansson@arm.com 4248981Sandreas.hansson@arm.com /** Address mask for sources of read accesses to be captured */ 4258981Sandreas.hansson@arm.com Addr readAddrMask; 4268981Sandreas.hansson@arm.com 4278981Sandreas.hansson@arm.com /** Address mask for sources of write accesses to be captured */ 4288981Sandreas.hansson@arm.com Addr writeAddrMask; 4298981Sandreas.hansson@arm.com 4308981Sandreas.hansson@arm.com /** Instantiate stats */ 4318981Sandreas.hansson@arm.com MonitorStats stats; 4329398Sandreas.hansson@arm.com 4339398Sandreas.hansson@arm.com /** Output stream for a potential trace. */ 4349398Sandreas.hansson@arm.com ProtoOutputStream* traceStream; 4358981Sandreas.hansson@arm.com}; 4368981Sandreas.hansson@arm.com 4378981Sandreas.hansson@arm.com#endif //__MEM_COMM_MONITOR_HH__ 438