リビジョン | 9b0e24d2ab999d4e7729aa4c1ed5caeb0d0cff15 (tree) |
---|---|
日時 | 2012-10-29 00:43:15 |
作者 | konekoneko <jbh03215@hotm...> |
コミッター | konekoneko |
1ループあたりの実行回数を指定できるようにした
@@ -42,13 +42,15 @@ | ||
42 | 42 | this.comboBox1 = new System.Windows.Forms.ComboBox(); |
43 | 43 | this.checkBox1 = new System.Windows.Forms.CheckBox(); |
44 | 44 | this.checkBox2 = new System.Windows.Forms.CheckBox(); |
45 | + this.label1 = new System.Windows.Forms.Label(); | |
46 | + this.comboBox2 = new System.Windows.Forms.ComboBox(); | |
45 | 47 | this.SuspendLayout(); |
46 | 48 | // |
47 | 49 | // button1 |
48 | 50 | // |
49 | - this.button1.Location = new System.Drawing.Point(57, 270); | |
51 | + this.button1.Location = new System.Drawing.Point(153, 249); | |
50 | 52 | this.button1.Name = "button1"; |
51 | - this.button1.Size = new System.Drawing.Size(64, 23); | |
53 | + this.button1.Size = new System.Drawing.Size(64, 20); | |
52 | 54 | this.button1.TabIndex = 1; |
53 | 55 | this.button1.Text = "計測開始"; |
54 | 56 | this.button1.UseVisualStyleBackColor = true; |
@@ -56,9 +58,9 @@ | ||
56 | 58 | // |
57 | 59 | // button4 |
58 | 60 | // |
59 | - this.button4.Location = new System.Drawing.Point(126, 270); | |
61 | + this.button4.Location = new System.Drawing.Point(222, 249); | |
60 | 62 | this.button4.Name = "button4"; |
61 | - this.button4.Size = new System.Drawing.Size(76, 23); | |
63 | + this.button4.Size = new System.Drawing.Size(76, 20); | |
62 | 64 | this.button4.TabIndex = 11; |
63 | 65 | this.button4.Text = "結果をコピー"; |
64 | 66 | this.button4.UseVisualStyleBackColor = true; |
@@ -67,33 +69,33 @@ | ||
67 | 69 | // label5 |
68 | 70 | // |
69 | 71 | this.label5.AutoSize = true; |
70 | - this.label5.Location = new System.Drawing.Point(10, 155); | |
72 | + this.label5.Location = new System.Drawing.Point(10, 133); | |
71 | 73 | this.label5.Name = "label5"; |
72 | - this.label5.Size = new System.Drawing.Size(27, 14); | |
74 | + this.label5.Size = new System.Drawing.Size(25, 12); | |
73 | 75 | this.label5.TabIndex = 13; |
74 | 76 | this.label5.Text = "高さ"; |
75 | 77 | // |
76 | 78 | // label6 |
77 | 79 | // |
78 | 80 | this.label6.AutoSize = true; |
79 | - this.label6.Location = new System.Drawing.Point(122, 155); | |
81 | + this.label6.Location = new System.Drawing.Point(122, 133); | |
80 | 82 | this.label6.Name = "label6"; |
81 | - this.label6.Size = new System.Drawing.Size(19, 14); | |
83 | + this.label6.Size = new System.Drawing.Size(17, 12); | |
82 | 84 | this.label6.TabIndex = 15; |
83 | 85 | this.label6.Text = "幅"; |
84 | 86 | // |
85 | 87 | // textBox4 |
86 | 88 | // |
87 | - this.textBox4.Location = new System.Drawing.Point(47, 152); | |
89 | + this.textBox4.Location = new System.Drawing.Point(47, 130); | |
88 | 90 | this.textBox4.Name = "textBox4"; |
89 | - this.textBox4.Size = new System.Drawing.Size(62, 22); | |
91 | + this.textBox4.Size = new System.Drawing.Size(62, 19); | |
90 | 92 | this.textBox4.TabIndex = 16; |
91 | 93 | // |
92 | 94 | // textBox5 |
93 | 95 | // |
94 | - this.textBox5.Location = new System.Drawing.Point(147, 151); | |
96 | + this.textBox5.Location = new System.Drawing.Point(147, 129); | |
95 | 97 | this.textBox5.Name = "textBox5"; |
96 | - this.textBox5.Size = new System.Drawing.Size(62, 22); | |
98 | + this.textBox5.Size = new System.Drawing.Size(62, 19); | |
97 | 99 | this.textBox5.TabIndex = 17; |
98 | 100 | // |
99 | 101 | // listView1 |
@@ -103,9 +105,9 @@ | ||
103 | 105 | this.time, |
104 | 106 | this.fillrate}); |
105 | 107 | this.listView1.LabelWrap = false; |
106 | - this.listView1.Location = new System.Drawing.Point(13, 12); | |
108 | + this.listView1.Location = new System.Drawing.Point(13, 10); | |
107 | 109 | this.listView1.Name = "listView1"; |
108 | - this.listView1.Size = new System.Drawing.Size(199, 131); | |
110 | + this.listView1.Size = new System.Drawing.Size(286, 113); | |
109 | 111 | this.listView1.TabIndex = 18; |
110 | 112 | this.listView1.UseCompatibleStateImageBehavior = false; |
111 | 113 | this.listView1.View = System.Windows.Forms.View.Details; |
@@ -127,11 +129,11 @@ | ||
127 | 129 | // label2 |
128 | 130 | // |
129 | 131 | this.label2.AutoSize = true; |
130 | - this.label2.Location = new System.Drawing.Point(9, 184); | |
132 | + this.label2.Location = new System.Drawing.Point(9, 158); | |
131 | 133 | this.label2.Name = "label2"; |
132 | - this.label2.Size = new System.Drawing.Size(55, 14); | |
134 | + this.label2.Size = new System.Drawing.Size(58, 12); | |
133 | 135 | this.label2.TabIndex = 19; |
134 | - this.label2.Text = "実行回数"; | |
136 | + this.label2.Text = "繰り返し数"; | |
135 | 137 | // |
136 | 138 | // comboBox1 |
137 | 139 | // |
@@ -147,17 +149,17 @@ | ||
147 | 149 | "8000", |
148 | 150 | "9000", |
149 | 151 | "10000"}); |
150 | - this.comboBox1.Location = new System.Drawing.Point(57, 181); | |
152 | + this.comboBox1.Location = new System.Drawing.Point(110, 154); | |
151 | 153 | this.comboBox1.Name = "comboBox1"; |
152 | - this.comboBox1.Size = new System.Drawing.Size(104, 22); | |
154 | + this.comboBox1.Size = new System.Drawing.Size(104, 20); | |
153 | 155 | this.comboBox1.TabIndex = 20; |
154 | 156 | // |
155 | 157 | // checkBox1 |
156 | 158 | // |
157 | 159 | this.checkBox1.AutoSize = true; |
158 | - this.checkBox1.Location = new System.Drawing.Point(13, 214); | |
160 | + this.checkBox1.Location = new System.Drawing.Point(12, 206); | |
159 | 161 | this.checkBox1.Name = "checkBox1"; |
160 | - this.checkBox1.Size = new System.Drawing.Size(189, 18); | |
162 | + this.checkBox1.Size = new System.Drawing.Size(187, 16); | |
161 | 163 | this.checkBox1.TabIndex = 21; |
162 | 164 | this.checkBox1.Text = "GDIで行う(未チェックだとDirect2D)"; |
163 | 165 | this.checkBox1.UseVisualStyleBackColor = true; |
@@ -165,18 +167,44 @@ | ||
165 | 167 | // checkBox2 |
166 | 168 | // |
167 | 169 | this.checkBox2.AutoSize = true; |
168 | - this.checkBox2.Location = new System.Drawing.Point(13, 238); | |
170 | + this.checkBox2.Location = new System.Drawing.Point(12, 227); | |
169 | 171 | this.checkBox2.Name = "checkBox2"; |
170 | - this.checkBox2.Size = new System.Drawing.Size(219, 18); | |
172 | + this.checkBox2.Size = new System.Drawing.Size(217, 16); | |
171 | 173 | this.checkBox2.TabIndex = 22; |
172 | 174 | this.checkBox2.Text = "アンチエイリアシングを行う(Direct2Dのみ)"; |
173 | 175 | this.checkBox2.UseVisualStyleBackColor = true; |
174 | 176 | // |
177 | + // label1 | |
178 | + // | |
179 | + this.label1.AutoSize = true; | |
180 | + this.label1.Location = new System.Drawing.Point(10, 184); | |
181 | + this.label1.Name = "label1"; | |
182 | + this.label1.Size = new System.Drawing.Size(94, 12); | |
183 | + this.label1.TabIndex = 23; | |
184 | + this.label1.Text = "実行回数/1ループ"; | |
185 | + // | |
186 | + // comboBox2 | |
187 | + // | |
188 | + this.comboBox2.FormattingEnabled = true; | |
189 | + this.comboBox2.Items.AddRange(new object[] { | |
190 | + "50", | |
191 | + "100", | |
192 | + "200", | |
193 | + "400", | |
194 | + "800", | |
195 | + "1600"}); | |
196 | + this.comboBox2.Location = new System.Drawing.Point(110, 180); | |
197 | + this.comboBox2.Name = "comboBox2"; | |
198 | + this.comboBox2.Size = new System.Drawing.Size(104, 20); | |
199 | + this.comboBox2.TabIndex = 24; | |
200 | + // | |
175 | 201 | // Form1 |
176 | 202 | // |
177 | - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F); | |
203 | + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |
178 | 204 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
179 | - this.ClientSize = new System.Drawing.Size(230, 305); | |
205 | + this.ClientSize = new System.Drawing.Size(311, 277); | |
206 | + this.Controls.Add(this.comboBox2); | |
207 | + this.Controls.Add(this.label1); | |
180 | 208 | this.Controls.Add(this.checkBox2); |
181 | 209 | this.Controls.Add(this.checkBox1); |
182 | 210 | this.Controls.Add(this.comboBox1); |
@@ -211,6 +239,8 @@ | ||
211 | 239 | private System.Windows.Forms.CheckBox checkBox1; |
212 | 240 | private System.Windows.Forms.ColumnHeader fillrate; |
213 | 241 | private System.Windows.Forms.CheckBox checkBox2; |
242 | + private System.Windows.Forms.Label label1; | |
243 | + private System.Windows.Forms.ComboBox comboBox2; | |
214 | 244 | } |
215 | 245 | } |
216 | 246 |
@@ -16,6 +16,7 @@ namespace D2DBench | ||
16 | 16 | this.textBox4.Text = Screen.GetBounds(this).Size.Width.ToString(); |
17 | 17 | this.textBox5.Text = Screen.GetBounds(this).Size.Height.ToString(); |
18 | 18 | this.comboBox1.SelectedIndex = 0; |
19 | + this.comboBox2.SelectedIndex = 0; | |
19 | 20 | if (Environment.OSVersion.Version.Major <= 5) |
20 | 21 | { |
21 | 22 | this.checkBox1.Checked = true; |
@@ -28,6 +29,9 @@ namespace D2DBench | ||
28 | 29 | private void button1_Click(object sender, EventArgs e) |
29 | 30 | { |
30 | 31 | int maxcount = Int32.Parse(this.comboBox1.SelectedItem.ToString()); |
32 | + int loopCountAtOneLoop = ExecuteCountPerOneset; | |
33 | + if(this.comboBox2.SelectedItem != null) | |
34 | + loopCountAtOneLoop = Int32.Parse(this.comboBox2.SelectedItem.ToString()); | |
31 | 35 | |
32 | 36 | this.listView1.Items.Clear(); |
33 | 37 |
@@ -53,6 +57,7 @@ namespace D2DBench | ||
53 | 57 | foreach (IBench method in methods) |
54 | 58 | { |
55 | 59 | method.Init(benchFrom,this.checkBox2.Checked); |
60 | + method.loopCount = loopCountAtOneLoop; | |
56 | 61 | |
57 | 62 | Stopwatch watch = new Stopwatch(); |
58 | 63 | watch.Start(); |
@@ -86,7 +91,8 @@ namespace D2DBench | ||
86 | 91 | StringBuilder result = new StringBuilder(); |
87 | 92 | result.AppendFormat("OS:{0}\r\n", Environment.OSVersion.VersionString); |
88 | 93 | result.AppendFormat("ウィンドウサイズ:{0}×{1}\r\n", this.textBox4.Text, this.textBox5.Text); |
89 | - result.AppendFormat("実行回数:{0}\r\n", (string)this.comboBox1.SelectedItem); | |
94 | + result.AppendFormat("ループ回数:{0}\r\n", (string)this.comboBox1.SelectedItem); | |
95 | + result.AppendFormat("実行回数/1ループ:{0}\r\n", (string)this.comboBox2.SelectedItem); | |
90 | 96 | result.AppendFormat("アンチエイリアシング:{0}\r\n", this.checkBox2.Checked.ToString()); |
91 | 97 | foreach (string proc in HWInfo.processorNames) |
92 | 98 | result.AppendFormat("CPU:{0}\r\n",proc); |
@@ -7,6 +7,7 @@ namespace D2DBench | ||
7 | 7 | { |
8 | 8 | int fillAreaSize { get; } |
9 | 9 | string methodName { get; } |
10 | + int loopCount { get; set; } | |
10 | 11 | void Init(Control ctrl,bool antialias); |
11 | 12 | void Exec(); |
12 | 13 | } |
@@ -16,6 +16,7 @@ namespace D2DBench | ||
16 | 16 | { |
17 | 17 | public int fillAreaSize { get { return 0; } } |
18 | 18 | public string methodName { get { return "D2D文字列"; } } |
19 | + public int loopCount { get; set; } | |
19 | 20 | |
20 | 21 | D2D.Factory Factory2D; |
21 | 22 | DW.Factory FactoryDWrite; |
@@ -44,7 +45,7 @@ namespace D2DBench | ||
44 | 45 | public void Exec() |
45 | 46 | { |
46 | 47 | render.BeginDraw(); |
47 | - for (int i = 0; i < Form1.ExecuteCountPerOneset; i++) | |
48 | + for (int i = 0; i < this.loopCount; i++) | |
48 | 49 | { |
49 | 50 | render.DrawTextLayout(new Point(rnd.Next(ClientSize.Width), rnd.Next(ClientSize.Height)), layout, colors[rnd.Next(colors.Count - 1)]); |
50 | 51 | } |
@@ -16,6 +16,7 @@ namespace D2DBench | ||
16 | 16 | { |
17 | 17 | public int fillAreaSize { get { return 0; } } |
18 | 18 | public string methodName { get { return "D2D線"; } } |
19 | + public int loopCount { get; set; } | |
19 | 20 | |
20 | 21 | D2D.Factory Factory2D; |
21 | 22 | DW.Factory FactoryDWrite; |
@@ -40,7 +41,7 @@ namespace D2DBench | ||
40 | 41 | public void Exec() |
41 | 42 | { |
42 | 43 | render.BeginDraw(); |
43 | - for (int i = 0; i < Form1.ExecuteCountPerOneset; i++) | |
44 | + for (int i = 0; i < this.loopCount; i++) | |
44 | 45 | { |
45 | 46 | var fore = colors[rnd.Next(colors.Count - 1)]; |
46 | 47 | Point from = new Point(rnd.Next(ClientSize.Width), rnd.Next(ClientSize.Height)); |
@@ -14,8 +14,9 @@ namespace D2DBench | ||
14 | 14 | { |
15 | 15 | class Method3 : IBench |
16 | 16 | { |
17 | - public int fillAreaSize { get { return bmpSize.Width * bmpSize.Height * Form1.ExecuteCountPerOneset; } } | |
17 | + public int fillAreaSize { get { return bmpSize.Width * bmpSize.Height * this.loopCount; } } | |
18 | 18 | public string methodName { get { return "D2D塗りつぶし"; } } |
19 | + public int loopCount { get; set; } | |
19 | 20 | |
20 | 21 | D2D.Factory Factory2D; |
21 | 22 | DW.Factory FactoryDWrite; |
@@ -41,7 +42,7 @@ namespace D2DBench | ||
41 | 42 | public void Exec() |
42 | 43 | { |
43 | 44 | render.BeginDraw(); |
44 | - for (int i = 0; i < 100; i++) | |
45 | + for (int i = 0; i < this.loopCount; i++) | |
45 | 46 | { |
46 | 47 | var fore = colors[rnd.Next(colors.Count - 1)]; |
47 | 48 | SharpDX.RectangleF rect = new SharpDX.RectangleF(); |
@@ -17,8 +17,9 @@ namespace D2DBench | ||
17 | 17 | { |
18 | 18 | class Method4 : IBench |
19 | 19 | { |
20 | - public int fillAreaSize { get { return bmpSize.Width * bmpSize.Height * Form1.ExecuteCountPerOneset; } } | |
20 | + public int fillAreaSize { get { return bmpSize.Width * bmpSize.Height * this.loopCount; } } | |
21 | 21 | public string methodName { get { return "D2DBitBlt"; } } |
22 | + public int loopCount { get; set; } | |
22 | 23 | |
23 | 24 | D2D1.Factory Factory2D; |
24 | 25 | DW.Factory FactoryDWrite; |
@@ -53,7 +54,7 @@ namespace D2DBench | ||
53 | 54 | public void Exec() |
54 | 55 | { |
55 | 56 | render.BeginDraw(); |
56 | - for (int i = 0; i < Form1.ExecuteCountPerOneset; i++) | |
57 | + for (int i = 0; i < this.loopCount; i++) | |
57 | 58 | { |
58 | 59 | SharpDX.RectangleF rect = new SharpDX.RectangleF(); |
59 | 60 | rect.Left = rnd.Next(ClientSize.Width); |
@@ -9,6 +9,7 @@ namespace D2DBench | ||
9 | 9 | { |
10 | 10 | public int fillAreaSize { get { return 0; } } |
11 | 11 | public string methodName { get { return "GDI文字列"; } } |
12 | + public int loopCount { get; set; } | |
12 | 13 | |
13 | 14 | GDI gdi; |
14 | 15 | ColorTableGDI colors; |
@@ -29,7 +30,7 @@ namespace D2DBench | ||
29 | 30 | { |
30 | 31 | Random rnd = new Random(); |
31 | 32 | gdi.BeginDraw(); |
32 | - for (int j = 0; j < Form1.ExecuteCountPerOneset; j++) | |
33 | + for (int j = 0; j < this.loopCount; j++) | |
33 | 34 | { |
34 | 35 | Color c = colors[rnd.Next(colors.Count - 1)]; |
35 | 36 | gdi.DrawString(font, showStr, c, rnd.Next(ClientSize.Width), rnd.Next(ClientSize.Height)); |
@@ -9,6 +9,7 @@ namespace D2DBench | ||
9 | 9 | { |
10 | 10 | public int fillAreaSize { get { return 0; } } |
11 | 11 | public string methodName { get { return "GDI線"; } } |
12 | + public int loopCount { get; set; } | |
12 | 13 | |
13 | 14 | GDI gdi; |
14 | 15 | ColorTableGDI colors; |
@@ -29,7 +30,7 @@ namespace D2DBench | ||
29 | 30 | { |
30 | 31 | Random rnd = new Random(); |
31 | 32 | gdi.BeginDraw(); |
32 | - for (int j = 0; j < Form1.ExecuteCountPerOneset; j++) | |
33 | + for (int j = 0; j < this.loopCount; j++) | |
33 | 34 | { |
34 | 35 | Color fore = colors[rnd.Next(colors.Count - 1)]; |
35 | 36 | Point from = new Point(rnd.Next(ClientSize.Width), rnd.Next(ClientSize.Height)); |
@@ -7,8 +7,9 @@ namespace D2DBench | ||
7 | 7 | { |
8 | 8 | class Method7 : IBench |
9 | 9 | { |
10 | - public int fillAreaSize { get { return bmpSize.Width * bmpSize.Height * Form1.ExecuteCountPerOneset; } } | |
10 | + public int fillAreaSize { get { return bmpSize.Width * bmpSize.Height * this.loopCount; } } | |
11 | 11 | public string methodName { get { return "GDI塗りつぶし"; } } |
12 | + public int loopCount { get; set; } | |
12 | 13 | |
13 | 14 | GDI gdi; |
14 | 15 | ColorTableGDI colors; |
@@ -30,7 +31,7 @@ namespace D2DBench | ||
30 | 31 | { |
31 | 32 | Random rnd = new Random(); |
32 | 33 | gdi.BeginDraw(); |
33 | - for (int j = 0; j < Form1.ExecuteCountPerOneset; j++) | |
34 | + for (int j = 0; j < this.loopCount; j++) | |
34 | 35 | { |
35 | 36 | Color fore = colors[rnd.Next(colors.Count - 1)]; |
36 | 37 | Rectangle rect = new Rectangle(); |
@@ -8,8 +8,9 @@ namespace D2DBench | ||
8 | 8 | { |
9 | 9 | class Method8 : IBench |
10 | 10 | { |
11 | - public int fillAreaSize { get { return bmpSize.Width * bmpSize.Height * Form1.ExecuteCountPerOneset; } } | |
11 | + public int fillAreaSize { get { return bmpSize.Width * bmpSize.Height * this.loopCount; } } | |
12 | 12 | public string methodName { get { return "GDIBitBlt"; } } |
13 | + public int loopCount { get; set; } | |
13 | 14 | |
14 | 15 | GDI gdi; |
15 | 16 | ColorTableGDI colors; |
@@ -34,7 +35,7 @@ namespace D2DBench | ||
34 | 35 | { |
35 | 36 | Random rnd = new Random(); |
36 | 37 | gdi.BeginDraw(); |
37 | - for (int j = 0; j < Form1.ExecuteCountPerOneset; j++) | |
38 | + for (int j = 0; j < this.loopCount; j++) | |
38 | 39 | { |
39 | 40 | Rectangle rect = new Rectangle(); |
40 | 41 | rect.X = rnd.Next(ClientSize.Width); |