473,326 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Execution time

Ken
Hello

Anyone know of a site with tutorial on calculating the steps in program or
in a pseudo code:
Ex: for( int =0 ; i<n ; i++) so int=0 will be executed once / i<n will
be executed n times / and i++ will be executed n-1 times.

I need a deeper analysis, looking for the timing steps for a nested loops .

thanks

KEN
Jul 23 '05 #1
2 1671

"Ken" <le******@REMOVEsympatico.ca> wrote in message
news:%F********************@news20.bellglobal.com. ..
Hello

Anyone know of a site with tutorial on calculating the steps in program or
in a pseudo code:
Ex: for( int =0 ; i<n ; i++) so int=0 will be executed once / i<n
will be executed n times / and i++ will be executed n-1 times.

I need a deeper analysis, looking for the timing steps for a nested loops
.

thanks

KEN


Define "steps".

Programs are compiled into machine code, and the results may not be anything
like you expect. Some loops, for example, can be executed by loading up
specific registers, then executing a _single_ machine instruction!
Internally, there are obviously "steps" of some sort, based on the clock,
but they're not related to the original C++ code in any way like you've
described above.

When analyzing machine code (and the C++ code that generated it), it's
usually "machine cycles" (if I recall the term correctly) that are checked.
There are tables for the various chips which tell how many machine cycles
each op-code takes (sometimes with allowances made for different parameters
used with those op-codes). It's pretty complex stuff.

You seem to know what you're looking for as far as results. If such results
are meaningful to you, just keep up that line of thought and you be should
be able to work it out for yourself on paper. I don't know if there's any
tutorial on such things, though, since they don't really tell you anything
about the time a given machine will spend on a given problem.

Perhaps a google search for "programming time complexity calculation" (or
similar searches) might help?

-Howard


Jul 23 '05 #2
Ken wrote:
Hello

Anyone know of a site with tutorial on calculating the steps in program or
in a pseudo code:
Ex: for( int =0 ; i<n ; i++) so int=0 will be executed once / i<n will
be executed n times / and i++ will be executed n-1 times.

An optimizer usually sits between your source code and
the generated machine code. It can rearrange your loop
so that 'i' disappears completely, replace your entire
loop with one single instruction, and move random bits
of code out of the loop. It may even drop some bits of
code entirely. Which optimization passes you select to
run on your code causes major differences in the final
generated code.

Source code to machine language translation, if you're
using an optimizing compiler, isn't easily calculated.
You'll need to know much about the compiler before you
could even try guessing what code will be generated.

You can pretend your optimizer is turned off, then the
problem becomes understanding what your compiler would
generate from a particular bit of source. It should be
easier to examine the actual code generated.

It might be an interesting student exercise, but isn't
useful to analyse actual code. Try using a profiler on
the actual compiled code instead.
I need a deeper analysis, looking for the timing steps for a nested loops .


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #3

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

Similar topics

6
by: cournape | last post by:
Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to...
5
by: Johannes Lebek | last post by:
Hi there, lately, I experienced a strange thing on my DB2 V8.1 on Windows: Some queries took a very long time. A snapshot discovered the following: Number of executions = 47...
7
by: Tim Quon | last post by:
Hi Is there any function to get the current time so I can calculate the execution time of my code? What all is in the time.h and sys/times.h? Thanks Tim
38
by: vashwath | last post by:
Might be off topic but I don't know where to post this question.Hope some body clears my doubt. The coding standard of the project which I am working on say's not to use malloc.When I asked my...
3
by: iam980 | last post by:
Hello All. We have tested following SQL script from query analyzer: -- Script begin DECLARE @I int; SET @I = 1; WHILE @I < 10000000 BEGIN SET @I = @I + 1; END -- Script end
3
by: vashwath | last post by:
Hi all, I have written program for calculating the execution time of a function.Any critics (on the method of calculating execution time) are welcome. #include <stdio.h> #include <time.h>...
2
by: Ina Schmitz | last post by:
Hi NG, does IBM Universal Database 8.2 make any difference between actual and estimated execution plans like in SQL Server ("set showplan_all on" for estimated execution plan and "set statistics...
17
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also...
40
by: kavi | last post by:
Hello friends, Could any one tell the way of calculating the speed of c program execution?
6
by: Mikhail Kovalev | last post by:
I'm using set_time_limit() to set maximum execution time. Is there a way to check how much time is left at any time during the execution itself?
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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 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.