473,796 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to get the time in usec

Dear all,

I would like to get the time on how long to run a short segment of my
c program in usec under Windows platform using dev-c++. Is there any
method or function call to get it other than using clock()?

Thank you very much.

Regards,
Jacky
Nov 13 '05 #1
4 9882

"JackyMove" <mo**********@h otmail.com> wrote in message news:b9******** *************** ***@posting.goo gle.com...
Dear all,

I would like to get the time on how long to run a short segment of my
c program in usec under Windows platform using dev-c++. Is there any
method or function call to get it other than using clock()?

Thank you very much.

Regards,
Jacky


getrusage ()
http://www.mcsr.olemiss.edu/cgi-bin/man-cgi?getrusage
http://www.opengroup.org/onlinepubs/...getrusage.html

-------------------------------------------------------------------------------------
http://www.hgmp.mrc.ac.uk/cgi-bin/ma...opic=getrusage
<QUOTE>
ru_utime The total amount of time spent executing in user
mode. Time is given in seconds and microseconds.

ru_stime The total amount of time spent executing in system
mode. Time is given in seconds and microseconds.
</QUOTE>
-------------------------------------------------------------------------------------

--
=============== =============== =======
Alex Vinokur
mailto:al****@c onnect.to
http://mathforum.org/library/view/10978.html
=============== =============== =======

Nov 13 '05 #2
JackyMove wrote:
Dear all,

I would like to get the time on how long to run a short segment of my
c program in usec under Windows platform using dev-c++. Is there any
method or function call to get it other than using clock()?

Thank you very much.

Regards,
Jacky

clock() is the closest thing in standard C. I don't know what dev-c++ is,
but it's surely off topic. You could count CPU clock ticks. Look up rdtsc.
--
Tim Prince
Nov 13 '05 #3
mo**********@ho tmail.com (JackyMove) writes:
I would like to get the time on how long to run a short segment of my
c program in usec under Windows platform using dev-c++. Is there any
method or function call to get it other than using clock()?


Not in standard C, but I'm sure there are Windows-specific functions
that do what you want. Try a Windows-specific newsgroup.

--
Keith Thompson (The_Other_Keit h) ks*@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
Nov 13 '05 #4
In article <Dj************ *******@newssvr 21.news.prodigy .com>,
ti***********@x xxxsbcglobal.ne t says...
clock() is the closest thing in standard C. I don't know what dev-c++ is,
but it's surely off topic. You could count CPU clock ticks. Look up rdtsc.


Unfortunately, according to Intel there is no guarantee that rdtsc will
give you useful data on a SMP system, as the rdtsc result is not
synchronized between CPUs. If your process gets bumped to another CPU,
your results will be WAY off. This used to be good advice (if you didn't
mind not being portable off of some x86 CPUs), but with SMP systems
becoming increasingly common, it's horribly broken now. If you're using
a broken thread implementation (I.e. one which lets you pin a thread to a
physical CPU) then it might be useful for you, but only if the code gets
called from a single thread. For conventional processes, forget about it.

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
6190
by: point | last post by:
Hi... I have this format 2003-12-01 18:46:20.0 And would like it to be 01-12-2003 18:46:20 I know it can be done vis string cuts and explodes but ther's got to be a better way using time functions.... Any help would be appriciated..
0
1723
by: mcorrea | last post by:
There is any way to get the total load time of a page when you get an "IFRAME" on it? In all the tests, I got only the base page time without the "IFRAME" time.... <?php $bench = new phpCounter(); $bench->StartCouter(); $page = "<iframe class=......";
4
1780
by: simon | last post by:
Hi, I have a fairly complicated script that seems to load fairly fast. But that's because it is on my local server in the office and not on the main one, (and I am the only one on it). So I would like to run some tests, for example how long the pages take to load on average and what load it place on the server. Currently the pages load very fast indeed, but I suspect it is because I am the only one on the server and php/MySQL are not...
1
1955
by: AaronV | last post by:
Hello, I'd like to get the time it took a query to execute. Is there a PHP or MySQL function that would return the execute-time of the query into a useable format? Similar to the way Google displays how long a search takes. -Aaron
3
2055
by: sarmin kho | last post by:
Hi Pythoners, i have been using a lot of global variables in the python script i am working on. the global variables are shared and used by all various 'definitions' : def name (): global all globs... ..... my question is: 'is it safe using global variables in term of its execution time?
3
2253
by: Fuzzyman | last post by:
I want to parse some text and generate an output that is similar but not identical to the input. The string I produce will be of similar length to the input string - but a bit longer. I'm parsing character by character and adding the characters of the input string to the output until I come to ones I want to modify. This means creating a new string for every character (since strings are immutable) which seems very inneficient -...
1
1530
by: MyHaz | last post by:
What is the running time of conactination on character strings. i.e. >> joe="123" >> joe+="99999999999999999" is it Amortized Constant time? I don't think it would be O((number of chars)^2) but i really don't know.
1
2473
by: jisrar | last post by:
Hi, I have written two algorithms and need to be compare them in terms of how long each take. I have tried clock() before/after each algorithm but my CLOCKS_PER_SEC variable is defined as 1000 which only gives me accuracy upto 1 msec. I have alo tried time() but this is accurate upto 1 sec. I have tried _ftime() and accessed the msec part but again I am not sure if this is accurate. In some cases I am getting same sec/msec values before...
3
11324
by: youtoo | last post by:
It has been extensively discussed the time complexity (quadratic) of string concatenation (due to string's immutability). But what is: == the time complexity of string indexing? Is it constant? == the time complexity of string slicing? Is it O(K) with K the slice's length? How are strings stored in Python? As arrays? As linked lists?
0
9685
marktang
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...
0
9533
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10239
jinu1996
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...
0
9057
agi2029
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...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.