forked from Skewjo/SysLat_Software
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCtrl.cpp
More file actions
86 lines (66 loc) · 2.5 KB
/
TestCtrl.cpp
File metadata and controls
86 lines (66 loc) · 2.5 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
// TestCtrl.cpp : implementation file
#include "StdAfx.h"
#include "TestCtrl.h"
// TestCtrl dialog
IMPLEMENT_DYNAMIC(TestCtrl, CDialogEx)
TestCtrl::TestCtrl(vector<std::shared_ptr<CSysLatData>>* p_previousSLD, CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_TESTCTRL_DIALOG, pParent), m_pPreviousSLD(p_previousSLD)
{
}
BOOL TestCtrl::OnInitDialog() {
CDialogEx::OnInitDialog();
m_TestListCtrl.InsertColumn(0, "ID", LVCFMT_LEFT, 30);
m_TestListCtrl.InsertColumn(1, "Target", LVCFMT_LEFT, 60);
m_TestListCtrl.InsertColumn(2, "Duration", LVCFMT_CENTER, 60);
m_TestListCtrl.InsertColumn(3, "Avg. SysLat", LVCFMT_CENTER, 80);
m_TestListCtrl.InsertColumn(4, "Cycles", LVCFMT_CENTER, 60);
m_TestListCtrl.InsertColumn(5, "Exported", LVCFMT_CENTER, 60);
m_TestListCtrl.InsertColumn(6, "Uploaded", LVCFMT_CENTER, 60);
int nItem;
for (unsigned int i = 0; i < m_pPreviousSLD->size(); i++) {
string targetApp = (*m_pPreviousSLD)[i]->m_targetApp;
auto& testDuration = (*m_pPreviousSLD)[i]->GetTestDuration();
string duration = format(" %R:%OS", testDuration);
auto& data = (*m_pPreviousSLD)[i]->GetData();
string sysLatAverage = to_string(data.m_statisticsEVR.average);
string testCount = to_string(data.m_statisticsEVR.counter);
bool exported = (*m_pPreviousSLD)[i]->m_bDataExported;
bool uploaded = (*m_pPreviousSLD)[i]->m_bDataUploaded;
nItem = m_TestListCtrl.InsertItem(i, "1");
m_TestListCtrl.SetItemText(nItem, 1, targetApp.c_str());
m_TestListCtrl.SetItemText(nItem, 2, duration.c_str());
m_TestListCtrl.SetItemText(nItem, 3, sysLatAverage.c_str());
m_TestListCtrl.SetItemText(nItem, 4, testCount.c_str());
//NEED TO TURN THESE INTO BUTTONS - AND MAKE THEM MORE ACCURATE (BY ACCOUNTING FOR FAILURE TO UPLOAD SPECIFICALLY)
if (data.m_statisticsEVR.counter == 0) {
m_TestListCtrl.SetItemText(nItem, 5, "N/A");
}
else if (exported) {
m_TestListCtrl.SetItemText(nItem, 5, "Yes");
}
else {
m_TestListCtrl.SetItemText(nItem, 5, "No");
}
if (data.m_statisticsEVR.counter == 0) {
m_TestListCtrl.SetItemText(nItem, 6, "N/A");
}
else if (uploaded) {
m_TestListCtrl.SetItemText(nItem, 6, "Yes");
}
else {
m_TestListCtrl.SetItemText(nItem, 6, "No");
}
}
return TRUE; // return TRUE unless you set the focus to a control
}
TestCtrl::~TestCtrl()
{
}
void TestCtrl::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TESTLISTCTRL, m_TestListCtrl);
}
BEGIN_MESSAGE_MAP(TestCtrl, CDialogEx)
END_MESSAGE_MAP()
// TestCtrl message handlers