using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace Sorting
{
public partial class TimeMeasurement : Form
{
public TimeMeasurement()
{
InitializeComponent();
}
private IntPtr start = new IntPtr(0);
private IntPtr end = new IntPtr(1);
private int WM_USER = 0x400;
private Stopwatch sw = new Stopwatch();
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_USER + 1)
{
if (m.WParam == start)
{
Debug.WriteLine(m.ToString());
Debug.WriteLine("시간측정 시작("+DateTime.Now+")");
sw.Reset();
sw.Start();
}
else if (m.WParam == end)
{
sw.Stop();
Debug.WriteLine("경과 시간(StopWatch) = " + sw.ElapsedTicks + " ticks(" + sw.Elapsed + " 초)");
Debug.WriteLine("시간측정 종료(" + DateTime.Now + ")\n");
}
}
}
}
}
'C#, .NET' 카테고리의 다른 글
Form application 과 Thread (0) | 2011.06.17 |
---|---|
stack allocation 과 unsafe code (0) | 2011.06.17 |
정밀하게 시간측정 하기. (0) | 2011.06.17 |
virtual method 와 Interface (0) | 2011.06.17 |
atoi ,itoa (0) | 2011.06.17 |