Deleted Added
sdiff udiff text old ( 7056:b66b558578bd ) new ( 7454:3a3e8e8cce1b )
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;

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

41
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
51#include "base/stl_helpers.hh"
52#include "base/str.hh"
53#include "mem/gems_common/Map.hh"
54#include "mem/gems_common/PrioHeap.hh"
55#include "mem/protocol/CacheMsg.hh"
56#include "mem/protocol/MachineType.hh"
57#include "mem/protocol/Protocol.hh"
58#include "mem/ruby/common/Debug.hh"
59#include "mem/ruby/network/Network.hh"
60#include "mem/ruby/profiler/AddressProfiler.hh"
61#include "mem/ruby/profiler/Profiler.hh"
62#include "mem/ruby/system/System.hh"
63#include "mem/ruby/system/System.hh"
64
65using namespace std;
66using m5::stl_helpers::operator<<;
67
68extern ostream* debug_cout_ptr;
69
70static double process_memory_total();
71static double process_memory_resident();
72
73Profiler::Profiler(const Params *p)
74 : SimObject(p)

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

110 delete m_requestProfileMap_ptr;
111}
112
113void
114Profiler::wakeup()
115{
116 // FIXME - avoid the repeated code
117
118 vector<integer_t> perProcCycleCount(m_num_of_sequencers);
119
120 for (int i = 0; i < m_num_of_sequencers; i++) {
121 perProcCycleCount[i] =
122 g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
123 // The +1 allows us to avoid division by zero
124 }
125
126 ostream &out = *m_periodic_output_file_ptr;

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

233 out << "mbytes_total: " << process_memory_total() << endl;
234 if (process_memory_total() > 0) {
235 out << "resident_ratio: "
236 << process_memory_resident()/process_memory_total() << endl;
237 }
238 out << endl;
239 }
240
241 vector<integer_t> perProcCycleCount(m_num_of_sequencers);
242
243 for (int i = 0; i < m_num_of_sequencers; i++) {
244 perProcCycleCount[i] =
245 g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
246 // The +1 allows us to avoid division by zero
247 }
248
249 out << "ruby_cycles_executed: " << perProcCycleCount << endl;

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

350 }
351 }
352
353 if (!short_stats) {
354 out << "Request vs. RubySystem State Profile" << endl;
355 out << "--------------------------------" << endl;
356 out << endl;
357
358 vector<string> requestProfileKeys = m_requestProfileMap_ptr->keys();
359 sort(requestProfileKeys.begin(), requestProfileKeys.end());
360
361 for (int i = 0; i < requestProfileKeys.size(); i++) {
362 int temp_int =
363 m_requestProfileMap_ptr->lookup(requestProfileKeys[i]);
364 double percent = (100.0 * double(temp_int)) / double(m_requests);
365 vector<string> items;
366 tokenize(items, requestProfileKeys[i], ':');
367 vector<string>::iterator i = items.begin();

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

420 out << "block_outputs: " << usage.ru_oublock << endl;
421}
422
423void
424Profiler::clearStats()
425{
426 m_ruby_start = g_eventQueue_ptr->getTime();
427
428 m_cycles_executed_at_start.resize(m_num_of_sequencers);
429 for (int i = 0; i < m_num_of_sequencers; i++) {
430 if (g_system_ptr == NULL) {
431 m_cycles_executed_at_start[i] = 0;
432 } else {
433 m_cycles_executed_at_start[i] = g_system_ptr->getCycleCount(i);
434 }
435 }
436
437 m_busyControllerCount.resize(MachineType_NUM); // all machines
438 for (int i = 0; i < MachineType_NUM; i++) {
439 int size = MachineType_base_count((MachineType)i);
440 m_busyControllerCount[i].resize(size);
441 for (int j = 0; j < size; j++) {
442 m_busyControllerCount[i][j] = 0;
443 }
444 }
445 m_busyBankCount = 0;
446
447 m_delayedCyclesHistogram.clear();
448 m_delayedCyclesNonPFHistogram.clear();
449 int size = RubySystem::getNetwork()->getNumberOfVirtualNetworks();
450 m_delayedCyclesVCHistograms.resize(size);
451 for (int i = 0; i < size; i++) {
452 m_delayedCyclesVCHistograms[i].clear();
453 }
454
455 m_missLatencyHistograms.resize(RubyRequestType_NUM);
456 for (int i = 0; i < m_missLatencyHistograms.size(); i++) {
457 m_missLatencyHistograms[i].clear(200);
458 }
459 m_machLatencyHistograms.resize(GenericMachineType_NUM+1);
460 for (int i = 0; i < m_machLatencyHistograms.size(); i++) {
461 m_machLatencyHistograms[i].clear(200);
462 }
463 m_allMissLatencyHistogram.clear(200);
464
465 m_SWPrefetchLatencyHistograms.resize(CacheRequestType_NUM);
466 for (int i = 0; i < m_SWPrefetchLatencyHistograms.size(); i++) {
467 m_SWPrefetchLatencyHistograms[i].clear(200);
468 }
469 m_SWPrefetchMachLatencyHistograms.resize(GenericMachineType_NUM+1);
470 for (int i = 0; i < m_SWPrefetchMachLatencyHistograms.size(); i++) {
471 m_SWPrefetchMachLatencyHistograms[i].clear(200);
472 }
473 m_allSWPrefetchLatencyHistogram.clear(200);
474
475 m_sequencer_requests.clear();
476 m_read_sharing_histogram.clear();
477 m_write_sharing_histogram.clear();

--- 223 unchanged lines hidden ---