Profiler.cc revision 7055:4e24742201d7
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 "mem/gems_common/Map.hh"
50#include "mem/gems_common/PrioHeap.hh"
51#include "mem/gems_common/util.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)
71{
72    m_requestProfileMap_ptr = new Map<string, int>;
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    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;
124
125    out << "ruby_cycles: " << g_eventQueue_ptr->getTime()-m_ruby_start << endl
126        << "mbytes_resident: " << process_memory_resident() << endl
127        << "mbytes_total: " << process_memory_total() << endl;
128
129    if (process_memory_total() > 0) {
130        out << "resident_ratio: "
131            << process_memory_resident() / process_memory_total() << endl;
132    }
133
134    out << "miss_latency: " << m_allMissLatencyHistogram << endl;
135
136    out << endl;
137
138    if (m_all_instructions) {
139        m_inst_profiler_ptr->printStats(out);
140    }
141
142    //g_system_ptr->getNetwork()->printStats(out);
143    g_eventQueue_ptr->scheduleEvent(this, m_stats_period);
144}
145
146void
147Profiler::setPeriodicStatsFile(const string& filename)
148{
149    cout << "Recording periodic statistics to file '" << filename << "' every "
150         << m_stats_period << " Ruby cycles" << endl;
151
152    if (m_periodic_output_file_ptr != &cerr) {
153        delete m_periodic_output_file_ptr;
154    }
155
156    m_periodic_output_file_ptr = new ofstream(filename.c_str());
157    g_eventQueue_ptr->scheduleEvent(this, 1);
158}
159
160void
161Profiler::setPeriodicStatsInterval(integer_t period)
162{
163    cout << "Recording periodic statistics every " << m_stats_period
164         << " Ruby cycles" << endl;
165
166    m_stats_period = period;
167    g_eventQueue_ptr->scheduleEvent(this, 1);
168}
169
170void
171Profiler::printConfig(ostream& out) const
172{
173    out << endl;
174    out << "Profiler Configuration" << endl;
175    out << "----------------------" << endl;
176    out << "periodic_stats_period: " << m_stats_period << endl;
177}
178
179void
180Profiler::print(ostream& out) const
181{
182    out << "[Profiler]";
183}
184
185void
186Profiler::printStats(ostream& out, bool short_stats)
187{
188    out << endl;
189    if (short_stats) {
190        out << "SHORT ";
191    }
192    out << "Profiler Stats" << endl;
193    out << "--------------" << endl;
194
195    time_t real_time_current = time(NULL);
196    double seconds = difftime(real_time_current, m_real_time_start_time);
197    double minutes = seconds / 60.0;
198    double hours = minutes / 60.0;
199    double days = hours / 24.0;
200    Time ruby_cycles = g_eventQueue_ptr->getTime()-m_ruby_start;
201
202    if (!short_stats) {
203        out << "Elapsed_time_in_seconds: " << seconds << endl;
204        out << "Elapsed_time_in_minutes: " << minutes << endl;
205        out << "Elapsed_time_in_hours: " << hours << endl;
206        out << "Elapsed_time_in_days: " << days << endl;
207        out << endl;
208    }
209
210    // print the virtual runtimes as well
211    struct tms vtime;
212    times(&vtime);
213    seconds = (vtime.tms_utime + vtime.tms_stime) / 100.0;
214    minutes = seconds / 60.0;
215    hours = minutes / 60.0;
216    days = hours / 24.0;
217    out << "Virtual_time_in_seconds: " << seconds << endl;
218    out << "Virtual_time_in_minutes: " << minutes << endl;
219    out << "Virtual_time_in_hours:   " << hours << endl;
220    out << "Virtual_time_in_days:    " << days << endl;
221    out << endl;
222
223    out << "Ruby_current_time: " << g_eventQueue_ptr->getTime() << endl;
224    out << "Ruby_start_time: " << m_ruby_start << endl;
225    out << "Ruby_cycles: " << ruby_cycles << endl;
226    out << endl;
227
228    if (!short_stats) {
229        out << "mbytes_resident: " << process_memory_resident() << endl;
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;
248
249    out << endl;
250
251    if (!short_stats) {
252        out << "Busy Controller Counts:" << endl;
253        for (int i = 0; i < MachineType_NUM; i++) {
254            int size = MachineType_base_count((MachineType)i);
255            for (int j = 0; j < size; j++) {
256                MachineID machID;
257                machID.type = (MachineType)i;
258                machID.num = j;
259                out << machID << ":" << m_busyControllerCount[i][j] << "  ";
260                if ((j + 1) % 8 == 0) {
261                    out << endl;
262                }
263            }
264            out << endl;
265        }
266        out << endl;
267
268        out << "Busy Bank Count:" << m_busyBankCount << endl;
269        out << endl;
270
271        out << "sequencer_requests_outstanding: "
272            << m_sequencer_requests << endl;
273        out << endl;
274    }
275
276    if (!short_stats) {
277        out << "All Non-Zero Cycle Demand Cache Accesses" << endl;
278        out << "----------------------------------------" << endl;
279        out << "miss_latency: " << m_allMissLatencyHistogram << endl;
280        for (int i = 0; i < m_missLatencyHistograms.size(); i++) {
281            if (m_missLatencyHistograms[i].size() > 0) {
282                out << "miss_latency_" << RubyRequestType(i) << ": "
283                    << m_missLatencyHistograms[i] << endl;
284            }
285        }
286        for (int i = 0; i < m_machLatencyHistograms.size(); i++) {
287            if (m_machLatencyHistograms[i].size() > 0) {
288                out << "miss_latency_" << GenericMachineType(i) << ": "
289                    << m_machLatencyHistograms[i] << endl;
290            }
291        }
292
293        out << endl;
294
295        out << "All Non-Zero Cycle SW Prefetch Requests" << endl;
296        out << "------------------------------------" << endl;
297        out << "prefetch_latency: " << m_allSWPrefetchLatencyHistogram << endl;
298        for (int i = 0; i < m_SWPrefetchLatencyHistograms.size(); i++) {
299            if (m_SWPrefetchLatencyHistograms[i].size() > 0) {
300                out << "prefetch_latency_" << CacheRequestType(i) << ": "
301                    << m_SWPrefetchLatencyHistograms[i] << endl;
302            }
303        }
304        for (int i = 0; i < m_SWPrefetchMachLatencyHistograms.size(); i++) {
305            if (m_SWPrefetchMachLatencyHistograms[i].size() > 0) {
306                out << "prefetch_latency_" << GenericMachineType(i) << ": "
307                    << m_SWPrefetchMachLatencyHistograms[i] << endl;
308            }
309        }
310        out << "prefetch_latency_L2Miss:"
311            << m_SWPrefetchL2MissLatencyHistogram << endl;
312
313        if (m_all_sharing_histogram.size() > 0) {
314            out << "all_sharing: " << m_all_sharing_histogram << endl;
315            out << "read_sharing: " << m_read_sharing_histogram << endl;
316            out << "write_sharing: " << m_write_sharing_histogram << endl;
317
318            out << "all_sharing_percent: ";
319            m_all_sharing_histogram.printPercent(out);
320            out << endl;
321
322            out << "read_sharing_percent: ";
323            m_read_sharing_histogram.printPercent(out);
324            out << endl;
325
326            out << "write_sharing_percent: ";
327            m_write_sharing_histogram.printPercent(out);
328            out << endl;
329
330            int64 total_miss = m_cache_to_cache +  m_memory_to_cache;
331            out << "all_misses: " << total_miss << endl;
332            out << "cache_to_cache_misses: " << m_cache_to_cache << endl;
333            out << "memory_to_cache_misses: " << m_memory_to_cache << endl;
334            out << "cache_to_cache_percent: "
335                << 100.0 * (double(m_cache_to_cache) / double(total_miss))
336                << endl;
337            out << "memory_to_cache_percent: "
338                << 100.0 * (double(m_memory_to_cache) / double(total_miss))
339                << endl;
340            out << endl;
341        }
342
343        if (m_outstanding_requests.size() > 0) {
344            out << "outstanding_requests: ";
345            m_outstanding_requests.printPercent(out);
346            out << endl;
347            out << endl;
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            while (requestProfileKeys[i] != "") {
364                out << setw(10) << string_split(requestProfileKeys[i], ':');
365            }
366            out << setw(11) << temp_int;
367            out << setw(14) << percent << endl;
368        }
369        out << endl;
370
371        out << "filter_action: " << m_filter_action_histogram << endl;
372
373        if (!m_all_instructions) {
374            m_address_profiler_ptr->printStats(out);
375        }
376
377        if (m_all_instructions) {
378            m_inst_profiler_ptr->printStats(out);
379        }
380
381        out << endl;
382        out << "Message Delayed Cycles" << endl;
383        out << "----------------------" << endl;
384        out << "Total_delay_cycles: " <<   m_delayedCyclesHistogram << endl;
385        out << "Total_nonPF_delay_cycles: "
386            << m_delayedCyclesNonPFHistogram << endl;
387        for (int i = 0; i < m_delayedCyclesVCHistograms.size(); i++) {
388            out << "  virtual_network_" << i << "_delay_cycles: "
389                << m_delayedCyclesVCHistograms[i] << endl;
390        }
391
392        printResourceUsage(out);
393    }
394}
395
396void
397Profiler::printResourceUsage(ostream& out) const
398{
399    out << endl;
400    out << "Resource Usage" << endl;
401    out << "--------------" << endl;
402
403    integer_t pagesize = getpagesize(); // page size in bytes
404    out << "page_size: " << pagesize << endl;
405
406    rusage usage;
407    getrusage (RUSAGE_SELF, &usage);
408
409    out << "user_time: " << usage.ru_utime.tv_sec << endl;
410    out << "system_time: " << usage.ru_stime.tv_sec << endl;
411    out << "page_reclaims: " << usage.ru_minflt << endl;
412    out << "page_faults: " << usage.ru_majflt << endl;
413    out << "swaps: " << usage.ru_nswap << endl;
414    out << "block_inputs: " << usage.ru_inblock << endl;
415    out << "block_outputs: " << usage.ru_oublock << endl;
416}
417
418void
419Profiler::clearStats()
420{
421    m_ruby_start = g_eventQueue_ptr->getTime();
422
423    m_cycles_executed_at_start.setSize(m_num_of_sequencers);
424    for (int i = 0; i < m_num_of_sequencers; i++) {
425        if (g_system_ptr == NULL) {
426            m_cycles_executed_at_start[i] = 0;
427        } else {
428            m_cycles_executed_at_start[i] = g_system_ptr->getCycleCount(i);
429        }
430    }
431
432    m_busyControllerCount.setSize(MachineType_NUM); // all machines
433    for (int i = 0; i < MachineType_NUM; i++) {
434        int size = MachineType_base_count((MachineType)i);
435        m_busyControllerCount[i].setSize(size);
436        for (int j = 0; j < size; j++) {
437            m_busyControllerCount[i][j] = 0;
438        }
439    }
440    m_busyBankCount = 0;
441
442    m_delayedCyclesHistogram.clear();
443    m_delayedCyclesNonPFHistogram.clear();
444    int size = RubySystem::getNetwork()->getNumberOfVirtualNetworks();
445    m_delayedCyclesVCHistograms.setSize(size);
446    for (int i = 0; i < size; i++) {
447        m_delayedCyclesVCHistograms[i].clear();
448    }
449
450    m_missLatencyHistograms.setSize(RubyRequestType_NUM);
451    for (int i = 0; i < m_missLatencyHistograms.size(); i++) {
452        m_missLatencyHistograms[i].clear(200);
453    }
454    m_machLatencyHistograms.setSize(GenericMachineType_NUM+1);
455    for (int i = 0; i < m_machLatencyHistograms.size(); i++) {
456        m_machLatencyHistograms[i].clear(200);
457    }
458    m_allMissLatencyHistogram.clear(200);
459
460    m_SWPrefetchLatencyHistograms.setSize(CacheRequestType_NUM);
461    for (int i = 0; i < m_SWPrefetchLatencyHistograms.size(); i++) {
462        m_SWPrefetchLatencyHistograms[i].clear(200);
463    }
464    m_SWPrefetchMachLatencyHistograms.setSize(GenericMachineType_NUM+1);
465    for (int i = 0; i < m_SWPrefetchMachLatencyHistograms.size(); i++) {
466        m_SWPrefetchMachLatencyHistograms[i].clear(200);
467    }
468    m_allSWPrefetchLatencyHistogram.clear(200);
469
470    m_sequencer_requests.clear();
471    m_read_sharing_histogram.clear();
472    m_write_sharing_histogram.clear();
473    m_all_sharing_histogram.clear();
474    m_cache_to_cache = 0;
475    m_memory_to_cache = 0;
476
477    // clear HashMaps
478    m_requestProfileMap_ptr->clear();
479
480    // count requests profiled
481    m_requests = 0;
482
483    m_outstanding_requests.clear();
484    m_outstanding_persistent_requests.clear();
485
486    // Flush the prefetches through the system - used so that there
487    // are no outstanding requests after stats are cleared
488    //g_eventQueue_ptr->triggerAllEvents();
489
490    // update the start time
491    m_ruby_start = g_eventQueue_ptr->getTime();
492}
493
494void
495Profiler::addAddressTraceSample(const CacheMsg& msg, NodeID id)
496{
497    if (msg.getType() != CacheRequestType_IFETCH) {
498        // Note: The following line should be commented out if you
499        // want to use the special profiling that is part of the GS320
500        // protocol
501
502        // NOTE: Unless PROFILE_HOT_LINES is enabled, nothing will be
503        // profiled by the AddressProfiler
504        m_address_profiler_ptr->
505            addTraceSample(msg.getLineAddress(), msg.getProgramCounter(),
506                           msg.getType(), msg.getAccessMode(), id, false);
507    }
508}
509
510void
511Profiler::profileSharing(const Address& addr, AccessType type,
512                         NodeID requestor, const Set& sharers,
513                         const Set& owner)
514{
515    Set set_contacted(owner);
516    if (type == AccessType_Write) {
517        set_contacted.addSet(sharers);
518    }
519    set_contacted.remove(requestor);
520    int number_contacted = set_contacted.count();
521
522    if (type == AccessType_Write) {
523        m_write_sharing_histogram.add(number_contacted);
524    } else {
525        m_read_sharing_histogram.add(number_contacted);
526    }
527    m_all_sharing_histogram.add(number_contacted);
528
529    if (number_contacted == 0) {
530        m_memory_to_cache++;
531    } else {
532        m_cache_to_cache++;
533    }
534}
535
536void
537Profiler::profileMsgDelay(int virtualNetwork, int delayCycles)
538{
539    assert(virtualNetwork < m_delayedCyclesVCHistograms.size());
540    m_delayedCyclesHistogram.add(delayCycles);
541    m_delayedCyclesVCHistograms[virtualNetwork].add(delayCycles);
542    if (virtualNetwork != 0) {
543        m_delayedCyclesNonPFHistogram.add(delayCycles);
544    }
545}
546
547// profiles original cache requests including PUTs
548void
549Profiler::profileRequest(const string& requestStr)
550{
551    m_requests++;
552
553    if (m_requestProfileMap_ptr->exist(requestStr)) {
554        (m_requestProfileMap_ptr->lookup(requestStr))++;
555    } else {
556        m_requestProfileMap_ptr->add(requestStr, 1);
557    }
558}
559
560void
561Profiler::controllerBusy(MachineID machID)
562{
563    m_busyControllerCount[(int)machID.type][(int)machID.num]++;
564}
565
566void
567Profiler::profilePFWait(Time waitTime)
568{
569    m_prefetchWaitHistogram.add(waitTime);
570}
571
572void
573Profiler::bankBusy()
574{
575    m_busyBankCount++;
576}
577
578// non-zero cycle demand request
579void
580Profiler::missLatency(Time t, RubyRequestType type)
581{
582    m_allMissLatencyHistogram.add(t);
583    m_missLatencyHistograms[type].add(t);
584}
585
586// non-zero cycle prefetch request
587void
588Profiler::swPrefetchLatency(Time t, CacheRequestType type,
589                            GenericMachineType respondingMach)
590{
591    m_allSWPrefetchLatencyHistogram.add(t);
592    m_SWPrefetchLatencyHistograms[type].add(t);
593    m_SWPrefetchMachLatencyHistograms[respondingMach].add(t);
594    if (respondingMach == GenericMachineType_Directory ||
595        respondingMach == GenericMachineType_NUM) {
596        m_SWPrefetchL2MissLatencyHistogram.add(t);
597    }
598}
599
600void
601Profiler::profileTransition(const string& component, NodeID version,
602    Address addr, const string& state, const string& event,
603    const string& next_state, const string& note)
604{
605    const int EVENT_SPACES = 20;
606    const int ID_SPACES = 3;
607    const int TIME_SPACES = 7;
608    const int COMP_SPACES = 10;
609    const int STATE_SPACES = 6;
610
611    if (g_debug_ptr->getDebugTime() <= 0 ||
612        g_eventQueue_ptr->getTime() < g_debug_ptr->getDebugTime())
613        return;
614
615    ostream &out = *debug_cout_ptr;
616    out.flags(ios::right);
617    out << setw(TIME_SPACES) << g_eventQueue_ptr->getTime() << " ";
618    out << setw(ID_SPACES) << version << " ";
619    out << setw(COMP_SPACES) << component;
620    out << setw(EVENT_SPACES) << event << " ";
621
622    out.flags(ios::right);
623    out << setw(STATE_SPACES) << state;
624    out << ">";
625    out.flags(ios::left);
626    out << setw(STATE_SPACES) << next_state;
627
628    out << " " << addr << " " << note;
629
630    out << endl;
631}
632
633// Helper function
634static double
635process_memory_total()
636{
637    // 4kB page size, 1024*1024 bytes per MB,
638    const double MULTIPLIER = 4096.0 / (1024.0 * 1024.0);
639    ifstream proc_file;
640    proc_file.open("/proc/self/statm");
641    int total_size_in_pages = 0;
642    int res_size_in_pages = 0;
643    proc_file >> total_size_in_pages;
644    proc_file >> res_size_in_pages;
645    return double(total_size_in_pages) * MULTIPLIER; // size in megabytes
646}
647
648static double
649process_memory_resident()
650{
651    // 4kB page size, 1024*1024 bytes per MB,
652    const double MULTIPLIER = 4096.0 / (1024.0 * 1024.0);
653    ifstream proc_file;
654    proc_file.open("/proc/self/statm");
655    int total_size_in_pages = 0;
656    int res_size_in_pages = 0;
657    proc_file >> total_size_in_pages;
658    proc_file >> res_size_in_pages;
659    return double(res_size_in_pages) * MULTIPLIER; // size in megabytes
660}
661
662void
663Profiler::rubyWatch(int id)
664{
665    uint64 tr = 0;
666    Address watch_address = Address(tr);
667    const int ID_SPACES = 3;
668    const int TIME_SPACES = 7;
669
670    ostream &out = *debug_cout_ptr;
671
672    out.flags(ios::right);
673    out << setw(TIME_SPACES) << g_eventQueue_ptr->getTime() << " ";
674    out << setw(ID_SPACES) << id << " "
675        << "RUBY WATCH " << watch_address << endl;
676
677    if (!m_watch_address_list_ptr->exist(watch_address)) {
678        m_watch_address_list_ptr->add(watch_address, 1);
679    }
680}
681
682bool
683Profiler::watchAddress(Address addr)
684{
685    if (m_watch_address_list_ptr->exist(addr))
686        return true;
687    else
688        return false;
689}
690
691Profiler *
692RubyProfilerParams::create()
693{
694    return new Profiler(this);
695}
696