Profiler.cc (7002:48a19d52d939) Profiler.cc (7010:c769c45253c9)
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;

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

121 Vector<integer_t> perProcCycleCount;
122 perProcCycleCount.setSize(m_num_of_sequencers);
123
124 for(int i=0; i < m_num_of_sequencers; i++) {
125 perProcCycleCount[i] = g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
126 // The +1 allows us to avoid division by zero
127 }
128
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;

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

121 Vector<integer_t> perProcCycleCount;
122 perProcCycleCount.setSize(m_num_of_sequencers);
123
124 for(int i=0; i < m_num_of_sequencers; i++) {
125 perProcCycleCount[i] = g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
126 // The +1 allows us to avoid division by zero
127 }
128
129 integer_t total_misses = m_perProcTotalMisses.sum();
130 integer_t simics_cycles_executed = perProcCycleCount.sum();
131 integer_t transactions_started = m_perProcStartTransaction.sum();
132 integer_t transactions_ended = m_perProcEndTransaction.sum();
133
134 (*m_periodic_output_file_ptr) << "ruby_cycles: "
135 << g_eventQueue_ptr->getTime()-m_ruby_start
136 << endl;
137
129 (*m_periodic_output_file_ptr) << "ruby_cycles: "
130 << g_eventQueue_ptr->getTime()-m_ruby_start
131 << endl;
132
138 (*m_periodic_output_file_ptr) << "total_misses: "
139 << total_misses
140 << " "
141 << m_perProcTotalMisses
142 << endl;
143
144 (*m_periodic_output_file_ptr) << "simics_cycles_executed: "
145 << simics_cycles_executed
146 << " "
147 << perProcCycleCount
148 << endl;
149
150 (*m_periodic_output_file_ptr) << "transactions_started: "
151 << transactions_started
152 << " "
153 << m_perProcStartTransaction
154 << endl;
155
156 (*m_periodic_output_file_ptr) << "transactions_ended: "
157 << transactions_ended
158 << " "
159 << m_perProcEndTransaction
160 << endl;
161
162 (*m_periodic_output_file_ptr) << "mbytes_resident: "
163 << process_memory_resident()
164 << endl;
165
166 (*m_periodic_output_file_ptr) << "mbytes_total: "
167 << process_memory_total()
168 << endl;
169

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

271 out << "resident_ratio: "
272 << process_memory_resident()/process_memory_total() << endl;
273 }
274 out << endl;
275
276 }
277
278 Vector<integer_t> perProcCycleCount;
133 (*m_periodic_output_file_ptr) << "mbytes_resident: "
134 << process_memory_resident()
135 << endl;
136
137 (*m_periodic_output_file_ptr) << "mbytes_total: "
138 << process_memory_total()
139 << endl;
140

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

