Process p = new Process();
p.StartInfo.FileName = @"C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\sqlpubwiz";
p.StartInfo.Arguments = "script -S server -U sa -P sys123 -d Newone " c:\\Newone.sql ";
In above code how can i messuring the process time or time for executing that query
p.Start();
VulpesPosted Mar 12, 2011, 3:56 PM
Sam HobbsPosted Mar 12, 2011, 3:14 PM
Suthish NairPosted Mar 12, 2011, 1:47 PM
VulpesPosted Mar 11, 2011, 7:06 AM
// create private field
private DateTime start;
// ...
Process p = new Process();
p.StartInfo.FileName = @"C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\sqlpubwiz";
p.StartInfo.Arguments = "script -S server -U sa -P sys123 -d Newone " c:\\Newone.sql ";
p.EnableRaisingEvents = true;
p.Exited += Process_Exited;
start = DateTime.Now;
p.Start();
private void Process_Exited(object sender, System.EventArgs e)
{
Process p = (Process)sender;
TimeSpan elapsed = p.ExitTime - start;
MessageBox.Show("The process ran for {0} milliseconds", elapsed.TotalMilliseconds);
}
Manikavelu VelayuthamPosted Mar 11, 2011, 6:58 AM
Stopwatch timer = new Stopwatch();
timer.Start();
...
...
timer.Stop();
MessageBox.Show("Elapsed: "+ timer.Elapsed);
MessageBox.Show("In milliseconds: "+ timer.ElapsedMilliseconds);
MessageBox.Show("In timer ticks: "+ timer.ElapsedTicks);
The above code is used to find out the execution time in .NET