gem5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
cpu
profile.hh
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005 The Regents of The University of Michigan
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
* Authors: Nathan Binkert
29
*/
30
31
#ifndef __CPU_PROFILE_HH__
32
#define __CPU_PROFILE_HH__
33
34
#include <map>
35
36
#include "arch/stacktrace.hh"
37
#include "
base/types.hh
"
38
#include "config/the_isa.hh"
39
#include "
cpu/static_inst.hh
"
40
41
class
ThreadContext
;
42
43
class
ProfileNode
44
{
45
private
:
46
friend
class
FunctionProfile
;
47
48
typedef
std::map<Addr, ProfileNode *>
ChildList
;
49
ChildList
children
;
50
51
public
:
52
Counter
count
;
53
54
public
:
55
ProfileNode
();
56
57
void
dump
(
const
std::string &symbol, uint64_t
id
,
58
const
SymbolTable
*
symtab
, std::ostream &
os
)
const
;
59
void
clear
();
60
};
61
62
class
Callback
;
63
class
FunctionProfile
64
{
65
private
:
66
Callback
*
reset
;
67
const
SymbolTable
*
symtab
;
68
ProfileNode
top
;
69
std::map<Addr, Counter>
pc_count
;
70
TheISA::StackTrace
trace
;
71
72
public
:
73
FunctionProfile
(
const
SymbolTable
*
symtab
);
74
~FunctionProfile
();
75
76
ProfileNode
*
consume
(
ThreadContext
*tc,
const
StaticInstPtr
&inst);
77
ProfileNode
*
consume
(
const
std::vector<Addr>
&
stack
);
78
void
clear
();
79
void
dump
(
ThreadContext
*tc, std::ostream &out)
const
;
80
void
sample
(
ProfileNode
*node,
Addr
pc
);
81
};
82
83
inline
ProfileNode
*
84
FunctionProfile::consume
(
ThreadContext
*tc,
const
StaticInstPtr
&inst)
85
{
86
if
(!
trace
.trace(tc, inst))
87
return
NULL;
88
trace
.dprintf();
89
return
consume
(
trace
.getstack());
90
}
91
92
#endif // __CPU_PROFILE_HH__
ProfileNode::count
Counter count
Definition:
profile.hh:52
ProfileNode::ChildList
std::map< Addr, ProfileNode * > ChildList
Definition:
profile.hh:48
FunctionProfile::dump
void dump(ThreadContext *tc, std::ostream &out) const
Definition:
profile.cc:124
Callback
Generic callback class.
Definition:
callback.hh:41
FunctionProfile::FunctionProfile
FunctionProfile(const SymbolTable *symtab)
Definition:
profile.cc:88
FunctionProfile::sample
void sample(ProfileNode *node, Addr pc)
Definition:
profile.cc:146
FunctionProfile::pc_count
std::map< Addr, Counter > pc_count
Definition:
profile.hh:69
ProfileNode::children
ChildList children
Definition:
profile.hh:49
FunctionProfile::symtab
const SymbolTable * symtab
Definition:
profile.hh:67
SymbolTable
Definition:
symtab.hh:42
ProfileNode::clear
void clear()
Definition:
profile.cc:80
FunctionProfile
Definition:
profile.hh:63
FunctionProfile::top
ProfileNode top
Definition:
profile.hh:68
RefCountingPtr< StaticInst >
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU...
Definition:
thread_context.hh:93
X86ISA::os
Bitfield< 17 > os
Definition:
misc.hh:804
std::vector< Addr >
ProfileNode::ProfileNode
ProfileNode()
Definition:
profile.cc:45
FunctionProfile::trace
TheISA::StackTrace trace
Definition:
profile.hh:70
FunctionProfile::clear
void clear()
Definition:
profile.cc:117
static_inst.hh
types.hh
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition:
types.hh:142
FunctionProfile::reset
Callback * reset
Definition:
profile.hh:66
Counter
int64_t Counter
Statistics counter type.
Definition:
types.hh:58
ProfileNode
Definition:
profile.hh:43
X86ISA::stack
Bitfield< 17, 16 > stack
Definition:
misc.hh:588
FunctionProfile::~FunctionProfile
~FunctionProfile()
Definition:
profile.cc:95
pc
IntReg pc
Definition:
remote_gdb.hh:91
FunctionProfile::consume
ProfileNode * consume(ThreadContext *tc, const StaticInstPtr &inst)
Definition:
profile.hh:84
ProfileNode::dump
void dump(const std::string &symbol, uint64_t id, const SymbolTable *symtab, std::ostream &os) const
Definition:
profile.cc:50
Generated on Fri Jun 9 2017 13:03:44 for gem5 by
doxygen
1.8.6