Hi,
I am searching one time function under windows2000
with Visual C++ environment. Is there function available
like gethrtime() in unix? Thx.
#include <sys/time.h>
main()
{
hrtime_t start, end;
int i, iters = 100;
start = gethrtime();
for (i = 0; i < iters; i++)
getpid();
end = gethrtime();
printf("Avg getpid() time = %lld nsec\n", (end - start) / iters);
}
RGS,
Wavelet 8 11172
wavelet wrote: I am searching one time function under windows2000 with Visual C++ environment. Is there function available like gethrtime() in unix? Thx. [..]
And the reason you're asking here is...?
If you need a time function under Windows, ask in a newsgroup
for programming Windows.
"wavelet" <li***@lucent.c om> wrote in message
news:dc******** @netnews.net.lu cent.com... Hi,
I am searching one time function under windows2000 with Visual C++ environment. Is there function available like gethrtime() in unix? Thx.
#include <sys/time.h>
main() { hrtime_t start, end; int i, iters = 100;
start = gethrtime(); for (i = 0; i < iters; i++) getpid(); end = gethrtime(); printf("Avg getpid() time = %lld nsec\n", (end - start) / iters); }
RGS, Wavelet
Hi wavellet,
Windows has a millisecond timer available if thats good enough It returns
a long. Its in <windows.h>
usage is something like
long tim;
tim = GetTickCount();
// put what you want to time in here
tim = GetTickCount() - tim;
}
wavelet sade: Hi,
I am searching one time function under windows2000 with Visual C++ environment. Is there function available like gethrtime() in unix? Thx.
QueryPerformanc eCounter
QueryPerformanc eFrequency
Tobias
--
IMPORTANT: The contents of this email and attachments are confidential
and may be subject to legal privilege and/or protected by copyright.
Copying or communicating any part of it to others is prohibited and may
be unlawful. Windows has a millisecond timer available if thats good enough It returns a long. Its in <windows.h> usage is something like long tim; tim = GetTickCount(); // put what you want to time in here tim = GetTickCount() - tim;
One caveat here. The millsecond timers in Windows do not update every
millisecond. For windows since NT 3.1 the millisecond timers update
roughly every 16 milliseconds. The 95 famliy updates roughly every 55
milliseconds. ve*********@hot mail.com <ve*********@ho tmail.com> wrote: One caveat here. The millsecond timers in Windows do not update every millisecond. For windows since NT 3.1 the millisecond timers update roughly every 16 milliseconds. The 95 famliy updates roughly every 55 milliseconds.
You might want to look at http://groups.google.ch/group/comp.l...c413f34baf1a7f
What is the point you were trying to make?
Sorry if that was unclear:
I just wanted to add that the Windows millisecond timer tick depends on
your hardware (whether it's 10 ms or roughly 16 ms).
You can even vary it on certain hardware types.
Maett
> I am searching one time function under windows2000 with Visual C++ environment. Is there function available like gethrtime() in unix? Thx.
Try these:
QueryPerformanc eCounter();
or
GetThreadTimes( );
or the ultimate (80x86 only):
__asm __emit 0fh
__asm __emit 031h
And 64 bit result is in EDX:EAX. The unit is one cpu cycle.
cheers,
M. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Uwe Mayer |
last post by:
Hi,
I need a function returning a time value with a higher resolution that the
standard 1sec unix timestamp. I found the clock() function in the time
module, but that seems to return the same value (in the Python shell) each
time I call it (Debian Linux speaking here).
Any ideas?
Thanks,
|
by: Michael Evans |
last post by:
First, we rely on a stable update rate so that our physics and dynamics
calculations and integrations are based on a known interval and
therefore are true-to-life.
Second, the graphics positions in our image generators are updated by
this dynamics application, and we need to update them at the rate they
are being refreshed so that we don't get any stutter from frames being
used twice or having to be thrown out.
Without microsecond...
|
by: moondaddy |
last post by:
I have an application where I need to print images where the size has been
reduced down to a fraction of a thumbnail and the original image is several
inches high and wide. We're using a special printing process where the dpi
is 2000x2000 or higher, therefore, when I reduce the size of the image, I
don't want to loose any pixels. In other words, if the image is 200 px by
200 px and I reduce the size down to 1/4 inch, I want the printer to...
|
by: Dmitri Sologoubenko |
last post by:
Hi, guys!
I need a C++ class (Linux/POSIX/GNU C++), which can be started and stopped,
and calls a virtual callback instance method (e.g. "expired()") when a
given time has elapsed. High resolution means that expire time should be
measured in microseconds, or at least in milliseconds.
I had a look on Gnu C <sys/time.h>'s functions getitimer and setitimer, but
these all use a signal (SIGALRM) to notify expiration, and I don't know the...
|
by: John |
last post by:
The table below shows the execution time for this code snippet as
measured by the unix command `time':
for i in range(1000):
time.sleep(inter)
inter execution time ideal
0 0.02 s 0 s
1e-4 4.29 s 0.1 s
1e-3 4.02 s 1 s
| |
by: Victor Kryukov |
last post by:
Hello list,
our team is going to rewrite our existing web-site, which has a lot of
dynamic content and was quickly prototyped some time ago.
Today, as we get better idea of what we need, we're going to re-write
everything from scratch. Python is an obvious candidate for our team:
everybody knows it, everybody likes it, it has *real* objects, nice
clean syntax etc.
|
by: Jon Slaughter |
last post by:
Is it possible to have a synchronous thread... actually a timer that is
beyond the 1khz/1ms resolution that .NET offers?
I want to poll the parallel port at rates beyond 1khz... about 10 to 100
times that rate if possible.
Essnetially I want to monitor the parallel port for data and display it but
I need a fast but somewhat precise way of knowing the sample rate.
Doing some tests on just a simple thread I can get speeds at around...
|
by: Charles Zhang |
last post by:
Sleep() function Sleep at lease 1 millisecond, there is a way to make a
thread to sleep less than a millisecond? One way I know of is using
performance counter which is not really sleep ( loop and check again and
again and uses CPU time).
Thanks
Charles Zhang
|
by: Usenet User |
last post by:
..NET 1.1/2.0
I have a need to display high-resolution scrollable images in a .NET
application (Windows Forms). One well known solution is to create a
Panel with AutoScroll set to "true" and then add a PictureBox or
another Panel to it, that is used to display the image.
The above approach works, however, to my surprise, .NET GDI+-based
graphics are not really hi-res friendly.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |