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 |
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 |
76Profiler::Profiler(const Params *p) 77 : SimObject(p) |
78{ |
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; |
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 |
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} |