exetrace.hh revision 7680
12SN/A/* 21762SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan 32SN/A * All rights reserved. 42SN/A * 52SN/A * Redistribution and use in source and binary forms, with or without 62SN/A * modification, are permitted provided that the following conditions are 72SN/A * met: redistributions of source code must retain the above copyright 82SN/A * notice, this list of conditions and the following disclaimer; 92SN/A * redistributions in binary form must reproduce the above copyright 102SN/A * notice, this list of conditions and the following disclaimer in the 112SN/A * documentation and/or other materials provided with the distribution; 122SN/A * neither the name of the copyright holders nor the names of its 132SN/A * contributors may be used to endorse or promote products derived from 142SN/A * this software without specific prior written permission. 152SN/A * 162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt 292665Ssaidi@eecs.umich.edu * Nathan Binkert 302SN/A */ 312SN/A 326216Snate@binkert.org#ifndef __CPU_EXETRACE_HH__ 336216Snate@binkert.org#define __CPU_EXETRACE_HH__ 342SN/A 354046Sbinkertn@umich.edu#include "base/trace.hh" 366216Snate@binkert.org#include "base/types.hh" 374046Sbinkertn@umich.edu#include "cpu/static_inst.hh" 387680Sgblack@eecs.umich.edu#include "cpu/thread_context.hh" 396216Snate@binkert.org#include "params/ExeTracer.hh" 404776Sgblack@eecs.umich.edu#include "sim/insttracer.hh" 412SN/A 423064Sgblack@eecs.umich.educlass ThreadContext; 432SN/A 442SN/Anamespace Trace { 452SN/A 464776Sgblack@eecs.umich.educlass ExeTracerRecord : public InstRecord 472SN/A{ 482SN/A public: 494776Sgblack@eecs.umich.edu ExeTracerRecord(Tick _when, ThreadContext *_thread, 505784Sgblack@eecs.umich.edu const StaticInstPtr _staticInst, Addr _pc, bool spec, 515784Sgblack@eecs.umich.edu const StaticInstPtr _macroStaticInst = NULL, MicroPC _upc = 0) 525784Sgblack@eecs.umich.edu : InstRecord(_when, _thread, _staticInst, _pc, spec, 535784Sgblack@eecs.umich.edu _macroStaticInst, _upc) 542SN/A { 552SN/A } 562SN/A 575784Sgblack@eecs.umich.edu void traceInst(StaticInstPtr inst, bool ran); 585784Sgblack@eecs.umich.edu 594046Sbinkertn@umich.edu void dump(); 605866Sksewell@umich.edu virtual void dumpTicks(std::ostream &outs); 612SN/A}; 622SN/A 634776Sgblack@eecs.umich.educlass ExeTracer : public InstTracer 644776Sgblack@eecs.umich.edu{ 654776Sgblack@eecs.umich.edu public: 665034Smilesck@eecs.umich.edu typedef ExeTracerParams Params; 675034Smilesck@eecs.umich.edu ExeTracer(const Params *params) : InstTracer(params) 684776Sgblack@eecs.umich.edu {} 692SN/A 704776Sgblack@eecs.umich.edu InstRecord * 714776Sgblack@eecs.umich.edu getInstRecord(Tick when, ThreadContext *tc, 725784Sgblack@eecs.umich.edu const StaticInstPtr staticInst, Addr pc, 735784Sgblack@eecs.umich.edu const StaticInstPtr macroStaticInst = NULL, MicroPC upc = 0) 744776Sgblack@eecs.umich.edu { 754776Sgblack@eecs.umich.edu if (!IsOn(ExecEnable)) 764776Sgblack@eecs.umich.edu return NULL; 772SN/A 784776Sgblack@eecs.umich.edu if (!Trace::enabled) 794776Sgblack@eecs.umich.edu return NULL; 802SN/A 814776Sgblack@eecs.umich.edu if (!IsOn(ExecSpeculative) && tc->misspeculating()) 824776Sgblack@eecs.umich.edu return NULL; 834074Sbinkertn@umich.edu 844776Sgblack@eecs.umich.edu return new ExeTracerRecord(when, tc, 855784Sgblack@eecs.umich.edu staticInst, pc, tc->misspeculating(), macroStaticInst, upc); 864776Sgblack@eecs.umich.edu } 874776Sgblack@eecs.umich.edu}; 882SN/A 894054Sbinkertn@umich.edu/* namespace Trace */ } 902SN/A 916216Snate@binkert.org#endif // __CPU_EXETRACE_HH__ 92