Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Visual C++ equivalent of RDTSC code #20

Open
solodon4 opened this issue Jun 4, 2015 · 3 comments
Open

Add Visual C++ equivalent of RDTSC code #20

solodon4 opened this issue Jun 4, 2015 · 3 comments

Comments

@solodon4
Copy link
Owner

solodon4 commented Jun 4, 2015

Windows headers are incompatible with /Za flag, which disables language extensions. Windows header right now seems to only be used for timing purposes, so we can include it conditionally when extensions are enabled only. Enabling them though makes us rely on the worst timer available.

Write equivalent of RDTSC access code we now have for GCC in Microsoft assembly.

@mwinterb
Copy link

mwinterb commented Jun 6, 2016

Microsoft provides an intrinsic to access RDTSC, which is nice because they don't support inline assembly in amd64 code. However, it seems like the implementation of get_frequency would still "require" including <windows.h> in order to get Sleep() to pause execution for 1/10th of a second.

Given your statement "Enabling them though makes us rely on the worst timer available."
Is the goal to use RDTSC always or to only use RDTSC if Microsoft extensions are disabled?

@solodon4
Copy link
Owner Author

solodon4 commented Jun 9, 2016

The main idea was to be able to build with /Za (disable Microsoft extensions), the actual task was what prevented us from doing this.

@jrfl
Copy link

jrfl commented Oct 25, 2016

If you still need this, here you go.
It is not attached because github says "We don't support that file type" when I drag and drop the file.

`.686P
.XMM
.model flat

;; ml /c rdtscget.asm
;; produces rdtscget.obj
;; link rdtscget.obj with the rest of your code
;; C function prototype
;; unsigned long long _stdcall rdtsc(void);
PUBLIC _rdtsc@0
_TEXT SEGMENT

_rdtsc@0 PROC
rdtsc
ret
_rdtsc@0 ENDP

_TEXT ENDS
END
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants