|
-
Feb 15th, 2005, 10:40 PM
#1
Thread Starter
Hyperactive Member
Elapse time
Hi,
I'm doing a performance test on calling a function in different situation. I record the start and end time to a DateTime variable, and calculate the no. of seconds elapsed using Datediff function.
However, I found that it only accurate to seconds, if the different is less than 1, it will became 0. How can I measure the time in more accurate way?
Thx!
-
Feb 16th, 2005, 01:10 AM
#2
Re: Elapse time
 Originally Posted by stm
Hi,
I'm doing a performance test on calling a function in different situation. I record the start and end time to a DateTime variable, and calculate the no. of seconds elapsed using Datediff function.
However, I found that it only accurate to seconds, if the different is less than 1, it will became 0. How can I measure the time in more accurate way?
Thx!
hmm how are you using DateTime as a counter? show me I wanna know 
I think the correct way to do this is to use performance counters. I dont really know how to do this with .NET but I think you can use these apis
QueryPerformanceFrequency
QueryPerformanceCounter
umm anyways I did this in C# with the TimeSpan object and it works fine, gives the miliseconds too. Try using it...
a = new TimeSpan(DateTime.Now.Ticks);
b = new TimeSpan(DateTime.Now.Ticks);
b= b.Subtract(a);
MessageBox.Show (b.Seconds.ToString() + " " + b.Milliseconds.ToString());
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 16th, 2005, 01:30 AM
#3
Thread Starter
Hyperactive Member
Re: Elapse time
HoHo...Don't laugh me.
I just record the current time using Now, and Datediff.........
-
Feb 16th, 2005, 01:39 AM
#4
Re: Elapse time
 Originally Posted by stm
HoHo...Don't laugh me.
I just record the current time using Now, and Datediff.........
oh got you... I wasnt laughing at you haha
umm and THAT didn't give you the milliseconds?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 16th, 2005, 03:23 AM
#5
Thread Starter
Hyperactive Member
Re: Elapse time
yes and it helps.......thx a lot!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|