2009-05-11 19:38:43 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2009-07-07 00:49:47 +02:00
|
|
|
This file has been modified by Kevin Moore and Dan Nussbaum of the
|
|
|
|
Scalable Systems Research Group at Sun Microsystems Laboratories
|
|
|
|
(http://research.sun.com/scalable/) to support the Adaptive
|
|
|
|
Transactional Memory Test Platform (ATMTP).
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2009-07-07 00:49:47 +02:00
|
|
|
Please send email to atmtp-interest@sun.com with feedback, questions, or
|
|
|
|
to request future announcements about ATMTP.
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2009-07-07 00:49:47 +02:00
|
|
|
----------------------------------------------------------------------
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2009-07-07 00:49:47 +02:00
|
|
|
File modification date: 2008-02-23
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2009-07-07 00:49:47 +02:00
|
|
|
----------------------------------------------------------------------
|
2009-05-11 19:38:43 +02:00
|
|
|
*/
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
#ifndef __MEM_RUBY_PROFILER_PROFILER_HH__
|
|
|
|
#define __MEM_RUBY_PROFILER_PROFILER_HH__
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-04-02 20:20:32 +02:00
|
|
|
#include <iostream>
|
2010-06-11 08:17:07 +02:00
|
|
|
#include <map>
|
2010-04-02 20:20:32 +02:00
|
|
|
#include <string>
|
2010-06-11 08:17:07 +02:00
|
|
|
#include <vector>
|
2010-04-02 20:20:32 +02:00
|
|
|
|
2010-06-11 08:17:07 +02:00
|
|
|
#include "base/hashmap.hh"
|
2009-05-11 19:38:45 +02:00
|
|
|
#include "mem/protocol/AccessModeType.hh"
|
|
|
|
#include "mem/protocol/AccessType.hh"
|
2010-03-24 06:49:43 +01:00
|
|
|
#include "mem/protocol/CacheRequestType.hh"
|
|
|
|
#include "mem/protocol/GenericMachineType.hh"
|
|
|
|
#include "mem/protocol/GenericRequestType.hh"
|
2009-05-11 19:38:45 +02:00
|
|
|
#include "mem/protocol/PrefetchBit.hh"
|
|
|
|
#include "mem/ruby/common/Address.hh"
|
2010-03-24 06:49:43 +01:00
|
|
|
#include "mem/ruby/common/Consumer.hh"
|
|
|
|
#include "mem/ruby/common/Global.hh"
|
|
|
|
#include "mem/ruby/common/Histogram.hh"
|
2009-05-11 19:38:45 +02:00
|
|
|
#include "mem/ruby/common/Set.hh"
|
2010-03-24 06:49:43 +01:00
|
|
|
#include "mem/ruby/libruby.hh"
|
|
|
|
#include "mem/ruby/system/MachineID.hh"
|
2009-07-07 00:49:47 +02:00
|
|
|
#include "mem/ruby/system/MemoryControl.hh"
|
2010-03-24 06:49:43 +01:00
|
|
|
#include "mem/ruby/system/NodeID.hh"
|
2010-01-30 05:29:17 +01:00
|
|
|
#include "params/RubyProfiler.hh"
|
|
|
|
#include "sim/sim_object.hh"
|
|
|
|
|
2009-05-11 19:38:43 +02:00
|
|
|
class CacheMsg;
|
|
|
|
class AddressProfiler;
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
class Profiler : public SimObject, public Consumer
|
|
|
|
{
|
|
|
|
public:
|
2010-01-30 05:29:17 +01:00
|
|
|
typedef RubyProfilerParams Params;
|
2010-03-24 06:49:43 +01:00
|
|
|
Profiler(const Params *);
|
|
|
|
~Profiler();
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void wakeup();
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-04-02 20:20:32 +02:00
|
|
|
void setPeriodicStatsFile(const std::string& filename);
|
2010-03-24 06:49:43 +01:00
|
|
|
void setPeriodicStatsInterval(integer_t period);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-04-02 20:20:32 +02:00
|
|
|
void printStats(std::ostream& out, bool short_stats=false);
|
|
|
|
void printShortStats(std::ostream& out) { printStats(out, true); }
|
|
|
|
void printTraceStats(std::ostream& out) const;
|
2010-03-24 06:49:43 +01:00
|
|
|
void clearStats();
|
2010-04-02 20:20:32 +02:00
|
|
|
void printConfig(std::ostream& out) const;
|
|
|
|
void printResourceUsage(std::ostream& out) const;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
AddressProfiler* getAddressProfiler() { return m_address_profiler_ptr; }
|
|
|
|
AddressProfiler* getInstructionProfiler() { return m_inst_profiler_ptr; }
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void addAddressTraceSample(const CacheMsg& msg, NodeID id);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-04-02 20:20:32 +02:00
|
|
|
void profileRequest(const std::string& requestStr);
|
2010-03-24 06:49:43 +01:00
|
|
|
void profileSharing(const Address& addr, AccessType type,
|
|
|
|
NodeID requestor, const Set& sharers,
|
|
|
|
const Set& owner);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void profileMulticastRetry(const Address& addr, int count);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void profileFilterAction(int action);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void profileConflictingRequests(const Address& addr);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
|
|
|
profileOutstandingRequest(int outstanding)
|
|
|
|
{
|
|
|
|
m_outstanding_requests.add(outstanding);
|
|
|
|
}
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
|
|
|
profileOutstandingPersistentRequest(int outstanding)
|
|
|
|
{
|
|
|
|
m_outstanding_persistent_requests.add(outstanding);
|
|
|
|
}
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
|
|
|
profileAverageLatencyEstimate(int latency)
|
|
|
|
{
|
|
|
|
m_average_latency_estimate.add(latency);
|
|
|
|
}
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void recordPrediction(bool wasGood, bool wasPredicted);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void startTransaction(int cpu);
|
|
|
|
void endTransaction(int cpu);
|
|
|
|
void profilePFWait(Time waitTime);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void controllerBusy(MachineID machID);
|
|
|
|
void bankBusy();
|
2010-08-20 20:46:12 +02:00
|
|
|
|
|
|
|
void missLatency(Time t,
|
|
|
|
RubyRequestType type,
|
|
|
|
const GenericMachineType respondingMach);
|
|
|
|
|
|
|
|
void swPrefetchLatency(Time t,
|
|
|
|
CacheRequestType type,
|
|
|
|
const GenericMachineType respondingMach);
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void sequencerRequests(int num) { m_sequencer_requests.add(num); }
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-04-02 20:20:32 +02:00
|
|
|
void profileTransition(const std::string& component, NodeID version,
|
|
|
|
Address addr, const std::string& state, const std::string& event,
|
|
|
|
const std::string& next_state, const std::string& note);
|
2010-03-24 06:49:43 +01:00
|
|
|
void profileMsgDelay(int virtualNetwork, int delayCycles);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-04-02 20:20:32 +02:00
|
|
|
void print(std::ostream& out) const;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void rubyWatch(int proc);
|
|
|
|
bool watchAddress(Address addr);
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
// return Ruby's start time
|
|
|
|
Time
|
|
|
|
getRubyStartTime()
|
|
|
|
{
|
|
|
|
return m_ruby_start;
|
|
|
|
}
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
// added by SS
|
|
|
|
bool getHotLines() { return m_hot_lines; }
|
|
|
|
bool getAllInstructions() { return m_all_instructions; }
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
private:
|
|
|
|
// Private copy constructor and assignment operator
|
|
|
|
Profiler(const Profiler& obj);
|
|
|
|
Profiler& operator=(const Profiler& obj);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
AddressProfiler* m_address_profiler_ptr;
|
|
|
|
AddressProfiler* m_inst_profiler_ptr;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-06-11 08:17:07 +02:00
|
|
|
std::vector<int64> m_instructions_executed_at_start;
|
|
|
|
std::vector<int64> m_cycles_executed_at_start;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-04-02 20:20:32 +02:00
|
|
|
std::ostream* m_periodic_output_file_ptr;
|
2010-03-24 06:49:43 +01:00
|
|
|
integer_t m_stats_period;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
Time m_ruby_start;
|
|
|
|
time_t m_real_time_start_time;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-06-11 08:17:07 +02:00
|
|
|
std::vector<std::vector<integer_t> > m_busyControllerCount;
|
2010-03-24 06:49:43 +01:00
|
|
|
integer_t m_busyBankCount;
|
|
|
|
Histogram m_multicast_retry_histogram;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
Histogram m_filter_action_histogram;
|
|
|
|
Histogram m_tbeProfile;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
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;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
Histogram m_prefetchWaitHistogram;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-06-11 08:17:07 +02:00
|
|
|
std::vector<Histogram> m_missLatencyHistograms;
|
|
|
|
std::vector<Histogram> m_machLatencyHistograms;
|
2010-03-24 06:49:43 +01:00
|
|
|
Histogram m_allMissLatencyHistogram;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
Histogram m_allSWPrefetchLatencyHistogram;
|
|
|
|
Histogram m_SWPrefetchL2MissLatencyHistogram;
|
2010-06-11 08:17:07 +02:00
|
|
|
std::vector<Histogram> m_SWPrefetchLatencyHistograms;
|
|
|
|
std::vector<Histogram> m_SWPrefetchMachLatencyHistograms;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
Histogram m_delayedCyclesHistogram;
|
|
|
|
Histogram m_delayedCyclesNonPFHistogram;
|
2010-06-11 08:17:07 +02:00
|
|
|
std::vector<Histogram> m_delayedCyclesVCHistograms;
|
2010-03-24 06:49:43 +01:00
|
|
|
|
|
|
|
Histogram m_outstanding_requests;
|
|
|
|
Histogram m_outstanding_persistent_requests;
|
|
|
|
|
|
|
|
Histogram m_average_latency_estimate;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-06-11 08:17:07 +02:00
|
|
|
m5::hash_set<Address> m_watch_address_set;
|
2010-03-24 06:49:43 +01:00
|
|
|
// counts all initiated cache request including PUTs
|
|
|
|
int m_requests;
|
2010-06-11 08:17:07 +02:00
|
|
|
std::map<std::string, int> m_requestProfileMap;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
//added by SS
|
|
|
|
bool m_hot_lines;
|
|
|
|
bool m_all_instructions;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
int m_num_of_sequencers;
|
2009-05-11 19:38:43 +02:00
|
|
|
};
|
|
|
|
|
2010-04-02 20:20:32 +02:00
|
|
|
inline std::ostream&
|
|
|
|
operator<<(std::ostream& out, const Profiler& obj)
|
2009-05-11 19:38:43 +02:00
|
|
|
{
|
2010-03-24 06:49:43 +01:00
|
|
|
obj.print(out);
|
2010-04-02 20:20:32 +02:00
|
|
|
out << std::flush;
|
2010-03-24 06:49:43 +01:00
|
|
|
return out;
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
#endif // __MEM_RUBY_PROFILER_PROFILER_HH__
|
2009-05-11 19:38:43 +02:00
|
|
|
|
|
|
|
|