X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmem%2Fruby%2Fprofiler%2FProfiler.hh;h=6ad65f9625e74c8905a3d526e6532a8880f1f3cc;hb=698866d46197ad062384894f1927f99f26b03f3b;hp=5b370de54b5aae8421e5c3234ec4dc9af082e9fc;hpb=a49b1df3f0d1e1c9ce46675d9fce7787d98caca7;p=gem5.git diff --git a/src/mem/ruby/profiler/Profiler.hh b/src/mem/ruby/profiler/Profiler.hh index 5b370de54..6ad65f962 100644 --- a/src/mem/ruby/profiler/Profiler.hh +++ b/src/mem/ruby/profiler/Profiler.hh @@ -45,133 +45,42 @@ #ifndef __MEM_RUBY_PROFILER_PROFILER_HH__ #define __MEM_RUBY_PROFILER_PROFILER_HH__ -#include #include #include #include -#include "base/hashmap.hh" +#include "base/callback.hh" +#include "base/statistics.hh" #include "mem/protocol/AccessType.hh" -#include "mem/protocol/GenericMachineType.hh" -#include "mem/protocol/GenericRequestType.hh" #include "mem/protocol/PrefetchBit.hh" #include "mem/protocol/RubyAccessMode.hh" #include "mem/protocol/RubyRequestType.hh" -#include "mem/ruby/common/Address.hh" -#include "mem/ruby/common/Global.hh" -#include "mem/ruby/common/Histogram.hh" -#include "mem/ruby/common/Set.hh" -#include "mem/ruby/system/MachineID.hh" -#include "mem/ruby/system/MemoryControl.hh" -#include "params/RubyProfiler.hh" -#include "sim/sim_object.hh" +#include "mem/ruby/common/MachineID.hh" +#include "params/RubySystem.hh" class RubyRequest; class AddressProfiler; -class Profiler : public SimObject +class Profiler { public: - typedef RubyProfilerParams Params; - Profiler(const Params *); + Profiler(const RubySystemParams *params, RubySystem *rs); ~Profiler(); - void wakeup(); - - void setPeriodicStatsFile(const std::string& filename); - void setPeriodicStatsInterval(int64_t period); + RubySystem *m_ruby_system; - void printStats(std::ostream& out, bool short_stats=false); - void printShortStats(std::ostream& out) { printStats(out, true); } - void printTraceStats(std::ostream& out) const; - void clearStats(); - void printResourceUsage(std::ostream& out) const; + void wakeup(); + void regStats(const std::string &name); + void collateStats(); AddressProfiler* getAddressProfiler() { return m_address_profiler_ptr; } AddressProfiler* getInstructionProfiler() { return m_inst_profiler_ptr; } void addAddressTraceSample(const RubyRequest& msg, NodeID id); - void profileRequest(const std::string& requestStr); - void profileSharing(const Address& addr, AccessType type, - NodeID requestor, const Set& sharers, - const Set& owner); - - void profileMulticastRetry(const Address& addr, int count); - - void profileFilterAction(int action); - - void profileConflictingRequests(const Address& addr); - - void - profileOutstandingRequest(int outstanding) - { - m_outstanding_requests.add(outstanding); - } - - void - profileOutstandingPersistentRequest(int outstanding) - { - m_outstanding_persistent_requests.add(outstanding); - } - - void - profileAverageLatencyEstimate(int latency) - { - m_average_latency_estimate.add(latency); - } - - void recordPrediction(bool wasGood, bool wasPredicted); - - void startTransaction(int cpu); - void endTransaction(int cpu); - void profilePFWait(Time waitTime); - - void controllerBusy(MachineID machID); - void bankBusy(); - - void missLatency(Time t, - RubyRequestType type, - const GenericMachineType respondingMach); - - void missLatencyWcc(Time issuedTime, - Time initialRequestTime, - Time forwardRequestTime, - Time firstResponseTime, - Time completionTime); - - void missLatencyDir(Time issuedTime, - Time initialRequestTime, - Time forwardRequestTime, - Time firstResponseTime, - Time completionTime); - - void swPrefetchLatency(Time t, - RubyRequestType type, - const GenericMachineType respondingMach); - - void sequencerRequests(int num) { m_sequencer_requests.add(num); } - - void profileMsgDelay(uint32_t virtualNetwork, Time delayCycles); - - void print(std::ostream& out) const; - - void rubyWatch(int proc); - bool watchAddress(Address addr); - - // return Ruby's start time - Time - getRubyStartTime() - { - return m_ruby_start; - } - // added by SS - bool getHotLines() { return m_hot_lines; } - bool getAllInstructions() { return m_all_instructions; } - - private: - void printRequestProfile(std::ostream &out); + bool getHotLines() const { return m_hot_lines; } + bool getAllInstructions() const { return m_all_instructions; } private: // Private copy constructor and assignment operator @@ -181,89 +90,58 @@ class Profiler : public SimObject AddressProfiler* m_address_profiler_ptr; AddressProfiler* m_inst_profiler_ptr; - std::vector m_instructions_executed_at_start; - std::vector m_cycles_executed_at_start; - - std::ostream* m_periodic_output_file_ptr; - int64_t m_stats_period; - - Time m_ruby_start; - time_t m_real_time_start_time; - - int64_t m_busyBankCount; - Histogram m_multicast_retry_histogram; - - Histogram m_filter_action_histogram; - Histogram m_tbeProfile; - - Histogram m_sequencer_requests; - Histogram m_read_sharing_histogram; - Histogram m_write_sharing_histogram; - Histogram m_all_sharing_histogram; - int64 m_cache_to_cache; - int64 m_memory_to_cache; - - Histogram m_prefetchWaitHistogram; - - std::vector m_missLatencyHistograms; - std::vector m_machLatencyHistograms; - std::vector< std::vector > m_missMachLatencyHistograms; - Histogram m_wCCIssueToInitialRequestHistogram; - Histogram m_wCCInitialRequestToForwardRequestHistogram; - Histogram m_wCCForwardRequestToFirstResponseHistogram; - Histogram m_wCCFirstResponseToCompleteHistogram; - int64 m_wCCIncompleteTimes; - Histogram m_dirIssueToInitialRequestHistogram; - Histogram m_dirInitialRequestToForwardRequestHistogram; - Histogram m_dirForwardRequestToFirstResponseHistogram; - Histogram m_dirFirstResponseToCompleteHistogram; - int64 m_dirIncompleteTimes; - - Histogram m_allMissLatencyHistogram; - - Histogram m_allSWPrefetchLatencyHistogram; - Histogram m_SWPrefetchL2MissLatencyHistogram; - std::vector m_SWPrefetchLatencyHistograms; - std::vector m_SWPrefetchMachLatencyHistograms; - - Histogram m_delayedCyclesHistogram; - Histogram m_delayedCyclesNonPFHistogram; - std::vector m_delayedCyclesVCHistograms; - - Histogram m_outstanding_requests; - Histogram m_outstanding_persistent_requests; - - Histogram m_average_latency_estimate; - - m5::hash_set
m_watch_address_set; + Stats::Histogram delayHistogram; + std::vector delayVCHistogram; + + //! Histogram for number of outstanding requests per cycle. + Stats::Histogram m_outstandReqHistSeqr; + Stats::Histogram m_outstandReqHistCoalsr; + + //! Histogram for holding latency profile of all requests. + Stats::Histogram m_latencyHistSeqr; + Stats::Histogram m_latencyHistCoalsr; + std::vector m_typeLatencyHistSeqr; + std::vector m_typeLatencyHistCoalsr; + + //! Histogram for holding latency profile of all requests that + //! hit in the controller connected to this sequencer. + Stats::Histogram m_hitLatencyHistSeqr; + std::vector m_hitTypeLatencyHistSeqr; + + //! Histograms for profiling the latencies for requests that + //! did not required external messages. + std::vector m_hitMachLatencyHistSeqr; + std::vector< std::vector > m_hitTypeMachLatencyHistSeqr; + + //! Histogram for holding latency profile of all requests that + //! miss in the controller connected to this sequencer. + Stats::Histogram m_missLatencyHistSeqr; + Stats::Histogram m_missLatencyHistCoalsr; + std::vector m_missTypeLatencyHistSeqr; + std::vector m_missTypeLatencyHistCoalsr; + + //! Histograms for profiling the latencies for requests that + //! required external messages. + std::vector m_missMachLatencyHistSeqr; + std::vector< std::vector > m_missTypeMachLatencyHistSeqr; + std::vector m_missMachLatencyHistCoalsr; + std::vector< std::vector > m_missTypeMachLatencyHistCoalsr; + + //! Histograms for recording the breakdown of miss latency + std::vector m_IssueToInitialDelayHistSeqr; + std::vector m_InitialToForwardDelayHistSeqr; + std::vector m_ForwardToFirstResponseDelayHistSeqr; + std::vector m_FirstResponseToCompletionDelayHistSeqr; + Stats::Scalar m_IncompleteTimesSeqr[MachineType_NUM]; + std::vector m_IssueToInitialDelayHistCoalsr; + std::vector m_InitialToForwardDelayHistCoalsr; + std::vector m_ForwardToFirstResponseDelayHistCoalsr; + std::vector m_FirstResponseToCompletionDelayHistCoalsr; //added by SS - bool m_hot_lines; - bool m_all_instructions; - - int m_num_of_sequencers; - - protected: - class ProfileEvent : public Event - { - public: - ProfileEvent(Profiler *_profiler) - { - profiler = _profiler; - } - private: - void process() { profiler->wakeup(); } - Profiler *profiler; - }; - ProfileEvent m_event; + const bool m_hot_lines; + const bool m_all_instructions; + const uint32_t m_num_vnets; }; -inline std::ostream& -operator<<(std::ostream& out, const Profiler& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - #endif // __MEM_RUBY_PROFILER_PROFILER_HH__