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

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

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

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

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

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

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

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

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

--- 223 unchanged lines hidden ---