Profiler.cc (6433:0f0f0fbef977) | Profiler.cc (6876:a658c315512c) |
---|---|
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 | 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#include "mem/ruby/system/System.hh" 67 |
|
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 | 68// Allows use of times() library call, which determines virtual runtime 69#include <sys/times.h> 70 71extern std::ostream * debug_cout_ptr; 72 73static double process_memory_total(); 74static double process_memory_resident(); 75 |
74Profiler::Profiler(const string & name) | 76Profiler::Profiler(const Params *p) 77 : SimObject(p) |
75{ | 78{ |
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 | 79 m_requestProfileMap_ptr = new Map<string, int>; 80 81 m_inst_profiler_ptr = NULL; 82 m_address_profiler_ptr = NULL; 83 84 m_real_time_start_time = time(NULL); // Not reset in clearStats() 85 m_stats_period = 1000000; // Default 86 m_periodic_output_file_ptr = &cerr; 87 |
88 m_hot_lines = p->hot_lines; 89 m_all_instructions = p->all_instructions; 90 91 RubySystem::m_profiler_ptr = this; |
|
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 | 92} 93 94Profiler::~Profiler() 95{ 96 if (m_periodic_output_file_ptr != &cerr) { 97 delete m_periodic_output_file_ptr; 98 } 99 delete m_requestProfileMap_ptr; --- 37 unchanged lines hidden (view full) --- 137 138 m_memory_control_profilers [(*it).c_str()] = mcp; 139 } 140 141 clearStats(); 142 m_hot_lines = false; 143 m_all_instructions = false; 144 |
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 | 145 m_address_profiler_ptr = new AddressProfiler; 146 m_address_profiler_ptr -> setHotLines(m_hot_lines); 147 m_address_profiler_ptr -> setAllInstructions(m_all_instructions); 148 149 if (m_all_instructions) { 150 m_inst_profiler_ptr = new AddressProfiler; 151 m_inst_profiler_ptr -> setHotLines(m_hot_lines); 152 m_inst_profiler_ptr -> setAllInstructions(m_all_instructions); --- 686 unchanged lines hidden (view full) --- 839void Profiler::profileMemWrite(string name) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memWrite++; } 840void Profiler::profileMemWaitCycles(string name, int cycles) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memWaitCycles += cycles; } 841void Profiler::profileMemInputQ(string name, int cycles) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memInputQ += cycles; } 842void Profiler::profileMemBankQ(string name, int cycles) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memBankQ += cycles; } 843void Profiler::profileMemArbWait(string name, int cycles) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memArbWait += cycles; } 844void Profiler::profileMemRandBusy(string name) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memRandBusy++; } 845void Profiler::profileMemNotOld(string name) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memNotOld++; } 846 |
847 848Profiler * 849RubyProfilerParams::create() 850{ 851 return new Profiler(this); 852} |
|