Add to Google

X86 Clocking

Pages: 1, 2, 3, 4
free web hosting

Read Latest Entries..: (Post #32) by osknockout on Apr 14 2005, 09:49 PM. (Line Breaks Removed)
alright, I get it. I also happened to have an odd time (didn't get time except to do the army system here) I see, more efficient system than I thought, but I can't exactly figure it out. Oh well, see you are then vizskywalker.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > CONTRIBUTE > Computers > Programming Languages > Assembler and Delphi

X86 Clocking

osknockout
I know this is almost a fundamental topic, but does anyone know a good instruction clocking method in x86 asm? I know there's a million programs which do that, but any source code?

Reply

lordofthecynics
QUOTE(osknockout @ Feb 14 2005, 03:04 PM)
I know this is almost a fundamental topic, but does anyone know a good instruction clocking method in x86 asm? I know there's a million programs which do that, but any source code?
*



I saw this post and thought it was about OVERclocking CPU chips. Whooops. And no, I don't know anything about clocking in x86 ASM. What is that, anyway? I'm kinda curious now. Is that like, Linux-related, or something? If it is, I'm pretty much lost on Linux, so I'm no help AT ALL. Sorry.

Reply

vizskywalker
I'll reply to both posts in this topic. To the first one, I don't know of any programs that do it, but I know many sites that list the CPU clocks that each instruction takes one various chips ranging from 2 or 386 to pentium and sometimes beyond. This is one of the better ones: http://www.packetstormsecurity.com/program...bly/opcode.html. You can pair this with the intel instruction set opcode reference found here, http://developer.intel.com/design/pentium/...tion%20set', to figure out how long each instruction will take. I can also try and write one for you but my best guess as to when it would be done is at least a year if my friend will help me. I know I once had a program that recorded the number of clock ticks a program took but can't for the life of me remember what it was, sorry.

For the second post, x86 asm (properly known as x86 assembly) is the most basic mnemonic set for machine code instructions (the ones and zeros a computer actually uses). The x86 implies that it is run on chips that support the intel 86 architecture which means any of their chips whose real names end in 86. A pentium, for example, is really an 80586, while the first of the set is an 8086. AMD chips also support this architecture, while Apple computers do not. Each instruction requires a certain amount of clock ticks to be carried out. A clock tick is like the second hand of the clock jumping from one second to two, then three, etc. Every time it jumps, it makes a clock tick. But on computers clock ticks occur several times a second, a 1 Mhz computer theoretically undergoes 1048576 clock ticks per second. It has nothing to do with the operating system the computer is running on.

 

 

 


Reply

osknockout
QUOTE
To the first one, I don't know of any programs that do it, but I know many sites that list the CPU clocks that each instruction takes one various chips ranging from 2 or 386 to pentium and sometimes beyond.
Yeah, I know. If you happen to know ones for the Pentium II+ do tell. Ah well, how is it done directly anyway? I mean there's no way to get the clock cycle amount without executing instructions to count it (unless you're somehow overriding the PCI with some crazy code). But, thanks for your help.
QUOTE
What is that, anyway? I'm kinda curious now. Is that like, Linux-related, or something?
Well good. Most of the code I see nowadays is with Linux drivers esp. those using a nice _inline in C++. But like vizskywalker said, it's os independent. Try to learn x86 asm if you can and join us biggrin.gif

Reply

vizskywalker
The clock ticks can be determined by looking at assembler code, and making use of the page that shows clock ticks to count the number of ticks each instruction takes. The Intel manual is to determine how many bytes each instruction will be if necessary. And I will keep my eyes out for a Pentium II+ listing and/or a program to generate the clock cycles.

Reply

osknockout
QUOTE
The clock ticks can be determined by looking at assembler code, and making use of the page that shows clock ticks to count the number of ticks each instruction takes. The Intel manual is to determine how many bytes each instruction will be if necessary. And I will keep my eyes out for a Pentium II+ listing and/or a program to generate the clock cycles.
I know, I know. I was asking how THEY measured it. Thanks for the links by the way. biggrin.gif

Reply

vizskywalker
If by they you mean the people who arrive at the clock ticks then it works like this. A basic computer, if it starts with a blank processor does something like this:
Tick # Action 1 Action 2
1 Load Instruction #1 N/A
2 Load Data for Instruction #1 Preread Instruction #2
3 Perform Instruction #1 Preread Data for Instruction #2
4 Perform Instruction #2 Preread Instruction #3
5 Load Data for Instruction #3 Preread Instruction #4
6 Perform Instruction #3 Preread Data for Instruction #4
etc.

Each step in either action one or action two that an instruction requires adds one to the tick count that instruction requires. Some instructions don't require data or require two clock ticks to get the data or perform the operation. If a preread needs to access data that is being accessed by the current instruction, it must wait until that instruction finishes. That is why optimization tutorials say to not write code like this:

mov ax, 0a000h
mov es, ax
mov si, 0000h

but like this:

mov ax, 0a000h
mov si, 0000h
mov es, ax

Reply

osknockout
QUOTE
Each step in either action one or action two that an instruction requires adds one to the tick count that instruction requires. Some instructions don't require data or require two clock ticks to get the data or perform the operation. If a preread needs to access data that is being accessed by the current instruction, it must wait until that instruction finishes.
All right, that makes sense. I have read AoA by the way, so I'm familiar with your load information - I just didn't realize they did the same thing.

By the way... isn't it mov ax, a000h instead of mov ax, 0a000h? Technicalities smile.gif

Reply

lordofthecynics
Oh, ASSEMBLY, ok. The last time I tried anything with that was when I was in the PC lab in college and the prog I was using crashed, and Win2000 asked if I wanted to "debug it," so I thought, why not? So I clicked OK and it brought up VisualBasic, then gave me another error, and closed. WTF. So yeah. I let it go and forgot about it. Too confusing.

Reply

vizskywalker
As far as mov ax, 0a000h goes, adding leading zeros never affects data in most compilers. I use TASM (well, I'm writing my own but that's what I use now), and TASM treats anything beginning with a letter as a symbol for a variable. So I have to preface all hex numbers beginning with a letter with 0. And If you want to learn assembly, lordofthecynics, there are plenty of good tutorials out there, such as Art of Assembly. And I'm planning on putting some assembly tutorials in the Tutorial section of this forum soon.

Reply

Latest Entries

osknockout
laugh.gif alright, I get it. I also happened to have an odd time (didn't get time except to do the army system here) I see, more efficient system than I thought, but I can't exactly figure it out. Oh well, see you are then vizskywalker.

Reply

vizskywalker
Couple things. One, sorry my tutorials haven't come out in a while. I got hosting at astahost, then made a mod there, so things for me have been hectic. But I'm going to start the tuts again. I'm making the tuts there to gain credits, so a new one for you won't be around for a little bit, I'll let you know. Two, I know what a partial tangent is. Intel uses a taylor series for arctan which only works for the interval (a-1, a+1). Thus, it is only part of the arctan function. But by changing a, Intel can provide the arctan of any real number.

Reply

osknockout
laugh.gif just to clear things up, what I meant by the FPU stack's 80 bits was that I was questioning if it's 80 bits WIDE for each entry. Alright, thanks. That's inspiration to start learning protected mode. Do tell when your tutorial's posted because I don't travel there much biggrin.gif

Reply

vizskywalker
I have absolutely no idea why 1 is pushed onto the FPU stack, we should ask intel. And it's really cool that we are number 1, I've always liked being number 1. But for the hard disk access, since I assume you are still using real mode (you earlier stated that you hadn't dabbled in protected mode), I would simply let the Interrupts take care of it. There is a way, and I haven't needed the hard drive for anything other than opening text files (which it is easiest to use DOS interrupts for), to set up the hard drive with a task and then continue processing until the task is completed, and then finish up with that task using interrupts. If you enter protected mode, I would let the PIC handle it, because the PIC sends an interrupt when the hard drive finishes, so just create an interrupt to handle that. That would be the most efficient for an OS, but the harder method. And I apologize for not placing a tutorial up on Sunday, I have been really busy, so I'm working on it now, and I'm going to post at least one other this week, and, if I have time, a special VGA intro.

Reply

osknockout
QUOTE
It seems like partial tangent is the full blown tangent function. Partial tangent takes the tangent of the value in ST0 with a domain of -2 x 10 ^63 to 2 x 10^63. It also pushes 1 onto the FPU stack. I see no reason to call it a partial tangent, but whatever floats there boats.

That's quite odd. The FPU stack's 80 bits right? Alright, so rounding standards are easier to edit than I believed... thought I'd need to make my own process. I don't get why it pushes 1 to the FPU stack though. By the way, if you search google for 'x86 clocking' this thread is #1.

Um... thanks canute24, that was a nice reminder of what I learned back in my printf("Hello World!\n"); days. However, I'm trying to create the finest operating system that I can, so every cycle matters.

Hey, I'm trying to optimize reading and writing to the hard disk. should I first get the processor type & speed, and hard disk RPM from BIOS (last one I'm not sure about) and wait for the computed avg. access time and then check the hard disk status, or should I just let the PIC handle this one?

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Pages: 1, 2, 3, 4
Recent Queries:-
  1. x86 clocking - 269.55 hr back. (1)
  2. x86 tick count instruction - 495.80 hr back. (1)
  3. clocking in bios - 946.18 hr back. (1)
  4. x86 clock ticks - 1099.30 hr back. (1)
  5. opcode ticks x86 - 1156.24 hr back. (1)
  6. ticks per second x86 - 1169.58 hr back. (1)
  7. "get time" in x86 asm - 1473.87 hr back. (1)
  8. x86 opcodes "c " - 1626.46 hr back. (2)
  9. x86 clock-cycles - 1959.73 hr back. (1)
Similar Topics

Keywords : X86 Clocking





    Looking for x86, clocking






*SIMILAR VIDEOS*
Searching Video's for x86, clocking

*MORE FROM TRAP17.COM*
advertisement



X86 Clocking