AccessTraceForAddress.hh (6145:15cca6ab723a) AccessTraceForAddress.hh (6154:6bb54dcb940e)
1
2/*
3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/*
31 * $Id$
32 *
33 * Description:
34 *
35 */
36
37#ifndef ACCESSTRACEFORADDRESS_H
38#define ACCESSTRACEFORADDRESS_H
39
1
2/*
3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/*
31 * $Id$
32 *
33 * Description:
34 *
35 */
36
37#ifndef ACCESSTRACEFORADDRESS_H
38#define ACCESSTRACEFORADDRESS_H
39
40#include "Global.hh"
41#include "RubyConfig.hh"
42#include "Address.hh"
43#include "CacheRequestType.hh"
44#include "AccessModeType.hh"
45#include "NodeID.hh"
46#include "Set.hh"
40#include "mem/ruby/common/Global.hh"
41#include "mem/ruby/config/RubyConfig.hh"
42#include "mem/ruby/common/Address.hh"
43#include "mem/protocol/CacheRequestType.hh"
44#include "mem/protocol/AccessModeType.hh"
45#include "mem/ruby/system/NodeID.hh"
46#include "mem/ruby/common/Set.hh"
47class Histogram;
48
49class AccessTraceForAddress {
50public:
51 // Constructors
52 AccessTraceForAddress();
53 explicit AccessTraceForAddress(const Address& addr);
54
55 // Destructor
56 ~AccessTraceForAddress();
57
58 // Public Methods
59
60 void update(CacheRequestType type, AccessModeType access_mode, NodeID cpu, bool sharing_miss);
61 int getTotal() const;
62 int getSharing() const { return m_sharing; }
63 int getTouchedBy() const { return m_touched_by.count(); }
64 const Address& getAddress() const { return m_addr; }
65 void addSample(int value);
66
67 void print(ostream& out) const;
68private:
69 // Private Methods
70
71 // Private copy constructor and assignment operator
72 // AccessTraceForAddress(const AccessTraceForAddress& obj);
73 // AccessTraceForAddress& operator=(const AccessTraceForAddress& obj);
74
75 // Data Members (m_ prefix)
76
77 Address m_addr;
78 uint64 m_loads;
79 uint64 m_stores;
80 uint64 m_atomics;
81 uint64 m_total;
82 uint64 m_user;
83 uint64 m_sharing;
84 Set m_touched_by;
85 Histogram* m_histogram_ptr;
86};
87
88bool node_less_then_eq(const AccessTraceForAddress* n1, const AccessTraceForAddress* n2);
89
90// Output operator declaration
91ostream& operator<<(ostream& out, const AccessTraceForAddress& obj);
92
93// ******************* Definitions *******************
94
95// Output operator definition
96extern inline
97ostream& operator<<(ostream& out, const AccessTraceForAddress& obj)
98{
99 obj.print(out);
100 out << flush;
101 return out;
102}
103
104#endif //ACCESSTRACEFORADDRESS_H
47class Histogram;
48
49class AccessTraceForAddress {
50public:
51 // Constructors
52 AccessTraceForAddress();
53 explicit AccessTraceForAddress(const Address& addr);
54
55 // Destructor
56 ~AccessTraceForAddress();
57
58 // Public Methods
59
60 void update(CacheRequestType type, AccessModeType access_mode, NodeID cpu, bool sharing_miss);
61 int getTotal() const;
62 int getSharing() const { return m_sharing; }
63 int getTouchedBy() const { return m_touched_by.count(); }
64 const Address& getAddress() const { return m_addr; }
65 void addSample(int value);
66
67 void print(ostream& out) const;
68private:
69 // Private Methods
70
71 // Private copy constructor and assignment operator
72 // AccessTraceForAddress(const AccessTraceForAddress& obj);
73 // AccessTraceForAddress& operator=(const AccessTraceForAddress& obj);
74
75 // Data Members (m_ prefix)
76
77 Address m_addr;
78 uint64 m_loads;
79 uint64 m_stores;
80 uint64 m_atomics;
81 uint64 m_total;
82 uint64 m_user;
83 uint64 m_sharing;
84 Set m_touched_by;
85 Histogram* m_histogram_ptr;
86};
87
88bool node_less_then_eq(const AccessTraceForAddress* n1, const AccessTraceForAddress* n2);
89
90// Output operator declaration
91ostream& operator<<(ostream& out, const AccessTraceForAddress& obj);
92
93// ******************* Definitions *******************
94
95// Output operator definition
96extern inline
97ostream& operator<<(ostream& out, const AccessTraceForAddress& obj)
98{
99 obj.print(out);
100 out << flush;
101 return out;
102}
103
104#endif //ACCESSTRACEFORADDRESS_H