Deleted Added
sdiff udiff text old ( 6433:0f0f0fbef977 ) new ( 6876:a658c315512c )
full compact
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 49 unchanged lines hidden (view full) ---

58#include "mem/gems_common/PrioHeap.hh"
59#include "mem/protocol/CacheMsg.hh"
60#include "mem/protocol/Protocol.hh"
61#include "mem/gems_common/util.hh"
62#include "mem/gems_common/Map.hh"
63#include "mem/ruby/common/Debug.hh"
64#include "mem/protocol/MachineType.hh"
65
66// Allows use of times() library call, which determines virtual runtime
67#include <sys/times.h>
68
69extern std::ostream * debug_cout_ptr;
70
71static double process_memory_total();
72static double process_memory_resident();
73
74Profiler::Profiler(const string & name)
75{
76 m_name = name;
77 m_requestProfileMap_ptr = new Map<string, int>;
78
79 m_inst_profiler_ptr = NULL;
80 m_address_profiler_ptr = NULL;
81
82 m_real_time_start_time = time(NULL); // Not reset in clearStats()
83 m_stats_period = 1000000; // Default
84 m_periodic_output_file_ptr = &cerr;
85
86}
87
88Profiler::~Profiler()
89{
90 if (m_periodic_output_file_ptr != &cerr) {
91 delete m_periodic_output_file_ptr;
92 }
93 delete m_requestProfileMap_ptr;

--- 37 unchanged lines hidden (view full) ---

131
132 m_memory_control_profilers [(*it).c_str()] = mcp;
133 }
134
135 clearStats();
136 m_hot_lines = false;
137 m_all_instructions = false;
138
139 for (size_t i=0; i<argv.size(); i+=2) {
140 if ( argv[i] == "hot_lines") {
141 m_hot_lines = (argv[i+1]=="true");
142 } else if ( argv[i] == "all_instructions") {
143 m_all_instructions = (argv[i+1]=="true");
144 }else {
145 cerr << "WARNING: Profiler: Unkown configuration parameter: " << argv[i] << endl;
146 assert(false);
147 }
148 }
149
150 m_address_profiler_ptr = new AddressProfiler;
151 m_address_profiler_ptr -> setHotLines(m_hot_lines);
152 m_address_profiler_ptr -> setAllInstructions(m_all_instructions);
153
154 if (m_all_instructions) {
155 m_inst_profiler_ptr = new AddressProfiler;
156 m_inst_profiler_ptr -> setHotLines(m_hot_lines);
157 m_inst_profiler_ptr -> setAllInstructions(m_all_instructions);

--- 686 unchanged lines hidden (view full) ---

844void Profiler::profileMemWrite(string name) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memWrite++; }
845void Profiler::profileMemWaitCycles(string name, int cycles) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memWaitCycles += cycles; }
846void Profiler::profileMemInputQ(string name, int cycles) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memInputQ += cycles; }
847void Profiler::profileMemBankQ(string name, int cycles) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memBankQ += cycles; }
848void Profiler::profileMemArbWait(string name, int cycles) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memArbWait += cycles; }
849void Profiler::profileMemRandBusy(string name) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memRandBusy++; }
850void Profiler::profileMemNotOld(string name) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memNotOld++; }
851