Alternate e697dbe9c5997e35395fe158628dd8c5209481da
for Visual Studio 2022 and Windows 11.
全て クラス 名前空間 ファイル 関数 変数 型定義 列挙型 列挙値 マクロ定義 ページ
PerformanceCheck.cpp
[詳解]
1
5
6#include "pch.h"
7#include "PerformanceCheck.h"
18#include "NewPerformanceCheck.h"
20#include "TCPPerformanceCheck.h"
21#include "UDPPerformanceCheck.h"
22
23int _tmain (int argc, TCHAR* argv[])
24{
25 alt::TString message;
26 alt::Console console;
27 console.Init ();
28 console.Clear ();
29
30 wchar_t* locale = _tsetlocale (LC_ALL, _T ("Japanese"));
31 console.Format (_T ("Now locale is %s\n"), locale);
32
33 int action = (int)alt::Utility::ReadIniFile (
34 CONFIG_FILE, _T ("Target"), _T ("Action"), -1);
35 if (action == -1)
36 {
37 console.Format (_T ("Actionの設定値が異常(%d)です。\n"), action);
38 return -1;
39 }
40
41 PerfCheck::PerformanceCheck* check = nullptr;
42
43 auto target1 = [&]()
44 {
45 message = _T ("ConsolePerformanceCheck\n");
46 check = new PerfCheck::ConsolePerformanceCheck (console);
47 };
48
49 auto target2 = [&]()
50 {
51 message = _T ("FilePerformanceCheck\n");
52 check = new PerfCheck::FilePerformanceCheck (console);
53 };
54
55 auto target3 = [&]()
56 {
57 message = _T ("StdFilePerformanceCheck\n");
58 check = new PerfCheck::StdFilePerformanceCheck (console);
59 };
60
61 auto target4 = [&]()
62 {
63 message = _T ("FreightPerformanceCheck\n");
64 check = new PerfCheck::FreightPerformanceCheck (console);
65 };
66
67 auto target5 = [&]()
68 {
69 message = _T ("VectorPerformanceCheck\n");
70 check = new PerfCheck::VectorPerformanceCheck (console);
71 };
72
73 auto target6 = [&]()
74 {
75 message = _T ("ArrayPerformanceCheck\n");
76 check = new PerfCheck::ArrayPerformanceCheck (console);
77 };
78
79 auto target7 = [&]()
80 {
81 message = _T ("LinkedListPerformanceCheck\n");
82 check = new PerfCheck::LinkedListPerformanceCheck (console);
83 };
84
85 auto target8 = [&]()
86 {
87 message = _T ("DequePerformanceCheck\n");
88 check = new PerfCheck::DequePerformanceCheck (console);
89 };
90
91 auto target9 = [&]()
92 {
93 message = _T ("TStringPerformanceCheck\n");
94 check = new PerfCheck::TStringPerformanceCheck (console);
95 };
96
97 auto target10 = [&]()
98 {
99 message = _T ("HeapPerformanceCheck\n");
100 check = new PerfCheck::HeapPerformanceCheck (console);
101 };
102
103 auto target11 = [&]()
104 {
105 message = _T ("NewPerformanceCheck\n");
106 check = new PerfCheck::NewPerformanceCheck (console);
107 };
108
109 auto target12 = [&]()
110 {
111 message = _T ("WatchDocTimerPerformanceCheck\n");
112 check = new PerfCheck::WatchDocTimerPerformanceCheck (console);
113 };
114
115 auto target13 = [&]()
116 {
117 message = _T ("TCPPerformanceCheck\n");
118 check = new PerfCheck::TCPPerformanceCheck (console);
119 };
120
121 auto target14 = [&]()
122 {
123 message = _T ("UDPPerformanceCheck\n");
124 check = new PerfCheck::UDPPerformanceCheck (console);
125 };
126
127 std::map<int, std::function<void ()>> strategy;
128 strategy[1] = target1;
129 strategy[2] = target2;
130 strategy[3] = target3;
131 strategy[4] = target4;
132 strategy[5] = target5;
133 strategy[6] = target6;
134 strategy[7] = target7;
135 strategy[8] = target8;
136 strategy[9] = target9;
137 strategy[10] = target10;
138 strategy[11] = target11;
139 strategy[12] = target12;
140 strategy[13] = target13;
141 strategy[14] = target14;
142
143 auto& target = strategy[action];
144 target ();
145 check->Init ();
146 console.Write (message.Ctr());
147 check->DoAction ();
148 delete check;
149}
150
152 :_console(console)
153{
154}
155
157{
158}
159
161{
162}
Arrayクラス性能測定用
#define CONFIG_FILE
Definition: ConsoleDriver.h:10
Consoleクラス性能測定用
双方向キュークラス性能測定用
Fileクラス性能測定用
Freightクラス性能測定用
HeapMemoryクラス性能測定用
連結リストクラス性能測定用
newの性能測定用
int _tmain(int argc, TCHAR *argv[])
性能測定用
Fileクラスの比較用
TCP性能測定用
TStringクラス性能測定用
UDP性能測定用
std::vector<T>性能測定用
WatchDocTimerクラス性能測定用
プリコンパイル済みヘッダー ファイルです。
Arrayクラス性能測定用
双方向キュークラス性能測定用
Fileクラス性能測定用
Freightクラス性能測定用
HeapMemoryクラス性能測定用
連結リストクラス性能測定用
virtual VOID Init()
初期化処理
virtual BOOL DoAction()=0
処理開始
virtual ~PerformanceCheck()
デストラクタ
TStringクラス性能測定用
std::vector<T>クラス性能測定用
コンソールに関するクラス
Definition: Console.h:88
DWORD APIENTRY Write(LPCTSTR lpctszString) const
コンソールに文字を出力します。
Definition: Console.cpp:54
BOOL APIENTRY Init()
Consoleクラスを初期化します。
Definition: Console.cpp:30
VOID APIENTRY Format(LPCTSTR format,...) const
コンソールに文字を出力します。
Definition: Console.cpp:63
BOOL APIENTRY Clear() const
コンソールをクリアします。
Definition: Console.cpp:115
文字列に関するWindowsAPIを集約したクラス
Definition: TString.h:17
LPCTSTR APIENTRY Ctr() const
内部で確保している文字列ポインタを取得します。
Definition: TString.h:46
static BOOL APIENTRY ReadIniFile(LPCTSTR lpctszIniFile, LPCTSTR lpctszSection, LPCTSTR lpctszKeyword, TString &response)
設定フィルの読み込み
Definition: Utility.cpp:178