Hi, I want to measure a time (in ticks) between a couple of operations, with
these code:
long voor = DateTime.Now.TimeOfDay.Ticks;
bmp1 = new Bitmap(@"\Network\im\ImageWeftIllum.bmp");
bmp2 = new Bitmap(@"\Network\im\ImageWarpIllum.bmp");
g.DrawImage( bmp1, 0, 0 );
g.DrawImage( bmp2, 1, 1 );
long na = DateTime.Now.TimeOfDay.Ticks;;
na=na-voor;
textBoxTijd.Text=na.ToString()+" ticks";
The textBoxTijd only gives something like this: 2000 000 ticks or 3000 000
ticks, but never something like 3333 325, what's the problem? I also put
more operations between the measuring, but always some stuff like that: 2000
000 33 000 000, help me pleae
I debug on a Win CE 4.2
THX 4 4910
Jeroen CEuppens <je*************@barco.com> wrote: Hi, I want to measure a time (in ticks) between a couple of operations, with these code:
long voor = DateTime.Now.TimeOfDay.Ticks;
bmp1 = new Bitmap(@"\Network\im\ImageWeftIllum.bmp");
bmp2 = new Bitmap(@"\Network\im\ImageWarpIllum.bmp");
g.DrawImage( bmp1, 0, 0 );
g.DrawImage( bmp2, 1, 1 );
long na = DateTime.Now.TimeOfDay.Ticks;;
na=na-voor;
textBoxTijd.Text=na.ToString()+" ticks";
Firstly, I'd just use:
DateTime voor = DateTime.Now;
....
DateTime na = DateTime.Now;
TimeSpan diff = na-voor;
and then use the results of that. However...
The textBoxTijd only gives something like this: 2000 000 ticks or 3000 000 ticks, but never something like 3333 325, what's the problem? I also put more operations between the measuring, but always some stuff like that: 2000 000 33 000 000, help me pleae
I debug on a Win CE 4.2
The Pocket PC timer is very coarse - ie it doesn't update very often. I
suspect you would still see multiples of ticks even on a desktop
system, but with a Pocket PC it'll be more pronounced.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
If you need high precision timing i recommend you use the
QueryPerformanceCounter and QueryPerformanceFrequency that is in
kernel32.dll
Just wrap these (there is a KB article on MSDN for this) and call them.
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP***********************@msnews.microsoft.co m... Jeroen CEuppens <je*************@barco.com> wrote: Hi, I want to measure a time (in ticks) between a couple of operations,
with these code:
long voor = DateTime.Now.TimeOfDay.Ticks;
bmp1 = new Bitmap(@"\Network\im\ImageWeftIllum.bmp");
bmp2 = new Bitmap(@"\Network\im\ImageWarpIllum.bmp");
g.DrawImage( bmp1, 0, 0 );
g.DrawImage( bmp2, 1, 1 );
long na = DateTime.Now.TimeOfDay.Ticks;;
na=na-voor;
textBoxTijd.Text=na.ToString()+" ticks";
Firstly, I'd just use:
DateTime voor = DateTime.Now;
...
DateTime na = DateTime.Now;
TimeSpan diff = na-voor;
and then use the results of that. However...
The textBoxTijd only gives something like this: 2000 000 ticks or 3000
000 ticks, but never something like 3333 325, what's the problem? I also put more operations between the measuring, but always some stuff like that:
2000 000 33 000 000, help me pleae
I debug on a Win CE 4.2
The Pocket PC timer is very coarse - ie it doesn't update very often. I suspect you would still see multiples of ticks even on a desktop system, but with a Pocket PC it'll be more pronounced.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
Thx for info,
The Pocket PC timer is very coarse , idd, i check it, windows xp give me 33
ms or 33,750, but CE don't
I use this also, same result, nog good vision of the milliseconds :(
DateTime voor = DateTime.Now; ...
DateTime na = DateTime.Now;
TimeSpan diff = na-voor;
I hope the PerformanceCounter works to counts time for operations or do you
know any better way to counts time?
Thx
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP***********************@msnews.microsoft.co m... Jeroen CEuppens <je*************@barco.com> wrote: Hi, I want to measure a time (in ticks) between a couple of operations,
with these code:
long voor = DateTime.Now.TimeOfDay.Ticks;
bmp1 = new Bitmap(@"\Network\im\ImageWeftIllum.bmp");
bmp2 = new Bitmap(@"\Network\im\ImageWarpIllum.bmp");
g.DrawImage( bmp1, 0, 0 );
g.DrawImage( bmp2, 1, 1 );
long na = DateTime.Now.TimeOfDay.Ticks;;
na=na-voor;
textBoxTijd.Text=na.ToString()+" ticks";
Firstly, I'd just use:
DateTime voor = DateTime.Now;
...
DateTime na = DateTime.Now;
TimeSpan diff = na-voor;
and then use the results of that. However...
The textBoxTijd only gives something like this: 2000 000 ticks or 3000
000 ticks, but never something like 3333 325, what's the problem? I also put more operations between the measuring, but always some stuff like that:
2000 000 33 000 000, help me pleae
I debug on a Win CE 4.2
The Pocket PC timer is very coarse - ie it doesn't update very often. I suspect you would still see multiples of ticks even on a desktop system, but with a Pocket PC it'll be more pronounced.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
Jeroen CEuppens <je*************@barco.com> wrote: I hope the PerformanceCounter works to counts time for operations or do you know any better way to counts time?
I don't, I'm afraid - I don't know whether that PerformanceCounter
exists on Pocket PC. I suggest you ask again in the compactframework
newsgroup - you may well get better answers.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: pete |
last post by:
I need to take many TimeSpan values and find their
average. I know you can Add the many values together, but
how do you then divide that result by the count of values
that you had? Once I have...
|
by: KK |
last post by:
Hi
I was testing a quicksort algorithm.
long startTime = DateTime.Now.Ticks; //ticks before sorting begins
q_sort( 0, mElements.Length-1 );
TimeSpan tp =new TimeSpan((DateTime.Now.Ticks -...
|
by: Ivan A. |
last post by:
Hi!
Why I can't serialize TimeSpan structure with XmlSerializer? This is what I
do:
using System;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
|
by: Russ Green |
last post by:
How does this:
public TimeSpan Timeout
{
get { return timeout; }
set
{
timeout = value;
if(timeout < licenseTimeout)
licenseTimeout = timeout;
}
|
by: ucasesoftware |
last post by:
i translate a C# funtion to VB.NET and i have this :
Shared Function isAllDay(ByVal ap As Appointment) As Boolean
Return ap.DateBegin.TimeOfDay = TimeSpan.Zero AndAlso
ap.DateEnd.TimeOfDay =...
|
by: Jeff Jarrell |
last post by:
I am unable to add up two timespans as created by the
System.Diagnostics.Stopwatch class.
Each stopwatch should be about two seconds and is appears ok, but when I try
and add them up it goes to...
|
by: Vibhesh |
last post by:
I am facing problem with TimeSpan structure when DirectX is used.
Following is the sample code that causes the problem:
...
|
by: kellygreer1 |
last post by:
I haven't worked with the TimeSpan object before. So bare with me if
this seems like a newb question. But if I wanted to know how many
days from the current date until 2/4/2008. I have written...
|
by: Israel |
last post by:
I've run across many situations where I want to store the time delta
as a TimeSpan (e.g. sampling interval) and then I want to skip every
3rd sample so I want to multiple the delta by the int 3 but...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| | |