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 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
|
// BenchmarkDialog.cpp
#include "StdAfx.h"
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers)
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#undef _WIN32
#include "Windows/Control/DialogImpl.h"
#include "BenchmarkDialogRes.h"
#if 0
IDD_BENCH DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
CAPTION "Benchmark"
MY_FONT
BEGIN
PUSHBUTTON "&Restart", IDB_RESTART, bx1, m, bxs, bys
PUSHBUTTON "&Stop", IDB_STOP, bx1, m + bys + 6, bxs, bys
PUSHBUTTON "&Help", IDHELP, bx2, by, bxs, bys
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
LTEXT "&Dictionary size:", IDT_BENCH_DICTIONARY, m, m + 1, g0xs, 8
COMBOBOX IDC_BENCH_DICTIONARY, g1x, m, g1xs, 140, MY_COMBO
LTEXT "Memory usage:", IDT_BENCH_MEMORY, gc2x, m + 1, gc2xs, 8
LTEXT "", IDT_BENCH_MEMORY_VAL, gc2x + gc2xs, m + 1, 40, 8
LTEXT "&Number of CPU threads:", IDT_BENCH_NUM_THREADS, m, 28, g0xs, 8
COMBOBOX IDC_BENCH_NUM_THREADS, g1x, 27, g1xs, 140, MY_COMBO
LTEXT "", IDT_BENCH_HARDWARE_THREADS, gc2x, 28, 40, 8
RTEXT "CPU Usage", IDT_BENCH_USAGE_LABEL, xUsage, 54, sUsage, 8
RTEXT "Speed", IDT_BENCH_SPEED, xSpeed, 54, sSpeed, 8
RTEXT "Rating / Usage", IDT_BENCH_RPU_LABEL, xRpu, 54, sRpu, 8
RTEXT "Rating", IDT_BENCH_RATING_LABEL, xRating, 54, sRating, 8
GROUPBOX "Compressing", IDG_BENCH_COMPRESSING, m, 64, xc, GROUP_Y_SIZE
LTEXT "Current", IDT_BENCH_CURRENT, g4x, 76, sLabel, 8
RTEXT "", IDT_BENCH_COMPRESS_USAGE1, xUsage, 76, sUsage, 8
RTEXT "", IDT_BENCH_COMPRESS_SPEED1, xSpeed, 76, sSpeed, 8
RTEXT "", IDT_BENCH_COMPRESS_RPU1, xRpu, 76, sRpu, 8
RTEXT "", IDT_BENCH_COMPRESS_RATING1, xRating, 76, sRating, 8
LTEXT "Resulting", IDT_BENCH_RESULTING, g4x, 89, sLabel, 8
RTEXT "", IDT_BENCH_COMPRESS_USAGE2, xUsage, 89, sUsage, 8
RTEXT "", IDT_BENCH_COMPRESS_SPEED2, xSpeed, 89, sSpeed, 8
RTEXT "", IDT_BENCH_COMPRESS_RPU2, xRpu, 89, sRpu, 8
RTEXT "", IDT_BENCH_COMPRESS_RATING2, xRating, 89, sRating, 8
GROUPBOX "Decompressing", IDG_BENCH_DECOMPRESSING, m, 111, xc, GROUP_Y_SIZE
LTEXT "Current", IDT_BENCH_CURRENT2, g4x, 123, sLabel, 8
RTEXT "", IDT_BENCH_DECOMPR_USAGE1, xUsage, 123, sUsage, 8
RTEXT "", IDT_BENCH_DECOMPR_SPEED1, xSpeed, 123, sSpeed, 8
RTEXT "", IDT_BENCH_DECOMPR_RPU1, xRpu, 123, sRpu, 8
RTEXT "", IDT_BENCH_DECOMPR_RATING1, xRating, 123, sRating, 8
LTEXT "Resulting", IDT_BENCH_RESULTING2, g4x, 136, sLabel, 8
RTEXT "", IDT_BENCH_DECOMPR_USAGE2, xUsage, 136, sUsage, 8
RTEXT "", IDT_BENCH_DECOMPR_SPEED2, xSpeed, 136, sSpeed, 8
RTEXT "", IDT_BENCH_DECOMPR_RPU2, xRpu, 136, sRpu, 8
RTEXT "", IDT_BENCH_DECOMPR_RATING2, xRating, 136, sRating, 8
GROUPBOX "Total Rating", IDG_BENCH_TOTAL_RATING, xTotalRating, 163, sTotalRating, GROUP_Y2_SIZE
RTEXT "", IDT_BENCH_TOTAL_USAGE_VAL, xUsage, 176, sUsage, 8
RTEXT "", IDT_BENCH_TOTAL_RPU_VAL, xRpu, 176, sRpu, 8
RTEXT "", IDT_BENCH_TOTAL_RATING_VAL, xRating, 176, sRating, 8
RTEXT "", IDT_BENCH_CPU, m, 202, xc, 8
RTEXT "", IDT_BENCH_VER, m, 216, xc, 8
LTEXT "Elapsed time:", IDT_BENCH_ELAPSED, m, 163, g2xs, 8
LTEXT "Size:", IDT_BENCH_SIZE, m, 176, g2xs, 8
LTEXT "Passes:", IDT_BENCH_PASSES, m, 189, g2xs, 8
RTEXT "", IDT_BENCH_ELAPSED_VAL, g3x, 163, g3xs, 8
RTEXT "", IDT_BENCH_SIZE_VAL, g3x, 176, g3xs, 8
RTEXT "", IDT_BENCH_PASSES_VAL, g3x, 189, g3xs, 8
END
#endif // #if 0
class CBenchmarkDialogImpl : public NWindows::NControl::CModalDialogImpl
{
public:
CBenchmarkDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent , int id) : CModalDialogImpl(dialog,parent, id, wxT("Benchmark"))
{
wxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
wxSizer *sizerLine1 = new wxBoxSizer(wxHORIZONTAL);
wxSizer *sizeLine1Btn = new wxBoxSizer(wxVERTICAL);
sizeLine1Btn->Add(new wxButton(this, IDB_RESTART, _T("&Restart")) , 0, wxALL|wxEXPAND, 5 );
sizeLine1Btn->Add(new wxButton(this, IDB_STOP, _T("&Stop")) , 0, wxALL|wxEXPAND, 5 );
wxSizer *sizeLine1Combo = new wxBoxSizer(wxVERTICAL);
wxComboBox * chcDicoSize = new wxComboBox(this, IDC_BENCH_DICTIONARY,
wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
wxComboBox * chcThread = new wxComboBox(this, IDC_BENCH_NUM_THREADS,
wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
sizeLine1Combo->Add(chcDicoSize , 0, wxALL, 5 );
sizeLine1Combo->Add(chcThread , 0, wxALL, 5 );
wxSizer *sizeLine1ComboLabel = new wxBoxSizer(wxVERTICAL);
sizeLine1ComboLabel->Add(new wxStaticText(this, IDT_BENCH_DICTIONARY, _T("&Dictionary size:")) , 1, wxALL|wxEXPAND, 5 );
sizeLine1ComboLabel->Add(new wxStaticText(this, IDT_BENCH_MEMORY, _T("&Number of CPU threads:")) , 1, wxALL|wxEXPAND, 5 );
wxSizer *sizeLine1Col3 = new wxBoxSizer(wxVERTICAL);
sizeLine1Col3->Add(new wxStaticText(this, IDT_BENCH_MEMORY, _T("Memory usage:")) , 1, wxALL|wxEXPAND, 5 );
// FIXME sizeLine1Col3->Add(new wxStaticText(this, IDC_BENCHMARK_HARDWARE_THREADS, _T("1")) , 1, wxALL|wxEXPAND, 5 );
wxSizer *sizeLine1Col4 = new wxBoxSizer(wxVERTICAL);
sizeLine1Col4->Add(new wxStaticText(this, IDT_BENCH_MEMORY_VAL, _T("0 MB")) , 0, wxALL|wxEXPAND, 5 );
sizerLine1->Add(sizeLine1ComboLabel,0, wxALL|wxEXPAND, 5);
sizerLine1->Add(sizeLine1Combo,0, wxALL|wxEXPAND, 5);
sizerLine1->Add(sizeLine1Col3,0, wxALL|wxEXPAND, 5);
sizerLine1->Add(sizeLine1Col4,0, wxALL|wxEXPAND, 5);
sizerLine1->Add(sizeLine1Btn,0, wxALL|wxEXPAND, 5);
// LABEL (copy the structure of the compressing or decompressing group
wxStaticBoxSizer * sizerLine2 = new wxStaticBoxSizer(new wxStaticBox(this,wxID_ANY,_T("")),wxVERTICAL);
wxSizer *sizerLabel = new wxBoxSizer(wxHORIZONTAL);
sizerLabel->Add(new wxStaticText(this, wxID_ANY, _T(" ")) , 1, wxALL|wxEXPAND, 5 );
sizerLabel->Add(new wxStaticText(this, IDT_BENCH_SPEED, _T("Speed")) , 1, wxALL|wxEXPAND, 5 );
sizerLabel->Add(new wxStaticText(this, IDT_BENCH_USAGE_LABEL, _T("CPU Usage")) , 1, wxALL|wxEXPAND, 5 );
sizerLabel->Add(new wxStaticText(this, IDT_BENCH_RPU_LABEL, _T("Rating / Usage")), 1, wxALL|wxEXPAND, 5 );
sizerLabel->Add(new wxStaticText(this, IDT_BENCH_RATING_LABEL, _T("Rating")) , 1, wxALL|wxEXPAND, 5 );
sizerLine2->Add(sizerLabel, 0, wxALL|wxEXPAND, 5);
// GROUP COMPRESSING
wxStaticBoxSizer * grpCompress = new wxStaticBoxSizer(new wxStaticBox(this,IDG_BENCH_COMPRESSING,_T("Compressing")),wxVERTICAL);
wxSizer *grpCompress1 = new wxBoxSizer(wxHORIZONTAL);
grpCompress1->Add(new wxStaticText(this, IDT_BENCH_CURRENT, _T("Current")) , 1, wxALL|wxEXPAND, 5 );
grpCompress1->Add(new wxStaticText(this, IDT_BENCH_COMPRESS_SPEED1, _T("100 KB/s")) , 1, wxALL|wxEXPAND, 5 );
grpCompress1->Add(new wxStaticText(this, IDT_BENCH_COMPRESS_USAGE1, _T("100%")) , 1, wxALL|wxEXPAND, 5 );
grpCompress1->Add(new wxStaticText(this, IDT_BENCH_COMPRESS_RPU1, _T("0")), 1, wxALL|wxEXPAND, 5 );
grpCompress1->Add(new wxStaticText(this, IDT_BENCH_COMPRESS_RATING1, _T("0")) , 1, wxALL|wxEXPAND, 5 );
wxSizer *grpCompress2 = new wxBoxSizer(wxHORIZONTAL);
grpCompress2->Add(new wxStaticText(this, IDT_BENCH_RESULTING, _T("Resulting")) , 1, wxALL|wxEXPAND, 5 );
grpCompress2->Add(new wxStaticText(this, IDT_BENCH_COMPRESS_SPEED2, _T("100 KB/s")) , 1, wxALL|wxEXPAND, 5 );
grpCompress2->Add(new wxStaticText(this, IDT_BENCH_COMPRESS_USAGE2, _T("100%")) , 1, wxALL|wxEXPAND, 5 );
grpCompress2->Add(new wxStaticText(this, IDT_BENCH_COMPRESS_RPU2, _T("0")) , 1, wxALL|wxEXPAND, 5);
grpCompress2->Add(new wxStaticText(this, IDT_BENCH_COMPRESS_RATING2, _T("0")) , 1, wxALL|wxEXPAND, 5 );
grpCompress->Add(grpCompress1, 0, wxALL|wxEXPAND, 5);
grpCompress->Add(grpCompress2, 0, wxALL|wxEXPAND, 5);
// GROUP DECOMPRESSING
wxStaticBoxSizer * grpDecompress = new wxStaticBoxSizer(new wxStaticBox(this,IDG_BENCH_DECOMPRESSING,_T("Decompressing")),wxVERTICAL);
wxSizer *grpDecompress1 = new wxBoxSizer(wxHORIZONTAL);
grpDecompress1->Add(new wxStaticText(this, IDT_BENCH_CURRENT2, _T("Current")) , 1, wxALL|wxEXPAND, 5 );
grpDecompress1->Add(new wxStaticText(this, IDT_BENCH_DECOMPR_SPEED1, _T("100 KB/s")) , 1, wxALL|wxEXPAND, 5 );
grpDecompress1->Add(new wxStaticText(this, IDT_BENCH_DECOMPR_USAGE1, _T("100%")) , 1, wxALL|wxEXPAND, 5 );
grpDecompress1->Add(new wxStaticText(this, IDT_BENCH_DECOMPR_RPU1, _T("0")), 1, wxALL|wxEXPAND, 5 );
grpDecompress1->Add(new wxStaticText(this, IDT_BENCH_DECOMPR_RATING1, _T("0")) , 1, wxALL|wxEXPAND, 5 );
wxSizer *grpDecompress2 = new wxBoxSizer(wxHORIZONTAL);
grpDecompress2->Add(new wxStaticText(this, IDT_BENCH_RESULTING2, _T("Resulting")) , 1, wxALL|wxEXPAND, 5 );
grpDecompress2->Add(new wxStaticText(this, IDT_BENCH_DECOMPR_SPEED2, _T("100 KB/s")) , 1, wxALL|wxEXPAND, 5 );
grpDecompress2->Add(new wxStaticText(this, IDT_BENCH_DECOMPR_USAGE2, _T("100%")) , 1, wxALL|wxEXPAND, 5 );
grpDecompress2->Add(new wxStaticText(this, IDT_BENCH_DECOMPR_RPU2, _T("0")) , 1, wxALL|wxEXPAND, 5);
grpDecompress2->Add(new wxStaticText(this, IDT_BENCH_DECOMPR_RATING2, _T("0")) , 1, wxALL|wxEXPAND, 5 );
grpDecompress->Add(grpDecompress1, 0, wxALL|wxEXPAND, 5);
grpDecompress->Add(grpDecompress2, 0, wxALL|wxEXPAND, 5);
// GROUPE TOTAL RATING
wxStaticBoxSizer * grpTotalRating = new wxStaticBoxSizer(new wxStaticBox(this,IDG_BENCH_TOTAL_RATING,_T("Total Rating")),wxHORIZONTAL);
grpTotalRating->Add(new wxStaticText(this, wxID_ANY, _T("")) , 1, wxALL|wxEXPAND, 5 );
grpTotalRating->Add(new wxStaticText(this, IDT_BENCH_TOTAL_USAGE_VAL, _T("0")) , 1, wxALL|wxEXPAND, 5 );
grpTotalRating->Add(new wxStaticText(this, IDT_BENCH_TOTAL_RPU_VAL, _T("0")) , 1, wxALL|wxEXPAND, 5 );
grpTotalRating->Add(new wxStaticText(this, IDT_BENCH_TOTAL_RATING_VAL, _T("0")) , 1, wxALL|wxEXPAND, 5 );
// GROUPE ELAPSED TIME
wxSizer * grpElapsedTime = new wxBoxSizer(wxHORIZONTAL);
wxSizer * grpElapsedTime1 = new wxBoxSizer(wxVERTICAL);
grpElapsedTime1->Add(new wxStaticText(this, IDT_BENCH_ELAPSED, _T("Elapsed time:")) , 0, wxALL|wxEXPAND, 5 );
grpElapsedTime1->Add(new wxStaticText(this, IDT_BENCH_SIZE, _T("Size:")) , 0, wxALL|wxEXPAND, 5 );
grpElapsedTime1->Add(new wxStaticText(this, IDT_BENCH_PASSES, _T("Passes:")) , 0, wxALL|wxEXPAND, 5 );
wxSizer * grpElapsedTime2 = new wxBoxSizer(wxVERTICAL);
grpElapsedTime2->Add(new wxStaticText(this, IDT_BENCH_ELAPSED_VAL, _T("00:00:00")) , 0, wxALL|wxEXPAND, 5 );
grpElapsedTime2->Add(new wxStaticText(this, IDT_BENCH_SIZE_VAL, _T("0")) , 0, wxALL|wxEXPAND, 5 );
grpElapsedTime2->Add(new wxStaticText(this, IDT_BENCH_PASSES_VAL, _T("0")) , 0, wxALL|wxEXPAND, 5 );
grpElapsedTime->Add(grpElapsedTime1,0, wxALL|wxEXPAND, 5);
grpElapsedTime->Add(grpElapsedTime2,0, wxALL|wxEXPAND, 5);
wxSizer * grp_ElapsedTime_TotalRating = new wxBoxSizer(wxHORIZONTAL);
grp_ElapsedTime_TotalRating->Add(grpElapsedTime, 0, wxALL|wxEXPAND, 5);
grp_ElapsedTime_TotalRating->Add(grpTotalRating, 1, wxALL|wxEXPAND, 5);
// TOP
topsizer->Add(sizerLine1,0, wxALL|wxEXPAND, 5);
topsizer->Add(sizerLine2,0, wxALL|wxEXPAND, 5);
topsizer->Add(grpCompress, 0, wxALL|wxEXPAND, 5);
topsizer->Add(grpDecompress, 0, wxALL|wxEXPAND, 5);
topsizer->Add(grp_ElapsedTime_TotalRating, 0, wxALL|wxEXPAND, 5);
topsizer->Add(new wxStaticText(this, IDT_BENCH_CPU, _T("")) , 0, wxALL|wxALIGN_RIGHT, 5 );
topsizer->Add(new wxStaticText(this, IDT_BENCH_VER, _T("")) , 0, wxALL|wxALIGN_RIGHT, 5 );
topsizer->Add(CreateButtonSizer(wxHELP|wxCANCEL), 0, wxALL|wxEXPAND, 5);
this->OnInit();
SetSizer(topsizer); // use the sizer for layout
topsizer->SetSizeHints(this); // set size hints to honour minimum size
}
private:
// Any class wishing to process wxWindows events must use this macro
DECLARE_EVENT_TABLE()
};
REGISTER_DIALOG(IDD_BENCH,CBenchmarkDialog,0)
// ----------------------------------------------------------------------------
// event tables and other macros for wxWidgets
// ----------------------------------------------------------------------------
// the event tables connect the wxWidgets events with the functions (event
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
BEGIN_EVENT_TABLE(CBenchmarkDialogImpl, wxDialog)
EVT_TIMER(wxID_ANY, CModalDialogImpl::OnAnyTimer)
EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
EVT_COMBOBOX(wxID_ANY, CModalDialogImpl::OnAnyChoice)
EVT_MENU(WORKER_EVENT, CModalDialogImpl::OnWorkerEvent)
END_EVENT_TABLE()
|