hw_events.c
3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* Copyright (C) 1996-1998 by the Board of Trustees
* of Leland Stanford Junior University.
*
* This file is part of the SimOS distribution.
* See LICENSE file for terms of the license.
*
*/
/*****************************************************************
* hw_events.c
*
* Top level interface into the hardware event counters. Counters that
* don't require large state machines are kept here. The memstat and
* false sharing modules are called through here.
*
* $Author: blythe $
* $Date: 2002/05/29 01:09:09 $
****************************************************************/
#include "hw_events.h"
#include "statrecord.h"
#include "visual.h"
HWEventBucket hwEventBucket;
#define DEFINE_SR_FIELD(_field, _type) \
(hwEventBucket._field = StatRecordDefineField(# _field, _type))
extern void MipsyEarlyInit(void);
/* ***********************************************************************
* Early initialization must takes place
* 1) after param.simos has been read
* 2) before the TCL scripts are read in
* 3) before the checkpoint is restored.
* Therefore, their main role is in to initialize the statrecord counters
* that will be used in the simulation
* ***********************************************************************/
void
HWEventsEarlyInit(Tcl_Interp *interp)
{
DEFINE_SR_FIELD(dTlb, STATRECORD_INSTRUCTION|STATRECORD_DATA);
DEFINE_SR_FIELD(iTlb, STATRECORD_INSTRUCTION);
DEFINE_SR_FIELD(cycleSample, STATRECORD_INSTRUCTION);
DEFINE_SR_FIELD(instrSample, STATRECORD_INSTRUCTION);
DEFINE_SR_FIELD(readSample, STATRECORD_DATA);
DEFINE_SR_FIELD(writeSample, STATRECORD_DATA);
DEFINE_SR_FIELD(excStall, STATRECORD_INSTRUCTION);
DEFINE_SR_FIELD(scNak, STATRECORD_INSTRUCTION|STATRECORD_DATA);
DEFINE_SR_FIELD(scNakStall, STATRECORD_INSTRUCTION|STATRECORD_DATA);
DEFINE_SR_FIELD(prefetch, STATRECORD_INSTRUCTION|STATRECORD_DATA);
DEFINE_SR_FIELD(prefetchIssued, STATRECORD_INSTRUCTION|STATRECORD_DATA);
DEFINE_SR_FIELD(prefetchNoMiss, STATRECORD_INSTRUCTION|STATRECORD_DATA);
DEFINE_SR_FIELD(prefetchNoUpg, STATRECORD_INSTRUCTION|STATRECORD_DATA);
DEFINE_SR_FIELD(prefetchTransFailed, STATRECORD_INSTRUCTION|STATRECORD_DATA);
DEFINE_SR_FIELD(dStallPrefetch, STATRECORD_INSTRUCTION|STATRECORD_DATA);
DEFINE_SR_FIELD(instrCount, 0);
DEFINE_SR_FIELD(refCount, 0);
MemStatEarlyInit();
FalseSharingEarlyInit();
InstrUtilEarlyInit();
/*
* StatRecordEarlyInit has to be called after
* all modules have defined their counters
*/
StatRecordEarlyInit();
}
/* ***************************************************************
* HWEventsLateInit: called after the checkpoint has been restored
* ***************************************************************/
void HWEventsLateInit(void)
{
static int initialized = 0;
if (!initialized) {
initialized = 1;
MemStatLateInit();
StatRecordLateInit();
FalseSharingLateInit();
InstrUtilLateInit();
/* Initialize the control/statistics module */
Visual_Init();
}
}