?
Solved

Execution time of assembly code

Posted on 2008-06-11
2
Medium Priority
?
936 Views
Last Modified: 2012-06-22
Hi,
for some reason I need the time a piece of assembly code should need.
In the good old 8086 time the Intel Manual told how much time a single instruction need.

I have tried to read the Intel documentation to find the timing for the instructions of the instruction set But I was not able to find it.
Could someone can tell me how I can determine the time a pice of code should use?

Here is the code I want the timing for.
      mov      DWORD PTR _k$[ebp], 1000000            ; 000f4240H
      jmp      SHORT CheckCondition
Next:
      mov      eax, DWORD PTR _k$[ebp]
      sub      eax, 1
      mov      DWORD PTR _k$[ebp], eax
CheckCondition:
      cmp      DWORD PTR _k$[ebp], 0
      jle      SHORT LoopEnd
      jmp      SHORT Next
LoopEnd:

But I need an instruction How the timing can be calculated.
It is machine dependent and must run on different Intel CPU's

Thanks for the Help

Regards
Norbert
0
Comment
Question by:Norbert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 2000 total points
ID: 21767262
>> Could someone can tell me how I can determine the time a pice of code should use?

That is VERY complicated, if not impossible, since today's CPU's have a lot of performance optimizations in them (pipelines, superscalar CPU's, instruction caches, branch prediction, speculative execution, out-of-order execution, etc.), so the timing will highly depend on the CPU, but also on the current state of the CPU (ie. based on the instructions before and after the instruction to be measured).


If you are just looking for the instruction execution latencies, you can find those in the technical documents. For example, for the AMD64 processors, you have these documents :

    "Software Optimization Guide for AMD64 Processors" (http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25112.PDF) -> appendix C lists the instruction latencies

    "AMD64 Architecture Programmer's Manual Volume 3: General-Purpose and System Instructions" (http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/24594.pdf) -> gives more detailed information about the instructions

I gave that CPU as an example, because that's the one I'm using ;) Similar documents can be found for other CPU's, and I'm sure Intel also has these kind of documents with this information.
0
 
LVL 3

Author Comment

by:Norbert
ID: 21814013
The good old times are gone. so it is no more possible to determine exact what time is theoretical used for a code sequence. But you gave me some hints where I can look and I Found also some answers

Thanks
Regards
Norbert
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introducing Priority Question, our latest feature.
We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question