我使用以下命令连接仪器。
instrument = programmer.GetInstrument(_address);
我想知道执行此命令需要多长时间。
答案 0 :(得分:2)
如果您只想进行内联线程,可以执行以下代码:
System.Threading.Thread t = new System.Threading.Thread(delegate()
{
try
{
DateTime cmdStartTime = DateTime.UtcNow;
instrument = programmer.GetInstrument(_address);
DateTime cmdEndTime = DateTime.UtcNow;
TimeSpan totalCmdRuntime = cmdEndTime - cmdStartTime;
Debug.WriteLine(String.Format("Programmer.GetInstrument({0}) command took {1} mSec to execute", _address, totalCmdRuntime.TotalMilliseconds));
}
catch { }
});
t.Name = "GetInstrumentTimer";
t.Start();