-
Notifications
You must be signed in to change notification settings - Fork 1
/
CacheInfoDlg.cpp
230 lines (174 loc) · 6.68 KB
/
CacheInfoDlg.cpp
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
// CacheInfoDlg.cpp : implementation file
//
#include "stdafx.h"
#include "CPUBench2004.h"
#include "CacheInfoDlg.h"
#include "itembkdrawer.h"
#include "cpuinformations.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCacheInfoDlg dialog
CCacheInfoDlg::CCacheInfoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCacheInfoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCacheInfoDlg)
m_title = _T("");
m_L1ITLB4M_entries = _T("");
m_L1ITLB4M_ass = _T("");
m_L1DTLB4M_entries = _T("");
m_L1DTLB4M_ass = _T("");
m_L1D_Ass = _T("");
m_L1D_CacheSize = _T("");
m_L1D_LineSize = _T("");
m_L1D_LinesPerTag = _T("");
m_L1I_CacheSize = _T("");
m_L1I_LineSize = _T("");
m_L1I_Ass = _T("");
m_L1I_LinesPerTag = _T("");
m_L1I_TLB4K_Ass = _T("");
m_L1D_TLB4K_Ass = _T("");
m_L1D_TLB4K_Entries = _T("");
m_L1I_TLB4K_Entries = _T("");
m_L2_Ass = _T("");
m_L2_CacheSize = _T("");
m_L2_LineSize = _T("");
m_L2_LinesPerTag = _T("");
m_L2D_TLB4K_Ass = _T("");
m_L2D_TLB4K_Entries = _T("");
m_L2D_TLB4M_Ass = _T("");
m_L2D_TLB4M_Entries = _T("");
m_L2I_TLB4K_Ass = _T("");
m_L2I_TLB4K_Entries = _T("");
m_L2I_TLB4M_Ass = _T("");
m_L2I_TLB4M_Entries = _T("");
//}}AFX_DATA_INIT
m_fntLbl.CreateFont(-11,0,0,0,FW_BOLD,FALSE,FALSE,0,ANSI_CHARSET,OUT_TT_PRECIS,
CLIP_TT_ALWAYS,ANTIALIASED_QUALITY,DEFAULT_PITCH | FF_SWISS, "TAHOMA");
m_fntTitle.CreateFont(-17,0,0,0,FW_BOLD,FALSE,FALSE,0,ANSI_CHARSET,OUT_TT_PRECIS,
CLIP_TT_ALWAYS,ANTIALIASED_QUALITY,DEFAULT_PITCH | FF_SWISS, "ARIAL");
}
void CCacheInfoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCacheInfoDlg)
DDX_Control(pDX, IDC_CACHELATENCY, m_cacheLatency);
DDX_Control(pDX, IDOK, m_ok);
DDX_Text(pDX, IDC_MAINTITLE, m_title);
DDX_Text(pDX, IDC_L1ITLB4M_ENTRIES, m_L1ITLB4M_entries);
DDX_Text(pDX, IDC_L1ITLB4M_ASS, m_L1ITLB4M_ass);
DDX_Text(pDX, IDC_L1DTLB4M_ENTRIES, m_L1DTLB4M_entries);
DDX_Text(pDX, IDC_L1DTLB4M_ASS, m_L1DTLB4M_ass);
DDX_Text(pDX, IDC_L1D_ASSOCIATIVITY, m_L1D_Ass);
DDX_Text(pDX, IDC_L1D_CACHESIZE, m_L1D_CacheSize);
DDX_Text(pDX, IDC_L1D_LINESIZE, m_L1D_LineSize);
DDX_Text(pDX, IDC_L1D_LINESPERTAG, m_L1D_LinesPerTag);
DDX_Text(pDX, IDC_L1I_CACHESIZE, m_L1I_CacheSize);
DDX_Text(pDX, IDC_L1I_LINESIZE, m_L1I_LineSize);
DDX_Text(pDX, IDC_L1I_ASSOCIATIVITY, m_L1I_Ass);
DDX_Text(pDX, IDC_L1I_LINESPERTAG, m_L1I_LinesPerTag);
DDX_Text(pDX, IDC_L1I_TLB4K_ASSOCIATIVITY, m_L1I_TLB4K_Ass);
DDX_Text(pDX, IDC_L1D_TLB4K_ASSOCIATIVITY, m_L1D_TLB4K_Ass);
DDX_Text(pDX, IDC_L1D_TLB4K_ENTRIES, m_L1D_TLB4K_Entries);
DDX_Text(pDX, IDC_L1I_TLB4K_ENTRIES, m_L1I_TLB4K_Entries);
DDX_Text(pDX, IDC_L2_ASSOCIATIVITY, m_L2_Ass);
DDX_Text(pDX, IDC_L2_CACHESIZE, m_L2_CacheSize);
DDX_Text(pDX, IDC_L2_LINESIZE, m_L2_LineSize);
DDX_Text(pDX, IDC_L2_LINESPERTAG, m_L2_LinesPerTag);
DDX_Text(pDX, IDC_L2D_TLB4K_ASSOCIATIVITY, m_L2D_TLB4K_Ass);
DDX_Text(pDX, IDC_L2D_TLB4K_ENTRIES, m_L2D_TLB4K_Entries);
DDX_Text(pDX, IDC_L2D_TLB4M_ASSOCIATIVITY, m_L2D_TLB4M_Ass);
DDX_Text(pDX, IDC_L2D_TLB4M_ENTRIES, m_L2D_TLB4M_Entries);
DDX_Text(pDX, IDC_L2I_TLB4K_ASSOCIATIVITY, m_L2I_TLB4K_Ass);
DDX_Text(pDX, IDC_L2I_TLB4K_ENTRIES, m_L2I_TLB4K_Entries);
DDX_Text(pDX, IDC_L2I_TLB4M_ASSOCIATIVITY, m_L2I_TLB4M_Ass);
DDX_Text(pDX, IDC_L2I_TLB4M_ENTRIES, m_L2I_TLB4M_Entries);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCacheInfoDlg, CDialog)
//{{AFX_MSG_MAP(CCacheInfoDlg)
ON_WM_ERASEBKGND()
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_CACHELATENCY, OnCachelatency)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCacheInfoDlg message handlers
BOOL CCacheInfoDlg::OnEraseBkgnd(CDC* pDC)
{
CRect r;
GetClientRect(&r);
CItemBkDrawer::DrawBk(pDC,&r);
return TRUE;
}
HBRUSH CCacheInfoDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor == CTLCOLOR_STATIC){
if(*pWnd == *GetDlgItem(IDC_MAINTITLE)){
pDC->SetBkColor(0);
CRect r;
GetDlgItem(IDC_MAINTITLE)->GetClientRect(&r);
pDC->FillSolidRect(0,0,r.Width(),r.Height(),RGB(161,161,175));
pDC->SetTextColor(0x00FFFFFF);
}
pDC->SetBkMode(TRANSPARENT);
//pDC->SetTextColor(RGB(0,0x74,0xDC));
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
BOOL CCacheInfoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
GetDlgItem(IDC_LBL1)->SetFont(&m_fntLbl);
GetDlgItem(IDC_LBL2)->SetFont(&m_fntLbl);
GetDlgItem(IDC_LBL3)->SetFont(&m_fntLbl);
GetDlgItem(IDC_LBL4)->SetFont(&m_fntLbl);
GetDlgItem(IDC_LBL5)->SetFont(&m_fntLbl);
GetDlgItem(IDC_LBL6)->SetFont(&m_fntLbl);
GetDlgItem(IDC_LBL7)->SetFont(&m_fntLbl);
GetDlgItem(IDC_LBL8)->SetFont(&m_fntLbl);
CCPUInformations i;
m_title="Cache informations for "+i.GetCPUName()+" processor";
GetDlgItem(IDC_MAINTITLE)->SetFont(&m_fntTitle);
m_L1ITLB4M_entries=i.GetL1I_TLB4M_Entries();
m_L1ITLB4M_ass=i.GetL1I_TLB4M_Associativity();
m_L1DTLB4M_entries=i.GetL1D_TLB4M_Entries();
m_L1DTLB4M_ass=i.GetL1D_TLB4M_Associativity();
m_L1D_CacheSize=i.GetL1DCache();
m_L1D_LineSize=i.GetL1D_LineSize();
m_L1D_LinesPerTag=i.GetL1D_LinesPerTag();
m_L1D_Ass=i.GetL1D_Associativity();
m_L1I_CacheSize=i.GetL1ICache();
m_L1I_LineSize=i.GetL1I_LineSize();
m_L1I_LinesPerTag=i.GetL1I_LinesPerTag();
m_L1I_Ass=i.GetL1I_Associativity();
m_L1I_TLB4K_Entries=i.GetL1I_TLB4K_Entries();
m_L1I_TLB4K_Ass=i.GetL1I_TLB4K_Associativity();
m_L1D_TLB4K_Entries=i.GetL1D_TLB4K_Entries();
m_L1D_TLB4K_Ass=i.GetL1D_TLB4K_Associativity();
m_L2_CacheSize=i.GetL2Cache();
m_L2_LineSize=i.GetL2_LineSize();
m_L2_LinesPerTag=i.GetL2_LinesPerTag();
m_L2_Ass=i.GetL2_Associativity();
m_L2I_TLB4K_Entries=i.GetL2I_TLB4K_Entries();
m_L2I_TLB4K_Ass=i.GetL2I_TLB4K_Associativity();
m_L2D_TLB4K_Entries=i.GetL2D_TLB4K_Entries();
m_L2D_TLB4K_Ass=i.GetL2D_TLB4K_Associativity();
m_L2I_TLB4M_Entries=i.GetL2I_TLB4M_Entries();
m_L2I_TLB4M_Ass=i.GetL2I_TLB4M_Associativity();
m_L2D_TLB4M_Entries=i.GetL2D_TLB4M_Entries();
m_L2D_TLB4M_Ass=i.GetL2D_TLB4M_Associativity();
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCacheInfoDlg::OnCachelatency()
{
MessageBox("This functionality is available only in the PRO version of CPUBench2004.","Warning",MB_ICONWARNING);
}