Solved

Execution time of assembly code

Posted on 2008-06-11
2
920 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 500 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
Binary Bomb: Phase 5 3 1,681
Dword and Qword in PHP 5 1,010
Session arrays 10 375
SSIS - Mixed Mode Assembly Error 4 10
Facebook has became the #1 social media platform. People share many funny videos there, yet you don't know how to download them? Now you can download Videos from Facebook in just 3 simple steps.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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