Skip to content

Instantly share code, notes, and snippets.

@tsuraan
tsuraan / Xorg.0.log
Created May 29, 2011 14:58
An Xorg debug log for mtrack
[2385620.743]
X.Org X Server 1.9.5
Release Date: 2011-03-17
[2385620.751] X Protocol Version 11, Revision 0
[2385620.754] Build Operating System: Linux 2.6.38.4 x86_64 Gentoo
[2385620.757] Current Operating System: Linux macbeth 2.6.38.4 #2 SMP PREEMPT Sun May 1 19:08:44 CDT 2011 x86_64
[2385620.759] Kernel command line: root=/dev/sda3
[2385620.762] Build Date: 13 May 2011 12:46:23AM
[2385620.765]
[2385620.767] Current version of pixman: 0.20.2
@tsuraan
tsuraan / Xorg.0.log
Created May 29, 2011 18:50
xorg log with IgnoreThumb and IgnorePalm set to False
[2399729.662]
X.Org X Server 1.9.5
Release Date: 2011-03-17
[2399729.665] X Protocol Version 11, Revision 0
[2399729.666] Build Operating System: Linux 2.6.38.4 x86_64 Gentoo
[2399729.667] Current Operating System: Linux macbeth 2.6.38.4 #2 SMP PREEMPT Sun May 1 19:08:44 CDT 2011 x86_64
[2399729.668] Kernel command line: root=/dev/sda3
[2399729.669] Build Date: 13 May 2011 12:46:23AM
[2399729.670]
[2399729.671] Current version of pixman: 0.20.2
{-# LANGUAGE BangPatterns #-}
import qualified Data.ByteString as BS
import Data.ByteString (ByteString)
import Data.Word
import System.IO
--import Criterion.Main
runBS :: Word32 -> ByteString -> Word32
runBS winlen bs =
snd $ {-# SCC "fold" #-} BS.foldl fn (0, 0) bs
Sun Jun 5 11:28 2011 Time and Allocation Profiling Report (Final)
BSIter +RTS -p -RTS
total time = 18.84 secs (942 ticks @ 20 ms)
total alloc = 5,251,323,856 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
fold Main 42.5 33.2
{-# LANGUAGE BangPatterns #-}
import qualified Data.ByteString as BS
import Data.ByteString (ByteString)
import Data.Word
import System.IO
--import Criterion.Main
runBS :: Word32 -> ByteString -> Word32
runBS winlen bs =
snd $ {-# SCC "fold" #-} BS.foldl fn (0 :: Int, 0) bs
Sun Jun 5 11:49 2011 Time and Allocation Profiling Report (Final)
BSIter +RTS -p -RTS
total time = 23.00 secs (1150 ticks @ 20 ms)
total alloc = 5,251,323,472 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
fold Main 44.2 33.2
10,429,347,888 bytes allocated in the heap
3,865,080 bytes copied during GC
16,798,864 bytes maximum residency (2 sample(s))
1,063,280 bytes maximum slop
18 MB total memory in use (0 MB lost due to fragmentation)
Generation 0: 19859 collections, 0 parallel, 0.28s, 0.30s elapsed
Generation 1: 2 collections, 0 parallel, 0.00s, 0.00s elapsed
INIT time 0.00s ( 0.00s elapsed)
import Data.Word
import Criterion.Main
fi :: Word8 -> Word32
fi = fromIntegral
main = defaultMain [ bgroup "words" [ bench "noconvert" $ nf id (0 :: Word32)
, bench "convert" $ nf fi 0 ]]
warming up
estimating clock resolution...
mean is 15.79065 us (40001 iterations)
found 1344 outliers among 39999 samples (3.4%)
1235 (3.1%) high severe
estimating cost of a clock call...
mean is 2.088917 us (49 iterations)
found 2 outliers among 49 samples (4.1%)
1 (2.0%) high mild
1 (2.0%) high severe
{-# LANGUAGE BangPatterns #-}
import Data.Digest.Adler32 (adler32)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import System.IO
import Data.Word
updateHash :: Word32 -> Word8 -> Word32 -> Word8 -> Word32
updateHash _winlen old8 !hash word8 = hash + (fromIntegral $ old8 + word8)
{- actual adler32 sliding window code goes here -}