Alternate e697dbe9c5997e35395fe158628dd8c5209481da
for Visual Studio 2022 and Windows 11.
読み取り中…
検索中…
一致する文字列を見つけられません
LinkedListPerformanceCheck.cpp
[詳解]
1
5
6#include "pch.h"
8#include "LinkedList.hpp"
9#include "Freight.hpp"
10
11using namespace PerfCheck;
12
14 :PerformanceCheck (console)
15{
16}
17
19{
20}
21
23{
24 int count = alt::Utility::ReadIniFile(CONFIG_FILE, _T("LinkedList"), _T("Count"), -1);
25 if (count == -1) return FALSE;
26
27 int size = alt::Utility::ReadIniFile(CONFIG_FILE, _T("LinkedList"), _T("Size"), -1);
28 if (size == -1) return FALSE;
29
30 _console.Format (_T ("Count=%d Size=%d\n"), count, size);
31
32 return this->Core (count, size);
33}
34
35BOOL LinkedListPerformanceCheck::Core (const int param1, const int param2)
36{
38 typedef alt::skeleton::Freight<BYTE> ByteFreight;
39 LPBYTE lpbyData = new BYTE[param2];
40 ZeroMemory (lpbyData, param2);
42
43 Q.Start ();
44
45 for (int i = 0; i < param1; i++)
46 {
47 ByteFreight byteFreight (lpbyData, param2);
48 container.AddLast (byteFreight);
49 }
50
51 for (int i = 0; i < param1; i++)
52 {
53 ByteFreight byteFreight (lpbyData, param2);
54 container.AddFirst (byteFreight);
55 }
56
57 for (int i = 0; i < param1; i++)
58 {
59 ByteFreight byteFreight (lpbyData, param2);
60 container.AddFirst (byteFreight);
61 }
62
63 for (int i = 0; i < param1; i++)
64 {
65 container.RemoveFirst ();
66 }
67
68 alt::skeleton::LinkedList<ByteFreight> container2 = container;
69 container.Clear ();
70
71 for (int i = 0; i < container2.Size (); i++)
72 {
73 ByteFreight* value = container2.Get (i);
74 LPBYTE lpbyData = value->GetData ();
75 size_t size = value->GetSize ();
76 }
77
78 container2.Clear ();
79
80 Q.Stop ();
81
82 delete[] lpbyData;
83 int msec = static_cast<int>(Q.PastTime ());
84
85 _console.Format( _T ("It takes %dmsec.\n"), msec);
86
87 return TRUE;
88}
#define CONFIG_FILE
Definition: ConsoleDriver.h:10
プリミティブな変数を管理するコンテナクラス
連結リストに関するクラス
連結リストクラス性能測定用
#define size
プリコンパイル済みヘッダー ファイルです。
virtual BOOL Core(const int param1, const int param2)
コンソールに関するクラス
Definition: Console.h:88
VOID APIENTRY Format(LPCTSTR format,...) const
コンソールに文字を出力します。
Definition: Console.cpp:63
高分解能時間計測クラス
VOID APIENTRY Start()
計測を開始します。
double APIENTRY PastTime() const
計測開始〜計測終了までの時間を出力します。
VOID APIENTRY Stop()
計測を終了します。
static BOOL APIENTRY ReadIniFile(LPCTSTR lpctszIniFile, LPCTSTR lpctszSection, LPCTSTR lpctszKeyword, TString &response)
設定フィルの読み込み
Definition: Utility.cpp:178
プリミティブな変数を管理するコンテナクラス
Definition: Freight.hpp:18
ポインタによる連結リストを具現したクラス
Definition: LinkedList.hpp:106
T *APIENTRY Get(SIZE_T index) const
指定したインデックスの値を取得
Definition: LinkedList.hpp:179
VOID APIENTRY AddFirst(T &item)
LinkedList<T>へ値を追加
Definition: LinkedList.hpp:133
VOID APIENTRY RemoveFirst()
LinkedList<T>の先頭アイテムを削除
Definition: LinkedList.hpp:216
VOID APIENTRY Clear()
領域の開放
Definition: LinkedList.hpp:313
VOID APIENTRY AddLast(T &item)
LinkedList<T>へ値を追加
Definition: LinkedList.hpp:156
SIZE_T APIENTRY Size() const
サイズを取得
Definition: LinkedList.hpp:307