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; --- 33 unchanged lines hidden (view full) --- 42 ---------------------------------------------------------------------- 43*/ 44 45// Allows use of times() library call, which determines virtual runtime 46#include <sys/resource.h> 47#include <sys/times.h> 48 49#include <algorithm> |
50#include <fstream> |
51 52#include "base/stl_helpers.hh" 53#include "base/str.hh" 54#include "mem/protocol/CacheMsg.hh" 55#include "mem/protocol/MachineType.hh" 56#include "mem/protocol/Protocol.hh" |
57#include "mem/ruby/network/Network.hh" 58#include "mem/ruby/profiler/AddressProfiler.hh" 59#include "mem/ruby/profiler/Profiler.hh" 60#include "mem/ruby/system/System.hh" 61#include "mem/ruby/system/System.hh" 62 63using namespace std; 64using m5::stl_helpers::operator<<; 65 |
66static double process_memory_total(); 67static double process_memory_resident(); 68 69Profiler::Profiler(const Params *p) 70 : SimObject(p) 71{ 72 m_inst_profiler_ptr = NULL; 73 m_address_profiler_ptr = NULL; --- 616 unchanged lines hidden (view full) --- 690 m_SWPrefetchLatencyHistograms[type].add(cycles); 691 m_SWPrefetchMachLatencyHistograms[respondingMach].add(cycles); 692 if (respondingMach == GenericMachineType_Directory || 693 respondingMach == GenericMachineType_NUM) { 694 m_SWPrefetchL2MissLatencyHistogram.add(cycles); 695 } 696} 697 |
698// Helper function 699static double 700process_memory_total() 701{ 702 // 4kB page size, 1024*1024 bytes per MB, 703 const double MULTIPLIER = 4096.0 / (1024.0 * 1024.0); 704 ifstream proc_file; 705 proc_file.open("/proc/self/statm"); --- 18 unchanged lines hidden (view full) --- 724 return double(res_size_in_pages) * MULTIPLIER; // size in megabytes 725} 726 727void 728Profiler::rubyWatch(int id) 729{ 730 uint64 tr = 0; 731 Address watch_address = Address(tr); |
732 |
733 DPRINTFN("%7s %3s RUBY WATCH %d\n", g_eventQueue_ptr->getTime(), id, 734 watch_address); |
735 |
736 // don't care about success or failure 737 m_watch_address_set.insert(watch_address); 738} 739 740bool 741Profiler::watchAddress(Address addr) 742{ 743 return m_watch_address_set.count(addr) > 0; 744} 745 746Profiler * 747RubyProfilerParams::create() 748{ 749 return new Profiler(this); 750} |