Profiler.cc (7048:2ab58c54de63) Profiler.cc (7054:7d6862b80049)
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;

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

120
121 ostream &out = *m_periodic_output_file_ptr;
122
123 out << "ruby_cycles: " << g_eventQueue_ptr->getTime()-m_ruby_start << endl
124 << "mbytes_resident: " << process_memory_resident() << endl
125 << "mbytes_total: " << process_memory_total() << endl;
126
127 if (process_memory_total() > 0) {
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;

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

120
121 ostream &out = *m_periodic_output_file_ptr;
122
123 out << "ruby_cycles: " << g_eventQueue_ptr->getTime()-m_ruby_start << endl
124 << "mbytes_resident: " << process_memory_resident() << endl
125 << "mbytes_total: " << process_memory_total() << endl;
126
127 if (process_memory_total() > 0) {
128 out << "resident_ratio: "
128 out << "resident_ratio: "
129 << process_memory_resident() / process_memory_total() << endl;
130 }
131
132 out << "miss_latency: " << m_allMissLatencyHistogram << endl;
133
134 out << endl;
135
136 if (m_all_instructions) {

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

153
154 m_periodic_output_file_ptr = new ofstream(filename.c_str());
155 g_eventQueue_ptr->scheduleEvent(this, 1);
156}
157
158void
159Profiler::setPeriodicStatsInterval(integer_t period)
160{
129 << process_memory_resident() / process_memory_total() << endl;
130 }
131
132 out << "miss_latency: " << m_allMissLatencyHistogram << endl;
133
134 out << endl;
135
136 if (m_all_instructions) {

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

153
154 m_periodic_output_file_ptr = new ofstream(filename.c_str());
155 g_eventQueue_ptr->scheduleEvent(this, 1);
156}
157
158void
159Profiler::setPeriodicStatsInterval(integer_t period)
160{
161 cout << "Recording periodic statistics every " << m_stats_period
161 cout << "Recording periodic statistics every " << m_stats_period
162 << " Ruby cycles" << endl;
163
164 m_stats_period = period;
165 g_eventQueue_ptr->scheduleEvent(this, 1);
166}
167
168void
169Profiler::printConfig(ostream& out) const

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

222 out << "Ruby_start_time: " << m_ruby_start << endl;
223 out << "Ruby_cycles: " << ruby_cycles << endl;
224 out << endl;
225
226 if (!short_stats) {
227 out << "mbytes_resident: " << process_memory_resident() << endl;
228 out << "mbytes_total: " << process_memory_total() << endl;
229 if (process_memory_total() > 0) {
162 << " Ruby cycles" << endl;
163
164 m_stats_period = period;
165 g_eventQueue_ptr->scheduleEvent(this, 1);
166}
167
168void
169Profiler::printConfig(ostream& out) const

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

222 out << "Ruby_start_time: " << m_ruby_start << endl;
223 out << "Ruby_cycles: " << ruby_cycles << endl;
224 out << endl;
225
226 if (!short_stats) {
227 out << "mbytes_resident: " << process_memory_resident() << endl;
228 out << "mbytes_total: " << process_memory_total() << endl;
229 if (process_memory_total() > 0) {
230 out << "resident_ratio: "
230 out << "resident_ratio: "
231 << process_memory_resident()/process_memory_total() << endl;
232 }
233 out << endl;
234 }
235
236 Vector<integer_t> perProcCycleCount;
237 perProcCycleCount.setSize(m_num_of_sequencers);
238

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

628 out << endl;
629}
630
631// Helper function
632static double
633process_memory_total()
634{
635 // 4kB page size, 1024*1024 bytes per MB,
231 << process_memory_resident()/process_memory_total() << endl;
232 }
233 out << endl;
234 }
235
236 Vector<integer_t> perProcCycleCount;
237 perProcCycleCount.setSize(m_num_of_sequencers);
238

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

628 out << endl;
629}
630
631// Helper function
632static double
633process_memory_total()
634{
635 // 4kB page size, 1024*1024 bytes per MB,
636 const double MULTIPLIER = 4096.0 / (1024.0 * 1024.0);
636 const double MULTIPLIER = 4096.0 / (1024.0 * 1024.0);
637 ifstream proc_file;
638 proc_file.open("/proc/self/statm");
639 int total_size_in_pages = 0;
640 int res_size_in_pages = 0;
641 proc_file >> total_size_in_pages;
642 proc_file >> res_size_in_pages;
643 return double(total_size_in_pages) * MULTIPLIER; // size in megabytes
644}

--- 49 unchanged lines hidden ---
637 ifstream proc_file;
638 proc_file.open("/proc/self/statm");
639 int total_size_in_pages = 0;
640 int res_size_in_pages = 0;
641 proc_file >> total_size_in_pages;
642 proc_file >> res_size_in_pages;
643 return double(total_size_in_pages) * MULTIPLIER; // size in megabytes
644}

--- 49 unchanged lines hidden ---