Profiler.cc (9507:d2ab6d889fc7) Profiler.cc (9508:dde110931867)
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;

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

108Profiler::wakeup()
109{
110 // FIXME - avoid the repeated code
111
112 vector<int64_t> perProcCycleCount(m_num_of_sequencers);
113
114 for (int i = 0; i < m_num_of_sequencers; i++) {
115 perProcCycleCount[i] =
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;

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

108Profiler::wakeup()
109{
110 // FIXME - avoid the repeated code
111
112 vector<int64_t> perProcCycleCount(m_num_of_sequencers);
113
114 for (int i = 0; i < m_num_of_sequencers; i++) {
115 perProcCycleCount[i] =
116 g_system_ptr->getTime() - m_cycles_executed_at_start[i] + 1;
116 g_system_ptr->curCycle() - m_cycles_executed_at_start[i] + 1;
117 // The +1 allows us to avoid division by zero
118 }
119
120 ostream &out = *m_periodic_output_file_ptr;
121
117 // The +1 allows us to avoid division by zero
118 }
119
120 ostream &out = *m_periodic_output_file_ptr;
121
122 out << "ruby_cycles: " << g_system_ptr->getTime()-m_ruby_start << endl
122 out << "ruby_cycles: " << g_system_ptr->curCycle()-m_ruby_start << endl
123 << "mbytes_resident: " << process_memory_resident() << endl
124 << "mbytes_total: " << process_memory_total() << endl;
125
126 if (process_memory_total() > 0) {
127 out << "resident_ratio: "
128 << process_memory_resident() / process_memory_total() << endl;
129 }
130

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

265 out << "Profiler Stats" << endl;
266 out << "--------------" << endl;
267
268 time_t real_time_current = time(NULL);
269 double seconds = difftime(real_time_current, m_real_time_start_time);
270 double minutes = seconds / 60.0;
271 double hours = minutes / 60.0;
272 double days = hours / 24.0;
123 << "mbytes_resident: " << process_memory_resident() << endl
124 << "mbytes_total: " << process_memory_total() << endl;
125
126 if (process_memory_total() > 0) {
127 out << "resident_ratio: "
128 << process_memory_resident() / process_memory_total() << endl;
129 }
130

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

265 out << "Profiler Stats" << endl;
266 out << "--------------" << endl;
267
268 time_t real_time_current = time(NULL);
269 double seconds = difftime(real_time_current, m_real_time_start_time);
270 double minutes = seconds / 60.0;
271 double hours = minutes / 60.0;
272 double days = hours / 24.0;
273 Cycles ruby_cycles = g_system_ptr->getTime()-m_ruby_start;
273 Cycles ruby_cycles = g_system_ptr->curCycle()-m_ruby_start;
274
275 if (!short_stats) {
276 out << "Elapsed_time_in_seconds: " << seconds << endl;
277 out << "Elapsed_time_in_minutes: " << minutes << endl;
278 out << "Elapsed_time_in_hours: " << hours << endl;
279 out << "Elapsed_time_in_days: " << days << endl;
280 out << endl;
281 }

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

288 hours = minutes / 60.0;
289 days = hours / 24.0;
290 out << "Virtual_time_in_seconds: " << seconds << endl;
291 out << "Virtual_time_in_minutes: " << minutes << endl;
292 out << "Virtual_time_in_hours: " << hours << endl;
293 out << "Virtual_time_in_days: " << days << endl;
294 out << endl;
295
274
275 if (!short_stats) {
276 out << "Elapsed_time_in_seconds: " << seconds << endl;
277 out << "Elapsed_time_in_minutes: " << minutes << endl;
278 out << "Elapsed_time_in_hours: " << hours << endl;
279 out << "Elapsed_time_in_days: " << days << endl;
280 out << endl;
281 }

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

288 hours = minutes / 60.0;
289 days = hours / 24.0;
290 out << "Virtual_time_in_seconds: " << seconds << endl;
291 out << "Virtual_time_in_minutes: " << minutes << endl;
292 out << "Virtual_time_in_hours: " << hours << endl;
293 out << "Virtual_time_in_days: " << days << endl;
294 out << endl;
295
296 out << "Ruby_current_time: " << g_system_ptr->getTime() << endl;
296 out << "Ruby_current_time: " << g_system_ptr->curCycle() << endl;
297 out << "Ruby_start_time: " << m_ruby_start << endl;
298 out << "Ruby_cycles: " << ruby_cycles << endl;
299 out << endl;
300
301 if (!short_stats) {
302 out << "mbytes_resident: " << process_memory_resident() << endl;
303 out << "mbytes_total: " << process_memory_total() << endl;
304 if (process_memory_total() > 0) {
305 out << "resident_ratio: "
306 << process_memory_resident()/process_memory_total() << endl;
307 }
308 out << endl;
309 }
310
311 vector<int64_t> perProcCycleCount(m_num_of_sequencers);
312
313 for (int i = 0; i < m_num_of_sequencers; i++) {
314 perProcCycleCount[i] =
297 out << "Ruby_start_time: " << m_ruby_start << endl;
298 out << "Ruby_cycles: " << ruby_cycles << endl;
299 out << endl;
300
301 if (!short_stats) {
302 out << "mbytes_resident: " << process_memory_resident() << endl;
303 out << "mbytes_total: " << process_memory_total() << endl;
304 if (process_memory_total() > 0) {
305 out << "resident_ratio: "
306 << process_memory_resident()/process_memory_total() << endl;
307 }
308 out << endl;
309 }
310
311 vector<int64_t> perProcCycleCount(m_num_of_sequencers);
312
313 for (int i = 0; i < m_num_of_sequencers; i++) {
314 perProcCycleCount[i] =
315 g_system_ptr->getTime() - m_cycles_executed_at_start[i] + 1;
315 g_system_ptr->curCycle() - m_cycles_executed_at_start[i] + 1;
316 // The +1 allows us to avoid division by zero
317 }
318
319 out << "ruby_cycles_executed: " << perProcCycleCount << endl;
320
321 out << endl;
322
323 if (!short_stats) {

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

492 out << "swaps: " << usage.ru_nswap << endl;
493 out << "block_inputs: " << usage.ru_inblock << endl;
494 out << "block_outputs: " << usage.ru_oublock << endl;
495}
496
497void
498Profiler::clearStats()
499{
316 // The +1 allows us to avoid division by zero
317 }
318
319 out << "ruby_cycles_executed: " << perProcCycleCount << endl;
320
321 out << endl;
322
323 if (!short_stats) {

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

492 out << "swaps: " << usage.ru_nswap << endl;
493 out << "block_inputs: " << usage.ru_inblock << endl;
494 out << "block_outputs: " << usage.ru_oublock << endl;
495}
496
497void
498Profiler::clearStats()
499{
500 m_ruby_start = g_system_ptr->getTime();
500 m_ruby_start = g_system_ptr->curCycle();
501 m_real_time_start_time = time(NULL);
502
503 m_cycles_executed_at_start.resize(m_num_of_sequencers);
504 for (int i = 0; i < m_num_of_sequencers; i++) {
505 if (g_system_ptr == NULL) {
506 m_cycles_executed_at_start[i] = 0;
507 } else {
501 m_real_time_start_time = time(NULL);
502
503 m_cycles_executed_at_start.resize(m_num_of_sequencers);
504 for (int i = 0; i < m_num_of_sequencers; i++) {
505 if (g_system_ptr == NULL) {
506 m_cycles_executed_at_start[i] = 0;
507 } else {
508 m_cycles_executed_at_start[i] = g_system_ptr->getTime();
508 m_cycles_executed_at_start[i] = g_system_ptr->curCycle();
509 }
510 }
511
512 m_busyBankCount = 0;
513
514 m_missLatencyHistograms.resize(RubyRequestType_NUM);
515 for (int i = 0; i < m_missLatencyHistograms.size(); i++) {
516 m_missLatencyHistograms[i].clear(200);

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

558 m_outstanding_requests.clear();
559 m_outstanding_persistent_requests.clear();
560
561 // Flush the prefetches through the system - used so that there
562 // are no outstanding requests after stats are cleared
563 //g_eventQueue_ptr->triggerAllEvents();
564
565 // update the start time
509 }
510 }
511
512 m_busyBankCount = 0;
513
514 m_missLatencyHistograms.resize(RubyRequestType_NUM);
515 for (int i = 0; i < m_missLatencyHistograms.size(); i++) {
516 m_missLatencyHistograms[i].clear(200);

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

558 m_outstanding_requests.clear();
559 m_outstanding_persistent_requests.clear();
560
561 // Flush the prefetches through the system - used so that there
562 // are no outstanding requests after stats are cleared
563 //g_eventQueue_ptr->triggerAllEvents();
564
565 // update the start time
566 m_ruby_start = g_system_ptr->getTime();
566 m_ruby_start = g_system_ptr->curCycle();
567}
568
569void
570Profiler::addAddressTraceSample(const RubyRequest& msg, NodeID id)
571{
572 if (msg.getType() != RubyRequestType_IFETCH) {
573 // Note: The following line should be commented out if you
574 // want to use the special profiling that is part of the GS320

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

729}
730
731void
732Profiler::rubyWatch(int id)
733{
734 uint64 tr = 0;
735 Address watch_address = Address(tr);
736
567}
568
569void
570Profiler::addAddressTraceSample(const RubyRequest& msg, NodeID id)
571{
572 if (msg.getType() != RubyRequestType_IFETCH) {
573 // Note: The following line should be commented out if you
574 // want to use the special profiling that is part of the GS320

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

729}
730
731void
732Profiler::rubyWatch(int id)
733{
734 uint64 tr = 0;
735 Address watch_address = Address(tr);
736
737 DPRINTFN("%7s %3s RUBY WATCH %d\n", g_system_ptr->getTime(), id,
737 DPRINTFN("%7s %3s RUBY WATCH %d\n", g_system_ptr->curCycle(), id,
738 watch_address);
739
740 // don't care about success or failure
741 m_watch_address_set.insert(watch_address);
742}
743
744bool
745Profiler::watchAddress(Address addr)
746{
747 return m_watch_address_set.count(addr) > 0;
748}
749
750Profiler *
751RubyProfilerParams::create()
752{
753 return new Profiler(this);
754}
738 watch_address);
739
740 // don't care about success or failure
741 m_watch_address_set.insert(watch_address);
742}
743
744bool
745Profiler::watchAddress(Address addr)
746{
747 return m_watch_address_set.count(addr) > 0;
748}
749
750Profiler *
751RubyProfilerParams::create()
752{
753 return new Profiler(this);
754}