CacheRecorder.hh revision 6145
12381SN/A
210719SMarco.Balboni@ARM.com/*
38711SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
48711SN/A * All rights reserved.
58711SN/A *
68711SN/A * Redistribution and use in source and binary forms, with or without
78711SN/A * modification, are permitted provided that the following conditions are
88711SN/A * met: redistributions of source code must retain the above copyright
98711SN/A * notice, this list of conditions and the following disclaimer;
108711SN/A * redistributions in binary form must reproduce the above copyright
118711SN/A * notice, this list of conditions and the following disclaimer in the
128711SN/A * documentation and/or other materials provided with the distribution;
138711SN/A * neither the name of the copyright holders nor the names of its
142381SN/A * contributors may be used to endorse or promote products derived from
152381SN/A * this software without specific prior written permission.
162381SN/A *
172381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282381SN/A */
292381SN/A
302381SN/A/*
312381SN/A * $Id$
322381SN/A *
332381SN/A * Description: Recording cache requests made to a ruby cache at certain
342381SN/A *              ruby time. Also dump the requests to a gziped file.
352381SN/A *
362381SN/A */
372381SN/A
382381SN/A#ifndef CACHERECORDER_H
392665SN/A#define CACHERECORDER_H
402665SN/A
412772SN/A#include "Global.hh"
428715SN/A#include "NodeID.hh"
438922SN/A#include "CacheRequestType.hh"
442381SN/A
452381SN/Atemplate <class TYPE> class PrioHeap;
462381SN/Aclass Address;
472982SN/Aclass TraceRecord;
4810405Sandreas.hansson@arm.com
492381SN/Aclass CacheRecorder {
502381SN/Apublic:
5110405Sandreas.hansson@arm.com  // Constructors
5210405Sandreas.hansson@arm.com  CacheRecorder();
532381SN/A
5410402SN/A  // Destructor
5510405Sandreas.hansson@arm.com  ~CacheRecorder();
5610405Sandreas.hansson@arm.com
572381SN/A  // Public Methods
589036SN/A  void addRecord(NodeID id, const Address& data_addr, const Address& pc_addr, CacheRequestType type, Time time);
5910405Sandreas.hansson@arm.com  int dumpRecords(string filename);
6010405Sandreas.hansson@arm.com
6110405Sandreas.hansson@arm.com  void print(ostream& out) const;
6210405Sandreas.hansson@arm.comprivate:
639036SN/A  // Private Methods
6410405Sandreas.hansson@arm.com
6510405Sandreas.hansson@arm.com  // Private copy constructor and assignment operator
6610405Sandreas.hansson@arm.com  CacheRecorder(const CacheRecorder& obj);
6710405Sandreas.hansson@arm.com  CacheRecorder& operator=(const CacheRecorder& obj);
689036SN/A
6910405Sandreas.hansson@arm.com  // Data Members (m_ prefix)
702381SN/A  PrioHeap<TraceRecord>* m_records_ptr;
719031SN/A};
729036SN/A
739036SN/A// Output operator declaration
748922SN/Aostream& operator<<(ostream& out, const CacheRecorder& obj);
7510405Sandreas.hansson@arm.com
7610405Sandreas.hansson@arm.com// ******************* Definitions *******************
779092SN/A
789715SN/A// Output operator definition
799715SN/Aextern inline
8010713Sandreas.hansson@arm.comostream& operator<<(ostream& out, const CacheRecorder& obj)
819092SN/A{
829092SN/A  obj.print(out);
8310405Sandreas.hansson@arm.com  out << flush;
8410405Sandreas.hansson@arm.com  return out;
8510405Sandreas.hansson@arm.com}
868922SN/A
8710888Sandreas.hansson@arm.com#endif //CACHERECORDER_H
882381SN/A