242 out << "resident_ratio: "
243 << process_memory_resident()/process_memory_total() << endl;
244 }
245 out << endl;
246
247 }
248
249 Vector<integer_t> perProcCycleCount;
279 Vector<double> perProcCyclesPerTrans;
280 Vector<double> perProcMissesPerTrans;
281
282
283 perProcCycleCount.setSize(m_num_of_sequencers);
250 perProcCycleCount.setSize(m_num_of_sequencers);
284 perProcCyclesPerTrans.setSize(m_num_of_sequencers);
285 perProcMissesPerTrans.setSize(m_num_of_sequencers);
286
287 for(int i=0; i < m_num_of_sequencers; i++) {
288 perProcCycleCount[i] = g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
289 // The +1 allows us to avoid division by zero
251
252 for(int i=0; i < m_num_of_sequencers; i++) {
253 perProcCycleCount[i] = g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
254 // The +1 allows us to avoid division by zero
290
291 int trans = m_perProcEndTransaction[i];
292 if (trans == 0) {
293 perProcCyclesPerTrans[i] = 0;
294 perProcMissesPerTrans[i] = 0;
295 } else {
296 perProcCyclesPerTrans[i] = ruby_cycles / double(trans);
297 perProcMissesPerTrans[i] = m_perProcTotalMisses[i] / double(trans);
298 }
299 }
300
255 }
256
301 integer_t total_misses = m_perProcTotalMisses.sum();
302 integer_t user_misses = m_perProcUserMisses.sum();
303 integer_t supervisor_misses = m_perProcSupervisorMisses.sum();
304 integer_t simics_cycles_executed = perProcCycleCount.sum();
305 integer_t transactions_started = m_perProcStartTransaction.sum();
306 integer_t transactions_ended = m_perProcEndTransaction.sum();
257 out << "ruby_cycles_executed: " << perProcCycleCount << endl;
307
258
308 double cycles_per_transaction = (transactions_ended != 0) ? (m_num_of_sequencers * double(ruby_cycles)) / double(transactions_ended) : 0;
309 double misses_per_transaction = (transactions_ended != 0) ? double(total_misses) / double(transactions_ended) : 0;
310
311 out << "Total_misses: " << total_misses << endl;
312 out << "total_misses: " << total_misses << " " << m_perProcTotalMisses << endl;
313 out << "user_misses: " << user_misses << " " << m_perProcUserMisses << endl;
314 out << "supervisor_misses: " << supervisor_misses << " " << m_perProcSupervisorMisses << endl;
315 out << endl;
259 out << endl;
316 out << "ruby_cycles_executed: " << simics_cycles_executed << " " << perProcCycleCount << endl;
317 out << endl;
318 out << "transactions_started: " << transactions_started << " " << m_perProcStartTransaction << endl;
319 out << "transactions_ended: " << transactions_ended << " " << m_perProcEndTransaction << endl;
320 out << "cycles_per_transaction: " << cycles_per_transaction << " " << perProcCyclesPerTrans << endl;
321 out << "misses_per_transaction: " << misses_per_transaction << " " << perProcMissesPerTrans << endl;
322
260
323 out << endl;
324
325 out << endl;
326
327 if (!short_stats) {
328 out << "Busy Controller Counts:" << endl;
329 for(int i=0; i < MachineType_NUM; i++) {
330 for(int j=0; j < MachineType_base_count((MachineType)i); j++) {
331 MachineID machID;
332 machID.type = (MachineType)i;
333 machID.num = j;
334 out << machID << ":" << m_busyControllerCount[i][j] << " ";

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

475 for (int i=0; i < m_num_of_sequencers; i++) {
476 if (g_system_ptr == NULL) {
477 m_cycles_executed_at_start[i] = 0;
478 } else {
479 m_cycles_executed_at_start[i] = g_system_ptr->getCycleCount(i);
480 }
481 }
482
261 if (!short_stats) {
262 out << "Busy Controller Counts:" << endl;
263 for(int i=0; i < MachineType_NUM; i++) {
264 for(int j=0; j < MachineType_base_count((MachineType)i); j++) {
265 MachineID machID;
266 machID.type = (MachineType)i;
267 machID.num = j;
268 out << machID << ":" << m_busyControllerCount[i][j] << " ";

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

409 for (int i=0; i < m_num_of_sequencers; i++) {
410 if (g_system_ptr == NULL) {
411 m_cycles_executed_at_start[i] = 0;
412 } else {
413 m_cycles_executed_at_start[i] = g_system_ptr->getCycleCount(i);
414 }
415 }
416
483 m_perProcTotalMisses.setSize(m_num_of_sequencers);
484 m_perProcUserMisses.setSize(m_num_of_sequencers);
485 m_perProcSupervisorMisses.setSize(m_num_of_sequencers);
486 m_perProcStartTransaction.setSize(m_num_of_sequencers);
487 m_perProcEndTransaction.setSize(m_num_of_sequencers);
488
489 for(int i=0; i < m_num_of_sequencers; i++) {
490 m_perProcTotalMisses[i] = 0;
491 m_perProcUserMisses[i] = 0;
492 m_perProcSupervisorMisses[i] = 0;
493 m_perProcStartTransaction[i] = 0;
494 m_perProcEndTransaction[i] = 0;
495 }
496
497 m_busyControllerCount.setSize(MachineType_NUM); // all machines
498 for(int i=0; i < MachineType_NUM; i++) {
499 m_busyControllerCount[i].setSize(MachineType_base_count((MachineType)i));
500 for(int j=0; j < MachineType_base_count((MachineType)i); j++) {
501 m_busyControllerCount[i][j] = 0;
502 }
503 }
504 m_busyBankCount = 0;

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

605
606 if (m_requestProfileMap_ptr->exist(requestStr)) {
607 (m_requestProfileMap_ptr->lookup(requestStr))++;
608 } else {
609 m_requestProfileMap_ptr->add(requestStr, 1);
610 }
611}
612
417 m_busyControllerCount.setSize(MachineType_NUM); // all machines
418 for(int i=0; i < MachineType_NUM; i++) {
419 m_busyControllerCount[i].setSize(MachineType_base_count((MachineType)i));
420 for(int j=0; j < MachineType_base_count((MachineType)i); j++) {
421 m_busyControllerCount[i][j] = 0;
422 }
423 }
424 m_busyBankCount = 0;

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

525
526 if (m_requestProfileMap_ptr->exist(requestStr)) {
527 (m_requestProfileMap_ptr->lookup(requestStr))++;
528 } else {
529 m_requestProfileMap_ptr->add(requestStr, 1);
530 }
531}
532
613void Profiler::startTransaction(int cpu)
614{
615 m_perProcStartTransaction[cpu]++;
616}
617
618void Profiler::endTransaction(int cpu)
619{
620 m_perProcEndTransaction[cpu]++;
621}
622
623void Profiler::controllerBusy(MachineID machID)
624{
625 m_busyControllerCount[(int)machID.type][(int)machID.num]++;
626}
627
628void Profiler::profilePFWait(Time waitTime)
629{
630 m_prefetchWaitHistogram.add(waitTime);

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

704 int total_size_in_pages = 0;
705 int res_size_in_pages = 0;
706 proc_file >> total_size_in_pages;
707 proc_file >> res_size_in_pages;
708 return double(res_size_in_pages)*MULTIPLIER; // size in megabytes
709}
710
711void Profiler::rubyWatch(int id){
533void Profiler::controllerBusy(MachineID machID)
534{
535 m_busyControllerCount[(int)machID.type][(int)machID.num]++;
536}
537
538void Profiler::profilePFWait(Time waitTime)
539{
540 m_prefetchWaitHistogram.add(waitTime);

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

614 int total_size_in_pages = 0;
615 int res_size_in_pages = 0;
616 proc_file >> total_size_in_pages;
617 proc_file >> res_size_in_pages;
618 return double(res_size_in_pages)*MULTIPLIER; // size in megabytes
619}
620
621void Profiler::rubyWatch(int id){
712 //int rn_g1 = 0;//SIMICS_get_register_number(id, "g1");
713 uint64 tr = 0;//SIMICS_read_register(id, rn_g1);
622 uint64 tr = 0;
714 Address watch_address = Address(tr);
715 const int ID_SPACES = 3;
716 const int TIME_SPACES = 7;
717
718 (* debug_cout_ptr).flags(ios::right);
719 (* debug_cout_ptr) << setw(TIME_SPACES) << g_eventQueue_ptr->getTime() << " ";
720 (* debug_cout_ptr) << setw(ID_SPACES) << id << " "
721 << "RUBY WATCH "

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

729
730bool Profiler::watchAddress(Address addr){
731 if (m_watch_address_list_ptr->exist(addr))
732 return true;
733 else
734 return false;
735}
736
623 Address watch_address = Address(tr);
624 const int ID_SPACES = 3;
625 const int TIME_SPACES = 7;
626
627 (* debug_cout_ptr).flags(ios::right);
628 (* debug_cout_ptr) << setw(TIME_SPACES) << g_eventQueue_ptr->getTime() << " ";
629 (* debug_cout_ptr) << setw(ID_SPACES) << id << " "
630 << "RUBY WATCH "

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

638
639bool Profiler::watchAddress(Address addr){
640 if (m_watch_address_list_ptr->exist(addr))
641 return true;
642 else
643 return false;
644}
645
737int64 Profiler::getTotalTransactionsExecuted() const {
738 return m_perProcEndTransaction.sum();
739}
740
741
742Profiler *
743RubyProfilerParams::create()
744{
745 return new Profiler(this);
746}
646Profiler *
647RubyProfilerParams::create()
648{
649 return new Profiler(this);
650}