Alternate e697dbe9c5997e35395fe158628dd8c5209481da
for Visual Studio 2022 and Windows 11.
読み取り中…
検索中…
一致する文字列を見つけられません
FreightPerformanceCheck.cpp
[詳解]
1
5
6#include "pch.h"
8
9using namespace PerfCheck;
10
12 :PerformanceCheck (console)
13{
14}
15
17{
18}
19
21{
22 BOOL ret;
23 alt::BasicMemory basicMem;
24 alt::HeapMemory systemHeap;
25 alt::HeapMemory userHeap;
26 alt::VirtualMemory1 virtualMem;
27
28 ret = systemHeap.Open ();
29 if (!ret) return FALSE;
30
31 ret = userHeap.Create ();
32 if (!ret) return FALSE;
33
34 for (int i = 0; i < 4; i++)
35 {
36 for (int j = 0; j < 10; j++)
37 {
38 int count = alt::Utility::ReadIniFile(CONFIG_FILE, _T("Freight"), _T("Count"), -1);
39 if (count == -1) return FALSE;
40
41 int size = static_cast<int>(pow (8, j));
42 _console.Format (_T ("Freigtのサイズ:%10d ループ回数:%4d "), size, count);
43
44 switch (i)
45 {
46 case 0:
47 {
48 ByteFreight freight;
49 _console.Write (_T ("BasicMemory "));
50 ret = this->Measure (size, count, freight);
51 }
52 break;
53 case 1:
54 {
55 ByteFreight freight (&systemHeap);
56 _console.Write (_T ("システムヒープ "));
57 ret = this->Measure (size, count, freight);
58 }
59 break;
60 case 2:
61 {
62 ByteFreight freight (&userHeap);
63 _console.Write (_T ("ユーザーヒープ "));
64 ret = this->Measure (size, count, freight);
65 }
66 break;
67 case 3:
68 {
69 ByteFreight freight (&virtualMem);
70 _console.Write (_T ("仮想メモリ "));
71 ret = this->Measure (size, count, freight);
72 }
73 break;
74 }
75
76 if (!ret) break;
77 }
78 }
79
80 return ret;
81}
82
83BOOL FreightPerformanceCheck::Measure (int size, int count, ByteFreight& freight)
84{
86 int loop = count;
87
88 Q.Start ();
89
90 do
91 {
92 freight.New (size);
93
94 //ZeroMemory (freight.GetData(), freight.GetSize());
95
96 freight.Clear ();
97 } while (loop--);
98
99 Q.Stop ();
100 double msec = Q.PastTime ();
101
102 double count_per_msec = count / msec;
103 double msec_per_count = msec / count;
104 _console.Format (_T ("ratio %8.2f[count/msec] %8.2f[msec/count]\n"), count_per_msec, msec_per_count);
105
106 return TRUE;
107}
#define CONFIG_FILE
Definition: ConsoleDriver.h:10
Freightクラス性能測定用
#define loop
#define size
プリコンパイル済みヘッダー ファイルです。
BOOL Measure(int size, int count, ByteFreight &freight)
malloc/realloc/freeを使った標準的なメモリクラス
Definition: HeapMemory.h:17
コンソールに関するクラス
Definition: Console.h:88
DWORD APIENTRY Write(LPCTSTR lpctszString) const
コンソールに文字を出力します。
Definition: Console.cpp:54
VOID APIENTRY Format(LPCTSTR format,...) const
コンソールに文字を出力します。
Definition: Console.cpp:63
ヒープメモリに関するAPIを集約したクラス
Definition: HeapMemory.h:46
BOOL APIENTRY Create(SIZE_T initialSize=0, SIZE_T maximumSize=0, DWORD dwOptions=0)
ヒープ領域の取得
Definition: HeapMemory.cpp:56
BOOL APIENTRY Open()
システムヒープ領域の取得
Definition: HeapMemory.cpp:87
高分解能時間計測クラス
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: VirtualMemory.h:17
プリミティブな変数を管理するコンテナクラス
Definition: Freight.hpp:18
VOID APIENTRY Clear()
格納領域の開放
Definition: Freight.hpp:107
VOID APIENTRY New(size_t size)
事前のメモリ取得
Definition: Freight.hpp:91