rdtsc 1.1.1 → 1.1.3
raw patch · 6 files changed
+10/−94 lines, 6 filesdep ~basenew-uploader
Dependency ranges changed: base
Files
- README +0/−36
- System/CPUTime/Rdtsc.hs +2/−2
- rdtsc.cabal +8/−7
- tests/Makefile +0/−22
- tests/TestRdtsc.hs +0/−8
- tests/test_rdtsc.c +0/−19
− README
@@ -1,36 +0,0 @@- -*-outline-*--* README file for Rdtsc binding--This small Cabal package provides a Haskell binding to the "rdtsc"-machine instruction on modern IA-32 processors. This instruction can-be used to read the number of cycles since processor startup and gives-very accurate timing information.--** Usage--Use-- runghc Setup.hs configure- runghc Setup.hs build- runghc Setup.hs install--for building and installing system-wide, or-- runghc Setup.hs configure --prefix=$HOME/haskell-modules- runghc Setup.hs build- runghc Setup.hs install --user--for building and installing in directory $HOME/haskell-modules.--Just import module "System.CPUTime.Rdtsc" into your Haskell file and use-- ghc --make FILENAME--to compile your program.--The "tests" directory contains a small test program for the module and-demonstrates its usage. There is also a C version for this test-program, to test the overheads of Haskell's FFI.--Happy Haskell hacking,- Martin
System/CPUTime/Rdtsc.hs view
@@ -1,10 +1,10 @@ -------------------------------------------------------------------------- -- | -- Module: System.CPUTime.Rdtsc--- Copyright: (c) 2006-2007 Martin Grabmueller+-- Copyright: (c) 2006-2007,2010 Martin Grabmueller -- License: GPL -- --- Maintainer: magr@cs.tu-berlin.de+-- Maintainer: martin@grabmueller.de -- Stability: provisional -- Portability: non-portable (requires IA-32 processor and GHC) --
rdtsc.cabal view
@@ -1,11 +1,12 @@ Name: rdtsc-Version: 1.1.1+Build-type: Simple+Version: 1.1.3 License: GPL License-file: COPYING-Author: Martin Grabmueller <magr@cs.tu-berlin.de>-Maintainer: magr@cs.tu-berlin.de-Homepage: http://uebb.cs.tu-berlin.de/~magr/projects/rdtsc/doc/-Category: System+Author: Martin Grabmueller <martin@grabmueller.de>+Maintainer: martin@grabmueller.de+Homepage: http://code.haskell.org/rdtsc+Category: Foreign binding Synopsis: Binding for the rdtsc machine instruction Description: This module provides the function 'rdtsc' for accessing the 'rdtsc' machine register on modern IA-32 processors. This is@@ -20,10 +21,10 @@ call this function twice and to compute the difference, whereas in C the overhead is only about 88 cycles. Stability: Experimental-Build-depends: base+Build-depends: base >= 4 && < 5 Exposed-Modules: System.CPUTime.Rdtsc Extensions: ForeignFunctionInterface C-sources: cbits/rdtsc.c Include-dirs: cbits Install-includes: rdtsc.h-ghc-options: -O -Wall -Werror+ghc-options: -Wall
− tests/Makefile
@@ -1,22 +0,0 @@-GHC=ghc-GHCFLAGS=-O -fglasgow-exts -i../..--CC=gcc-CFLAGS=-O2--all: rdtsc_haskell rdtsc_c--rdtsc_haskell: TestRdtsc.hs- $(GHC) $(GHCFLAGS) --make -o $@ $<--rdtsc_c: test_rdtsc.c rdtsc.o- $(CC) $(CFLAGS) -o $@ -I../cbits test_rdtsc.c rdtsc.o--rdtsc.o: ../cbits/rdtsc.c ../cbits/rdtsc.h- $(CC) $(CFLAGS) -c -I../cbits $<--clean:- rm -f *.o *.hi--really-clean: clean- rm -f rdtsc_haskell rdtsc_c
− tests/TestRdtsc.hs
@@ -1,8 +0,0 @@-module Main where--import System.CPUTime.Rdtsc--main = do- t1 <- rdtsc- t2 <- rdtsc- putStrLn ("Cost of rdtsc (ffi call): " ++ show (t2 - t1))
− tests/test_rdtsc.c
@@ -1,19 +0,0 @@-#include <stdio.h>--#include "rdtsc.h"--int-main (int argc, char * argv[])-{- unsigned long long t1, t2;- int x;-- t1 = rdtsc();- t2 = rdtsc();- printf("Cost of rdtsc (function call): %lld\n", t2 - t1, x);-- rdtscll(t1);- rdtscll(t2);- printf("Cost of rdtsc (macro): %lld\n", t2 - t1);- return 0;-}