Profiler.cc revision 7456:8b9be6e12c9b
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; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29/* 30 This file has been modified by Kevin Moore and Dan Nussbaum of the 31 Scalable Systems Research Group at Sun Microsystems Laboratories 32 (http://research.sun.com/scalable/) to support the Adaptive 33 Transactional Memory Test Platform (ATMTP). 34 35 Please send email to atmtp-interest@sun.com with feedback, questions, or 36 to request future announcements about ATMTP. 37 38 ---------------------------------------------------------------------- 39 40 File modification date: 2008-02-23 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/protocol/CacheMsg.hh" 54#include "mem/protocol/MachineType.hh" 55#include "mem/protocol/Protocol.hh" 56#include "mem/ruby/common/Debug.hh" 57#include "mem/ruby/network/Network.hh" 58#include "mem/ruby/profiler/AddressProfiler.hh" 59#include "mem/ruby/profiler/Profiler.hh" 60#include "mem/ruby/system/System.hh" 61#include "mem/ruby/system/System.hh" 62 63using namespace std; 64using m5::stl_helpers::operator<<; 65 66extern ostream* debug_cout_ptr; 67 68static double process_memory_total(); 69static double process_memory_resident(); 70 71Profiler::Profiler(const Params *p) 72 : SimObject(p) 73{ 74 m_inst_profiler_ptr = NULL; 75 m_address_profiler_ptr = NULL; 76 77 m_real_time_start_time = time(NULL); // Not reset in clearStats() 78 m_stats_period = 1000000; // Default 79 m_periodic_output_file_ptr = &cerr; 80 81 m_hot_lines = p->hot_lines; 82 m_all_instructions = p->all_instructions; 83 84 m_num_of_sequencers = p->num_of_sequencers; 85 86 m_hot_lines = false; 87 m_all_instructions = false; 88 89 m_address_profiler_ptr = new AddressProfiler(m_num_of_sequencers); 90 m_address_profiler_ptr->setHotLines(m_hot_lines); 91 m_address_profiler_ptr->setAllInstructions(m_all_instructions); 92 93 if (m_all_instructions) { 94 m_inst_profiler_ptr = new AddressProfiler(m_num_of_sequencers); 95 m_inst_profiler_ptr->setHotLines(m_hot_lines); 96 m_inst_profiler_ptr->setAllInstructions(m_all_instructions); 97 } 98} 99 100Profiler::~Profiler() 101{ 102 if (m_periodic_output_file_ptr != &cerr) { 103 delete m_periodic_output_file_ptr; 104 } 105} 106 107void 108Profiler::wakeup() 109{ 110 // FIXME - avoid the repeated code 111 112 vector<integer_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->getCycleCount(i) - 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 122 out << "ruby_cycles: " << g_eventQueue_ptr->getTime()-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 131 out << "miss_latency: " << m_allMissLatencyHistogram << endl; 132 133 out << endl; 134 135 if (m_all_instructions) { 136 m_inst_profiler_ptr->printStats(out); 137 } 138 139 //g_system_ptr->getNetwork()->printStats(out); 140 g_eventQueue_ptr->scheduleEvent(this, m_stats_period); 141} 142 143void 144Profiler::setPeriodicStatsFile(const string& filename) 145{ 146 cout << "Recording periodic statistics to file '" << filename << "' every " 147 << m_stats_period << " Ruby cycles" << endl; 148 149 if (m_periodic_output_file_ptr != &cerr) { 150 delete m_periodic_output_file_ptr; 151 } 152 153 m_periodic_output_file_ptr = new ofstream(filename.c_str()); 154 g_eventQueue_ptr->scheduleEvent(this, 1); 155} 156 157void 158Profiler::setPeriodicStatsInterval(integer_t period) 159{ 160 cout << "Recording periodic statistics every " << m_stats_period 161 << " Ruby cycles" << endl; 162 163 m_stats_period = period; 164 g_eventQueue_ptr->scheduleEvent(this, 1); 165} 166 167void 168Profiler::printConfig(ostream& out) const 169{ 170 out << endl; 171 out << "Profiler Configuration" << endl; 172 out << "----------------------" << endl; 173 out << "periodic_stats_period: " << m_stats_period << endl; 174} 175 176void 177Profiler::print(ostream& out) const 178{ 179 out << "[Profiler]"; 180} 181 182void 183Profiler::printStats(ostream& out, bool short_stats) 184{ 185 out << endl; 186 if (short_stats) { 187 out << "SHORT "; 188 } 189 out << "Profiler Stats" << endl; 190 out << "--------------" << endl; 191 192 time_t real_time_current = time(NULL); 193 double seconds = difftime(real_time_current, m_real_time_start_time); 194 double minutes = seconds / 60.0; 195 double hours = minutes / 60.0; 196 double days = hours / 24.0; 197 Time ruby_cycles = g_eventQueue_ptr->getTime()-m_ruby_start; 198 199 if (!short_stats) { 200 out << "Elapsed_time_in_seconds: " << seconds << endl; 201 out << "Elapsed_time_in_minutes: " << minutes << endl; 202 out << "Elapsed_time_in_hours: " << hours << endl; 203 out << "Elapsed_time_in_days: " << days << endl; 204 out << endl; 205 } 206 207 // print the virtual runtimes as well 208 struct tms vtime; 209 times(&vtime); 210 seconds = (vtime.tms_utime + vtime.tms_stime) / 100.0; 211 minutes = seconds / 60.0; 212 hours = minutes / 60.0; 213 days = hours / 24.0; 214 out << "Virtual_time_in_seconds: " << seconds << endl; 215 out << "Virtual_time_in_minutes: " << minutes << endl; 216 out << "Virtual_time_in_hours: " << hours << endl; 217 out << "Virtual_time_in_days: " << days << endl; 218 out << endl; 219 220 out << "Ruby_current_time: " << g_eventQueue_ptr->getTime() << endl; 221 out << "Ruby_start_time: " << m_ruby_start << endl; 222 out << "Ruby_cycles: " << ruby_cycles << endl; 223 out << endl; 224 225 if (!short_stats) { 226 out << "mbytes_resident: " << process_memory_resident() << endl; 227 out << "mbytes_total: " << process_memory_total() << endl; 228 if (process_memory_total() > 0) { 229 out << "resident_ratio: " 230 << process_memory_resident()/process_memory_total() << endl; 231 } 232 out << endl; 233 } 234 235 vector<integer_t> perProcCycleCount(m_num_of_sequencers); 236 237 for (int i = 0; i < m_num_of_sequencers; i++) { 238 perProcCycleCount[i] = 239 g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1; 240 // The +1 allows us to avoid division by zero 241 } 242 243 out << "ruby_cycles_executed: " << perProcCycleCount << endl; 244 245 out << endl; 246 247 if (!short_stats) { 248 out << "Busy Controller Counts:" << endl; 249 for (int i = 0; i < MachineType_NUM; i++) { 250 int size = MachineType_base_count((MachineType)i); 251 for (int j = 0; j < size; j++) { 252 MachineID machID; 253 machID.type = (MachineType)i; 254 machID.num = j; 255 out << machID << ":" << m_busyControllerCount[i][j] << " "; 256 if ((j + 1) % 8 == 0) { 257 out << endl; 258 } 259 } 260 out << endl; 261 } 262 out << endl; 263 264 out << "Busy Bank Count:" << m_busyBankCount << endl; 265 out << endl; 266 267 out << "sequencer_requests_outstanding: " 268 << m_sequencer_requests << endl; 269 out << endl; 270 } 271 272 if (!short_stats) { 273 out << "All Non-Zero Cycle Demand Cache Accesses" << endl; 274 out << "----------------------------------------" << endl; 275 out << "miss_latency: " << m_allMissLatencyHistogram << endl; 276 for (int i = 0; i < m_missLatencyHistograms.size(); i++) { 277 if (m_missLatencyHistograms[i].size() > 0) { 278 out << "miss_latency_" << RubyRequestType(i) << ": " 279 << m_missLatencyHistograms[i] << endl; 280 } 281 } 282 for (int i = 0; i < m_machLatencyHistograms.size(); i++) { 283 if (m_machLatencyHistograms[i].size() > 0) { 284 out << "miss_latency_" << GenericMachineType(i) << ": " 285 << m_machLatencyHistograms[i] << endl; 286 } 287 } 288 289 out << endl; 290 291 out << "All Non-Zero Cycle SW Prefetch Requests" << endl; 292 out << "------------------------------------" << endl; 293 out << "prefetch_latency: " << m_allSWPrefetchLatencyHistogram << endl; 294 for (int i = 0; i < m_SWPrefetchLatencyHistograms.size(); i++) { 295 if (m_SWPrefetchLatencyHistograms[i].size() > 0) { 296 out << "prefetch_latency_" << CacheRequestType(i) << ": " 297 << m_SWPrefetchLatencyHistograms[i] << endl; 298 } 299 } 300 for (int i = 0; i < m_SWPrefetchMachLatencyHistograms.size(); i++) { 301 if (m_SWPrefetchMachLatencyHistograms[i].size() > 0) { 302 out << "prefetch_latency_" << GenericMachineType(i) << ": " 303 << m_SWPrefetchMachLatencyHistograms[i] << endl; 304 } 305 } 306 out << "prefetch_latency_L2Miss:" 307 << m_SWPrefetchL2MissLatencyHistogram << endl; 308 309 if (m_all_sharing_histogram.size() > 0) { 310 out << "all_sharing: " << m_all_sharing_histogram << endl; 311 out << "read_sharing: " << m_read_sharing_histogram << endl; 312 out << "write_sharing: " << m_write_sharing_histogram << endl; 313 314 out << "all_sharing_percent: "; 315 m_all_sharing_histogram.printPercent(out); 316 out << endl; 317 318 out << "read_sharing_percent: "; 319 m_read_sharing_histogram.printPercent(out); 320 out << endl; 321 322 out << "write_sharing_percent: "; 323 m_write_sharing_histogram.printPercent(out); 324 out << endl; 325 326 int64 total_miss = m_cache_to_cache + m_memory_to_cache; 327 out << "all_misses: " << total_miss << endl; 328 out << "cache_to_cache_misses: " << m_cache_to_cache << endl; 329 out << "memory_to_cache_misses: " << m_memory_to_cache << endl; 330 out << "cache_to_cache_percent: " 331 << 100.0 * (double(m_cache_to_cache) / double(total_miss)) 332 << endl; 333 out << "memory_to_cache_percent: " 334 << 100.0 * (double(m_memory_to_cache) / double(total_miss)) 335 << endl; 336 out << endl; 337 } 338 339 if (m_outstanding_requests.size() > 0) { 340 out << "outstanding_requests: "; 341 m_outstanding_requests.printPercent(out); 342 out << endl; 343 out << endl; 344 } 345 } 346 347 if (!short_stats) { 348 out << "Request vs. RubySystem State Profile" << endl; 349 out << "--------------------------------" << endl; 350 out << endl; 351 352 map<string, int>::const_iterator i = m_requestProfileMap.begin(); 353 map<string, int>::const_iterator end = m_requestProfileMap.end(); 354 for (; i != end; ++i) { 355 const string &key = i->first; 356 int count = i->second; 357 358 double percent = (100.0 * double(count)) / double(m_requests); 359 vector<string> items; 360 tokenize(items, key, ':'); 361 vector<string>::iterator j = items.begin(); 362 vector<string>::iterator end = items.end(); 363 for (; j != end; ++i) 364 out << setw(10) << *j; 365 out << setw(11) << count; 366 out << setw(14) << percent << endl; 367 } 368 out << endl; 369 370 out << "filter_action: " << m_filter_action_histogram << endl; 371 372 if (!m_all_instructions) { 373 m_address_profiler_ptr->printStats(out); 374 } 375 376 if (m_all_instructions) { 377 m_inst_profiler_ptr->printStats(out); 378 } 379 380 out << endl; 381 out << "Message Delayed Cycles" << endl; 382 out << "----------------------" << endl; 383 out << "Total_delay_cycles: " << m_delayedCyclesHistogram << endl; 384 out << "Total_nonPF_delay_cycles: " 385 << m_delayedCyclesNonPFHistogram << endl; 386 for (int i = 0; i < m_delayedCyclesVCHistograms.size(); i++) { 387 out << " virtual_network_" << i << "_delay_cycles: " 388 << m_delayedCyclesVCHistograms[i] << endl; 389 } 390 391 printResourceUsage(out); 392 } 393} 394 395void 396Profiler::printResourceUsage(ostream& out) const 397{ 398 out << endl; 399 out << "Resource Usage" << endl; 400 out << "--------------" << endl; 401 402 integer_t pagesize = getpagesize(); // page size in bytes 403 out << "page_size: " << pagesize << endl; 404 405 rusage usage; 406 getrusage (RUSAGE_SELF, &usage); 407 408 out << "user_time: " << usage.ru_utime.tv_sec << endl; 409 out << "system_time: " << usage.ru_stime.tv_sec << endl; 410 out << "page_reclaims: " << usage.ru_minflt << endl; 411 out << "page_faults: " << usage.ru_majflt << endl; 412 out << "swaps: " << usage.ru_nswap << endl; 413 out << "block_inputs: " << usage.ru_inblock << endl; 414 out << "block_outputs: " << usage.ru_oublock << endl; 415} 416 417void 418Profiler::clearStats() 419{ 420 m_ruby_start = g_eventQueue_ptr->getTime(); 421 422 m_cycles_executed_at_start.resize(m_num_of_sequencers); 423 for (int i = 0; i < m_num_of_sequencers; i++) { 424 if (g_system_ptr == NULL) { 425 m_cycles_executed_at_start[i] = 0; 426 } else { 427 m_cycles_executed_at_start[i] = g_system_ptr->getCycleCount(i); 428 } 429 } 430 431 m_busyControllerCount.resize(MachineType_NUM); // all machines 432 for (int i = 0; i < MachineType_NUM; i++) { 433 int size = MachineType_base_count((MachineType)i); 434 m_busyControllerCount[i].resize(size); 435 for (int j = 0; j < size; j++) { 436 m_busyControllerCount[i][j] = 0; 437 } 438 } 439 m_busyBankCount = 0; 440 441 m_delayedCyclesHistogram.clear(); 442 m_delayedCyclesNonPFHistogram.clear(); 443 int size = RubySystem::getNetwork()->getNumberOfVirtualNetworks(); 444 m_delayedCyclesVCHistograms.resize(size); 445 for (int i = 0; i < size; i++) { 446 m_delayedCyclesVCHistograms[i].clear(); 447 } 448 449 m_missLatencyHistograms.resize(RubyRequestType_NUM); 450 for (int i = 0; i < m_missLatencyHistograms.size(); i++) { 451 m_missLatencyHistograms[i].clear(200); 452 } 453 m_machLatencyHistograms.resize(GenericMachineType_NUM+1); 454 for (int i = 0; i < m_machLatencyHistograms.size(); i++) { 455 m_machLatencyHistograms[i].clear(200); 456 } 457 m_allMissLatencyHistogram.clear(200); 458 459 m_SWPrefetchLatencyHistograms.resize(CacheRequestType_NUM); 460 for (int i = 0; i < m_SWPrefetchLatencyHistograms.size(); i++) { 461 m_SWPrefetchLatencyHistograms[i].clear(200); 462 } 463 m_SWPrefetchMachLatencyHistograms.resize(GenericMachineType_NUM+1); 464 for (int i = 0; i < m_SWPrefetchMachLatencyHistograms.size(); i++) { 465 m_SWPrefetchMachLatencyHistograms[i].clear(200); 466 } 467 m_allSWPrefetchLatencyHistogram.clear(200); 468 469 m_sequencer_requests.clear(); 470 m_read_sharing_histogram.clear(); 471 m_write_sharing_histogram.clear(); 472 m_all_sharing_histogram.clear(); 473 m_cache_to_cache = 0; 474 m_memory_to_cache = 0; 475 476 // clear HashMaps 477 m_requestProfileMap.clear(); 478 479 // count requests profiled 480 m_requests = 0; 481 482 m_outstanding_requests.clear(); 483 m_outstanding_persistent_requests.clear(); 484 485 // Flush the prefetches through the system - used so that there 486 // are no outstanding requests after stats are cleared 487 //g_eventQueue_ptr->triggerAllEvents(); 488 489 // update the start time 490 m_ruby_start = g_eventQueue_ptr->getTime(); 491} 492 493void 494Profiler::addAddressTraceSample(const CacheMsg& msg, NodeID id) 495{ 496 if (msg.getType() != CacheRequestType_IFETCH) { 497 // Note: The following line should be commented out if you 498 // want to use the special profiling that is part of the GS320 499 // protocol 500 501 // NOTE: Unless PROFILE_HOT_LINES is enabled, nothing will be 502 // profiled by the AddressProfiler 503 m_address_profiler_ptr-> 504 addTraceSample(msg.getLineAddress(), msg.getProgramCounter(), 505 msg.getType(), msg.getAccessMode(), id, false); 506 } 507} 508 509void 510Profiler::profileSharing(const Address& addr, AccessType type, 511 NodeID requestor, const Set& sharers, 512 const Set& owner) 513{ 514 Set set_contacted(owner); 515 if (type == AccessType_Write) { 516 set_contacted.addSet(sharers); 517 } 518 set_contacted.remove(requestor); 519 int number_contacted = set_contacted.count(); 520 521 if (type == AccessType_Write) { 522 m_write_sharing_histogram.add(number_contacted); 523 } else { 524 m_read_sharing_histogram.add(number_contacted); 525 } 526 m_all_sharing_histogram.add(number_contacted); 527 528 if (number_contacted == 0) { 529 m_memory_to_cache++; 530 } else { 531 m_cache_to_cache++; 532 } 533} 534 535void 536Profiler::profileMsgDelay(int virtualNetwork, int delayCycles) 537{ 538 assert(virtualNetwork < m_delayedCyclesVCHistograms.size()); 539 m_delayedCyclesHistogram.add(delayCycles); 540 m_delayedCyclesVCHistograms[virtualNetwork].add(delayCycles); 541 if (virtualNetwork != 0) { 542 m_delayedCyclesNonPFHistogram.add(delayCycles); 543 } 544} 545 546// profiles original cache requests including PUTs 547void 548Profiler::profileRequest(const string& requestStr) 549{ 550 m_requests++; 551 552 // if it doesn't exist, conveniently, it will be created with the 553 // default value which is 0 554 m_requestProfileMap[requestStr]++; 555} 556 557void 558Profiler::controllerBusy(MachineID machID) 559{ 560 m_busyControllerCount[(int)machID.type][(int)machID.num]++; 561} 562 563void 564Profiler::profilePFWait(Time waitTime) 565{ 566 m_prefetchWaitHistogram.add(waitTime); 567} 568 569void 570Profiler::bankBusy() 571{ 572 m_busyBankCount++; 573} 574 575// non-zero cycle demand request 576void 577Profiler::missLatency(Time t, RubyRequestType type) 578{ 579 m_allMissLatencyHistogram.add(t); 580 m_missLatencyHistograms[type].add(t); 581} 582 583// non-zero cycle prefetch request 584void 585Profiler::swPrefetchLatency(Time t, CacheRequestType type, 586 GenericMachineType respondingMach) 587{ 588 m_allSWPrefetchLatencyHistogram.add(t); 589 m_SWPrefetchLatencyHistograms[type].add(t); 590 m_SWPrefetchMachLatencyHistograms[respondingMach].add(t); 591 if (respondingMach == GenericMachineType_Directory || 592 respondingMach == GenericMachineType_NUM) { 593 m_SWPrefetchL2MissLatencyHistogram.add(t); 594 } 595} 596 597void 598Profiler::profileTransition(const string& component, NodeID version, 599 Address addr, const string& state, const string& event, 600 const string& next_state, const string& note) 601{ 602 const int EVENT_SPACES = 20; 603 const int ID_SPACES = 3; 604 const int TIME_SPACES = 7; 605 const int COMP_SPACES = 10; 606 const int STATE_SPACES = 6; 607 608 if (g_debug_ptr->getDebugTime() <= 0 || 609 g_eventQueue_ptr->getTime() < g_debug_ptr->getDebugTime()) 610 return; 611 612 ostream &out = *debug_cout_ptr; 613 out.flags(ios::right); 614 out << setw(TIME_SPACES) << g_eventQueue_ptr->getTime() << " "; 615 out << setw(ID_SPACES) << version << " "; 616 out << setw(COMP_SPACES) << component; 617 out << setw(EVENT_SPACES) << event << " "; 618 619 out.flags(ios::right); 620 out << setw(STATE_SPACES) << state; 621 out << ">"; 622 out.flags(ios::left); 623 out << setw(STATE_SPACES) << next_state; 624 625 out << " " << addr << " " << note; 626 627 out << endl; 628} 629 630// Helper function 631static double 632process_memory_total() 633{ 634 // 4kB page size, 1024*1024 bytes per MB, 635 const double MULTIPLIER = 4096.0 / (1024.0 * 1024.0); 636 ifstream proc_file; 637 proc_file.open("/proc/self/statm"); 638 int total_size_in_pages = 0; 639 int res_size_in_pages = 0; 640 proc_file >> total_size_in_pages; 641 proc_file >> res_size_in_pages; 642 return double(total_size_in_pages) * MULTIPLIER; // size in megabytes 643} 644 645static double 646process_memory_resident() 647{ 648 // 4kB page size, 1024*1024 bytes per MB, 649 const double MULTIPLIER = 4096.0 / (1024.0 * 1024.0); 650 ifstream proc_file; 651 proc_file.open("/proc/self/statm"); 652 int total_size_in_pages = 0; 653 int res_size_in_pages = 0; 654 proc_file >> total_size_in_pages; 655 proc_file >> res_size_in_pages; 656 return double(res_size_in_pages) * MULTIPLIER; // size in megabytes 657} 658 659void 660Profiler::rubyWatch(int id) 661{ 662 uint64 tr = 0; 663 Address watch_address = Address(tr); 664 const int ID_SPACES = 3; 665 const int TIME_SPACES = 7; 666 667 ostream &out = *debug_cout_ptr; 668 669 out.flags(ios::right); 670 out << setw(TIME_SPACES) << g_eventQueue_ptr->getTime() << " "; 671 out << setw(ID_SPACES) << id << " " 672 << "RUBY WATCH " << watch_address << endl; 673 674 // don't care about success or failure 675 m_watch_address_set.insert(watch_address); 676} 677 678bool 679Profiler::watchAddress(Address addr) 680{ 681 return m_watch_address_set.count(addr) > 0; 682} 683 684Profiler * 685RubyProfilerParams::create() 686{ 687 return new Profiler(this); 688} 689