├── masstree
├── stamp-h
├── .gitignore
├── AUTHORS
├── doc
│ ├── .gitignore
│ ├── patches.mp
│ ├── examples.mp
│ └── elemfig.sty
├── string_slice.cc
├── value_string.cc
├── checkpoint.cc
├── perfstat.hh
├── kvrandom.cc
├── kvproto.hh
├── misc.cc
├── kvstats.hh
├── mtIndexAPI.cc
├── LICENSE
├── mtcounters.hh
├── testrunner.hh
├── checkpoint.hh
├── timestamp.hh
├── kvio.hh
├── testrunner.cc
├── compiler.cc
├── GNUmakefile.in
├── GNUmakefile
├── str.cc
├── misc.hh
├── file.hh
└── file.cc
├── nohotspot-skiplist
├── .gitignore
├── libskiplist.so
├── atomic_ops
│ ├── AUTHORS
│ ├── README
│ ├── standard_ao_double_t.h
│ ├── test_and_set_t_is_char.h
│ ├── test_and_set_t_is_ao_t.h
│ ├── aligned_atomic_load_store.h
│ └── sparc.h
├── tm.h
├── background.h
├── common.h
├── ptst.h
├── nohotspot_ops.h
├── intset.h
├── lockfree.h
├── garbagecoll.h
├── Makefile
├── intset.cpp
├── skiplist.h
└── ptst.cpp
├── rotate-skiplist
├── .gitignore
├── libskiplist.a
├── libskiplist.so
├── atomic_ops
│ ├── AUTHORS
│ ├── README
│ ├── standard_ao_double_t.h
│ ├── test_and_set_t_is_char.h
│ ├── test_and_set_t_is_ao_t.h
│ ├── aligned_atomic_load_store.h
│ └── sparc.h
├── tm.h
├── background.h
├── ptst.h
├── common.h
├── nohotspot_ops.h
├── intset.h
├── lockfree.h
├── intset.cpp
├── Makefile
├── intset.c
├── garbagecoll.h
└── skiplist.h
├── workload_config.inp
├── pcm
├── .gitattributes
├── WinMSRDriver
│ └── Win7
│ │ ├── makefile
│ │ ├── mymake.bat
│ │ ├── sources
│ │ ├── msr.h
│ │ ├── MSR.inf
│ │ └── msrstruct.h
├── MacMSRDriver
│ ├── PcmMsr
│ │ ├── en.lproj
│ │ │ └── InfoPlist.strings
│ │ ├── PcmMsr-Prefix.pch
│ │ └── PcmMsr-Info.plist
│ ├── kextunload.sh
│ ├── PcmMsr.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcuserdata
│ │ │ │ ├── aiott.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ │ └── pjkerly.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcuserdata
│ │ │ ├── pjkerly.xcuserdatad
│ │ │ └── xcschemes
│ │ │ │ └── xcschememanagement.plist
│ │ │ └── aiott.xcuserdatad
│ │ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ ├── PcmMsr.xcscheme
│ │ │ └── PcmMsrLibrary.xcscheme
│ ├── kextload.sh
│ ├── Makefile
│ ├── MSRAccessorPublic.h
│ ├── MSRAccessor.h
│ ├── DriverInterface.h
│ ├── MSRKernel.h
│ └── PCIDriverInterface.h
├── KSysGuard HOWTO.docx
├── KSysGuard HOWTO.pdf
├── PCM-Service_Win
│ ├── app.ico
│ ├── resource.h
│ ├── PCM-Service.exe.config
│ ├── app.rc
│ └── PCMInstaller.cpp
├── PCM-MSR_Win
│ ├── pcm-msr-win.cpp
│ ├── stdafx.cpp
│ └── stdafx.h
├── PCM-TSX_Win
│ ├── pcm-tsx-win.cpp
│ ├── stdafx.cpp
│ └── stdafx.h
├── daemon
│ ├── .gitignore
│ ├── daemon
│ │ ├── test
│ │ │ ├── Makefile
│ │ │ └── main.cpp
│ │ ├── main.cpp
│ │ └── pcm.h
│ └── client
│ │ └── client.h
├── PCM-Core_Win
│ ├── pcm-core-win.cpp
│ ├── stdafx.cpp
│ └── stdafx.h
├── PCM-NUMA_Win
│ ├── pcm-numa-win.cpp
│ ├── stdafx.cpp
│ └── stdafx.h
├── PCM-PCIE_Win
│ ├── pcm-pcie-win.cpp
│ ├── stdafx.cpp
│ └── stdafx.h
├── PCM-Power_Win
│ ├── pcm-power-win.cpp
│ ├── stdafx.cpp
│ └── stdafx.h
├── PCM-Memory_Win
│ ├── pcm-memory-win.cpp
│ ├── stdafx.cpp
│ └── stdafx.h
├── TODO
├── .travis.yml
├── .gitignore
├── build_solution.bat
├── pcm.so
│ ├── Makefile
│ └── c_example.c
├── .bdsignore.all
├── readmem.sh
├── mutex.h
├── freegetopt
│ ├── ChangeLog
│ ├── LICENSE
│ ├── README
│ └── getopt.h
├── LICENSE
├── winpmem
│ └── winpmem.h
├── PCM_Win
│ ├── pcm.cpp
│ ├── stdafx.cpp
│ ├── stdafx.h
│ └── restrictDriverAccess.cpp
├── PCM-Lib_Win
│ ├── pcm-lib.cpp
│ ├── dllmain.cpp
│ └── pcm-lib.h
├── Makefile
├── winring0
│ └── OlsDef.h
└── client_bw.h
├── rotate-skiplist-cpp
├── .gitignore
├── Makefile
└── rotate-skiplist.cpp
├── .gitignore
├── microbench.h
├── generate_all_workloads.sh
├── BwTree
└── bwtree.cpp
├── README.md
├── run_all.sh
├── ARTOLC
├── N256.cpp
└── Tree.h
├── indexkey.h
└── Makefile
/masstree/stamp-h:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/.gitignore:
--------------------------------------------------------------------------------
1 | test
2 |
--------------------------------------------------------------------------------
/rotate-skiplist/.gitignore:
--------------------------------------------------------------------------------
1 | main
2 |
--------------------------------------------------------------------------------
/masstree/.gitignore:
--------------------------------------------------------------------------------
1 |
2 |
3 | .deps
4 |
--------------------------------------------------------------------------------
/workload_config.inp:
--------------------------------------------------------------------------------
1 | workloada
2 | randint
3 |
--------------------------------------------------------------------------------
/pcm/.gitattributes:
--------------------------------------------------------------------------------
1 | cpucounters.h export-subst
2 |
--------------------------------------------------------------------------------
/rotate-skiplist-cpp/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | *.o
3 | main
4 |
--------------------------------------------------------------------------------
/pcm/WinMSRDriver/Win7/makefile:
--------------------------------------------------------------------------------
1 | !INCLUDE $(NTMAKEENV)\makefile.def
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/pcm/KSysGuard HOWTO.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangziqi2016/index-microbench/HEAD/pcm/KSysGuard HOWTO.docx
--------------------------------------------------------------------------------
/pcm/KSysGuard HOWTO.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangziqi2016/index-microbench/HEAD/pcm/KSysGuard HOWTO.pdf
--------------------------------------------------------------------------------
/pcm/PCM-Service_Win/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangziqi2016/index-microbench/HEAD/pcm/PCM-Service_Win/app.ico
--------------------------------------------------------------------------------
/rotate-skiplist/libskiplist.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangziqi2016/index-microbench/HEAD/rotate-skiplist/libskiplist.a
--------------------------------------------------------------------------------
/rotate-skiplist/libskiplist.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangziqi2016/index-microbench/HEAD/rotate-skiplist/libskiplist.so
--------------------------------------------------------------------------------
/nohotspot-skiplist/libskiplist.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangziqi2016/index-microbench/HEAD/nohotspot-skiplist/libskiplist.so
--------------------------------------------------------------------------------
/pcm/PCM-Service_Win/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by app.rc
4 |
--------------------------------------------------------------------------------
/masstree/AUTHORS:
--------------------------------------------------------------------------------
1 | Eddie Kohler
2 | kohler@seas.harvard.edu
3 |
4 | Yandong Mao
5 | ydmao@csail.mit.edu
6 |
7 | Robert Morris
8 | rtm@csail.mit.edu
9 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr/PcmMsr-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'PcmMsr' target in the 'PcmMsr' project
3 | //
4 |
5 |
--------------------------------------------------------------------------------
/masstree/doc/.gitignore:
--------------------------------------------------------------------------------
1 | *.aux
2 | *.bbl
3 | *.blg
4 | *.dvi
5 | *.log
6 | *.mpx
7 | *_[0-9]*.eps
8 | *_[0-9]*.pdf
9 | !GNUmakefile
10 | mpxerr.tex
11 | spec.pdf
12 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/kextunload.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | kextunload /System/Library/Extensions/PcmMsrDriver.kext
4 | rm -rf /System/Library/Extensions/PcmMsrDriver.kext
5 |
--------------------------------------------------------------------------------
/pcm/PCM-MSR_Win/pcm-msr-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-msr-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-msr.cpp"
7 |
--------------------------------------------------------------------------------
/pcm/PCM-Service_Win/PCM-Service.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/pcm/PCM-TSX_Win/pcm-tsx-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-tsx-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-tsx.cpp"
7 |
--------------------------------------------------------------------------------
/pcm/daemon/.gitignore:
--------------------------------------------------------------------------------
1 | .project
2 | client/.project
3 | client/.cproject
4 | client/Debug/client
5 | daemon/.project
6 | daemon/.cproject
7 | daemon/Debug/daemon
8 | daemon/test/test
--------------------------------------------------------------------------------
/pcm/PCM-Core_Win/pcm-core-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-core-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-core.cpp"
7 |
--------------------------------------------------------------------------------
/pcm/PCM-NUMA_Win/pcm-numa-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-numa-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-numa.cpp"
7 |
--------------------------------------------------------------------------------
/pcm/PCM-PCIE_Win/pcm-pcie-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-pcie-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-pcie.cpp"
7 |
--------------------------------------------------------------------------------
/pcm/PCM-Power_Win/pcm-power-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-power-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-power.cpp"
7 |
--------------------------------------------------------------------------------
/pcm/PCM-Memory_Win/pcm-memory-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-memory-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-memory.cpp"
7 |
--------------------------------------------------------------------------------
/pcm/TODO:
--------------------------------------------------------------------------------
1 |
2 | TODO
3 |
4 | * Support non-zero invert and cmask fields for custom events
5 | * Remember and handle properly the PMU program mode globally on the box/system
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/rotate-skiplist/atomic_ops/AUTHORS:
--------------------------------------------------------------------------------
1 | Originally written by Hans Boehm, with some platform-dependent code
2 | imported from the Boehm-Demers-Weiser GC, where it was contributed
3 | by many others.
4 |
5 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/atomic_ops/AUTHORS:
--------------------------------------------------------------------------------
1 | Originally written by Hans Boehm, with some platform-dependent code
2 | imported from the Boehm-Demers-Weiser GC, where it was contributed
3 | by many others.
4 |
5 |
--------------------------------------------------------------------------------
/pcm/WinMSRDriver/Win7/mymake.bat:
--------------------------------------------------------------------------------
1 | set BUILD_PATH=
2 |
3 | rmdir /S /Q objfre_win7_amd64
4 | nmake
5 |
6 | rem chdir objfre_win7_amd64\amd64
7 | rem copy msr.sys c:\
8 | rem chdir ..
9 | rem chdir ..
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.bak
2 | *~
3 | *.a
4 | *.log
5 | *.o
6 | workload
7 | workload_string
8 | workloads
9 | result_*
10 | masstree/.deps/*.d
11 | *.cache
12 | YCSB
13 | *.status
14 | *.a
15 | emails_random.txt
16 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/atomic_ops/README:
--------------------------------------------------------------------------------
1 | This directory contains a stripped-down (support only gcc) version of libatomic_ops by Hans Boehm.
2 | The official release is available from http://www.hpl.hp.com/research/linux/atomic_ops/.
3 |
--------------------------------------------------------------------------------
/rotate-skiplist/atomic_ops/README:
--------------------------------------------------------------------------------
1 | This directory contains a stripped-down (support only gcc) version of libatomic_ops by Hans Boehm.
2 | The official release is available from http://www.hpl.hp.com/research/linux/atomic_ops/.
3 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/pcm/.travis.yml:
--------------------------------------------------------------------------------
1 | language: cpp
2 |
3 | dist: trusty
4 |
5 | script:
6 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cd MacMSRDriver && make kext library && cd ..; fi
7 | - make
8 |
9 | os:
10 | - linux
11 | - osx
12 |
13 | compiler:
14 | - gcc
15 | - clang
16 |
17 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr.xcodeproj/project.xcworkspace/xcuserdata/aiott.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangziqi2016/index-microbench/HEAD/pcm/MacMSRDriver/PcmMsr.xcodeproj/project.xcworkspace/xcuserdata/aiott.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/kextload.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cp -R build/Release/PcmMsrDriver.kext /tmp/.
4 | mv /tmp/PcmMsrDriver.kext /System/Library/Extensions
5 | chown -R root:wheel /System/Library/Extensions/PcmMsrDriver.kext
6 | kextload /System/Library/Extensions/PcmMsrDriver.kext
7 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr.xcodeproj/project.xcworkspace/xcuserdata/pjkerly.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangziqi2016/index-microbench/HEAD/pcm/MacMSRDriver/PcmMsr.xcodeproj/project.xcworkspace/xcuserdata/pjkerly.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/pcm/PCM-Core_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/pcm/PCM-MSR_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/pcm/PCM-Memory_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/pcm/PCM-NUMA_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/pcm/PCM-PCIE_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/pcm/PCM-Power_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/pcm/PCM-TSX_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/pcm/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | *.x
3 | *.d
4 | *.xml
5 | /.project
6 | *.XML
7 | *.htm
8 | *.html
9 | *.dll
10 | *.txt
11 | *.patch
12 | *.orig
13 | *.out
14 | *.log
15 | *.sys
16 | *.vxd
17 | *.exe
18 | *.tgz
19 | .metadata/
20 | *.sdf
21 | *.suo
22 | Debug
23 | Release
24 | Debug64
25 | Release64
26 | .metadata/
27 | html/
28 | latex/
29 |
--------------------------------------------------------------------------------
/pcm/build_solution.bat:
--------------------------------------------------------------------------------
1 |
2 | REM change path to your VCVARS.BAT
3 | CALL "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat"
4 | SET "PATH=C:\Program Files (x86)\MSBuild\14.0\Bin\amd64;%PATH%"
5 |
6 | msbuild pcm-all.sln /p:Configuration=Release /t:Clean,Build /m
7 |
8 | exit
9 |
10 |
11 |
--------------------------------------------------------------------------------
/pcm/WinMSRDriver/Win7/sources:
--------------------------------------------------------------------------------
1 | TARGETNAME=msr
2 | TARGETTYPE=DRIVER
3 | NTDDI_VERSION=NTDDI_WIN7
4 |
5 | MSC_WARNING_LEVEL=/W3 /WX
6 |
7 |
8 | INCLUDES=\
9 | $(DDK_INC_PATH);
10 |
11 | TARGETLIBS=\
12 | $(DDK_LIB_PATH)\ntoskrnl.lib
13 |
14 |
15 | SOURCES=msrmain.c
16 |
17 | PRECOMPILED_INCLUDE=msr.h
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/pcm/daemon/daemon/test/Makefile:
--------------------------------------------------------------------------------
1 | CC=g++
2 | CFLAGS=-c -Wall -std=c++11
3 | LDFLAGS=
4 | SOURCES=main.cpp
5 | OBJECTS=$(SOURCES:.cpp=.o)
6 | EXECUTABLE=test
7 | RM=rm
8 |
9 | all: $(SOURCES) $(EXECUTABLE)
10 |
11 | $(EXECUTABLE): $(OBJECTS)
12 | $(CC) $(LDFLAGS) $(OBJECTS) -o $@
13 |
14 | .cpp.o:
15 | $(CC) $(CFLAGS) $< -o $@
16 |
17 | clean:
18 | -$(RM) $(OBJECTS) $(EXECUTABLE)
19 | -@echo ' '
--------------------------------------------------------------------------------
/rotate-skiplist-cpp/Makefile:
--------------------------------------------------------------------------------
1 |
2 | # This is the basic set of compiler flags
3 | # We also add more for different options
4 | CXX_FLAGS=-std=c++11 -pthread -Wall -Wextra
5 |
6 | ifdef DEBUG
7 | CXX_FLAGS += -O1 -g
8 | else
9 | CXX_FLAGS += -O3
10 | endif
11 |
12 | all: rotate-skiplist.cpp rotate-skiplist.h
13 | g++ $(CXX_FLAGS) $(LD_FLAGS) rotate-skiplist.cpp main.cpp -o ./main
14 |
15 |
--------------------------------------------------------------------------------
/rotate-skiplist/tm.h:
--------------------------------------------------------------------------------
1 |
2 | #ifdef ESTM
3 | # include "estm.h"
4 | #elif defined(TINY100) || defined(TINY10B) || defined(TINY099) || defined(TINY098)
5 | # include "tinystm.h"
6 | #elif defined WPLDSTM
7 | # include "wlpdstm.h"
8 | #elif defined LOCKFREE
9 | # include "lockfree.h"
10 | #elif defined TL2
11 | # include "tl2-mbench.h"
12 | #elif defined ICC
13 | # include "icc.h"
14 | #elif defined SEQUENTIAL
15 | # include "sequential.h"
16 | #endif
17 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/tm.h:
--------------------------------------------------------------------------------
1 |
2 | #ifdef ESTM
3 | # include "estm.h"
4 | #elif defined(TINY100) || defined(TINY10B) || defined(TINY099) || defined(TINY098)
5 | # include "tinystm.h"
6 | #elif defined WPLDSTM
7 | # include "wlpdstm.h"
8 | #elif defined LOCKFREE
9 | # include "lockfree.h"
10 | #elif defined TL2
11 | # include "tl2-mbench.h"
12 | #elif defined ICC
13 | # include "icc.h"
14 | #elif defined SEQUENTIAL
15 | # include "sequential.h"
16 | #endif
17 |
--------------------------------------------------------------------------------
/pcm/pcm.so/Makefile:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014 Intel Corporation
2 |
3 | all: libpcm.so
4 |
5 | OPT= -g -O3
6 | CXXFLAGS+= -Wall -fPIC $(OPT) -std=c++0x -DPCM_SILENT
7 | vpath %.cpp ..
8 |
9 | libpcm.so: msr.o cpucounters.o pci.o client_bw.o utils.o pcm-core.o
10 | $(CXX) $(CXXFLAGS) -shared $^ -lpthread -o $@
11 |
12 | c_example.x: c_example.o
13 | gcc $^ -ldl -L./ -lpcm -Wl,-rpath=$(shell pwd) -o $@
14 |
15 | clean:
16 | rm -rf *.x *.o *~ *.so
17 |
18 |
19 |
--------------------------------------------------------------------------------
/microbench.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #include "allocatortracker.h"
13 |
14 | #ifndef _MICROBENCH_H
15 | #define _MICROBENCH_H
16 |
17 | #define INIT_LIMIT 50000000
18 | #define LIMIT 10000000
19 |
20 | //#define PAPI_IPC 1
21 | //#define PAPI_CACHE 1
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/pcm/.bdsignore.all:
--------------------------------------------------------------------------------
1 | .bdsignore.all
2 | Makefile
3 | license.txt
4 | Doxyfile
5 | LICENSE
6 | README
7 | ChangeLog
8 | TODO
9 | Debug
10 | Release
11 | Release64
12 | Backup
13 | Intel_SSA
14 | .vs
15 | My Inspector XE Results - pcm
16 | .gitignore
17 | .gitattributes
18 | .*\.txt
19 | .*\.pdf
20 | .*\.docx
21 | .*\.rtf
22 | .*\.vcproj
23 | .*\.xcodeproj
24 | .*\.sh
25 | .*\.htm
26 | .*\.bat
27 | .*\.strings
28 | .*\.vcxproj
29 | .*\.sln
30 | .*\.sdf
31 | .*\.vcxproj.user
32 | .*\.log
33 | .*\.vcxproj.filters
34 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/background.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This is the interface for the background thread functions.
3 | *
4 | * Author: Ian Dick, 2013.
5 | */
6 | #ifndef BACKGROUND_H_
7 | #define BACKGROUND_H_
8 |
9 | #include "skiplist.h"
10 | #include "ptst.h"
11 |
12 | void bg_init(set_t *s);
13 | void bg_start(int sleep_time);
14 | void bg_stop(void);
15 | void bg_print_stats(void);
16 | void bg_remove(node_t *prev, node_t *node, ptst_t *ptst);
17 | void bg_help_remove(node_t *prev, node_t *node, ptst_t *ptst);
18 |
19 | #endif /* BACKGROUND_H_ */
20 |
--------------------------------------------------------------------------------
/rotate-skiplist/background.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This is the interface for the background thread functions.
3 | *
4 | * Author: Ian Dick, 2013.
5 | */
6 | #ifndef BACKGROUND_H_
7 | #define BACKGROUND_H_
8 |
9 | #include "skiplist.h"
10 | #include "ptst.h"
11 |
12 | void bg_init(set_t *s);
13 | void bg_start(int sleep_time);
14 | void bg_stop(void);
15 | void bg_print_stats(void);
16 | void bg_remove(node_t *prev, node_t *node, ptst_t *ptst);
17 | void bg_help_remove(node_t *prev, node_t *node, ptst_t *ptst);
18 |
19 | #endif /* BACKGROUND_H_ */
20 |
--------------------------------------------------------------------------------
/pcm/PCM-Core_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/pcm/PCM-MSR_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/pcm/PCM-NUMA_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/pcm/PCM-PCIE_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/pcm/PCM-TSX_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/pcm/PCM-Memory_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/pcm/PCM-Power_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/pcm/readmem.sh:
--------------------------------------------------------------------------------
1 |
2 |
3 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
4 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
5 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
6 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
7 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
8 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
9 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
10 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
11 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
12 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
13 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
14 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
15 |
16 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2012 Intel Corporation
3 | # written by Austen Ott
4 | #
5 | # Build and install the PcmMsr kext and dynamically linked library.
6 |
7 | kext:
8 | xcodebuild -configuration Release -target PcmMsrDriver clean build
9 |
10 | library:
11 | xcodebuild -configuration Release -target PcmMsrLibrary clean build
12 |
13 | install: kext library
14 | sudo sh ./kextload.sh
15 | sudo cp build/Release/libPcmMsr.dylib /usr/lib/
16 | sudo cp MSRAccessorPublic.h /usr/include/MSRAccessor.h
17 | sudo cp MSRKernel.h /usr/include/MSRKernel.h
18 | sudo cp PCIDriverInterface.h /usr/include/PCIDriverInterface.h
19 |
20 | uninstall:
21 | sudo sh ./kextunload.sh
22 | sudo rm /usr/include/MSRKernel.h
23 | sudo rm /usr/include/MSRAccessor.h
24 | sudo rm /usr/lib/libPcmMsr.dylib
25 | sudo rm /usr/include/PCIDriverInterface.h
26 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr.xcodeproj/xcuserdata/pjkerly.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PcmMsrDriver.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | PcmMsrLibrary.xcscheme
13 |
14 | orderHint
15 | 1
16 |
17 |
18 | SuppressBuildableAutocreation
19 |
20 | 81ADBF11156EEB93006D9B47
21 |
22 | primary
23 |
24 |
25 | 81F91BBB156D9BF8007DD788
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/masstree/string_slice.cc:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #include "string_slice.hh"
17 |
--------------------------------------------------------------------------------
/generate_all_workloads.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | KEY_TYPE=monoint
4 | for WORKLOAD_TYPE in e c a; do
5 | echo workload${WORKLOAD_TYPE} > workload_config.inp
6 | echo ${KEY_TYPE} >> workload_config.inp
7 | python gen_workload.py workload_config.inp
8 | mv workloads/load_${KEY_TYPE}_workload${WORKLOAD_TYPE} workloads/mono_inc_load${WORKLOAD_TYPE}_zipf_int_100M.dat
9 | mv workloads/txn_${KEY_TYPE}_workload${WORKLOAD_TYPE} workloads/mono_inc_txns${WORKLOAD_TYPE}_zipf_int_100M.dat
10 | done
11 |
12 | KEY_TYPE=randint
13 | for WORKLOAD_TYPE in e c a; do
14 | echo workload${WORKLOAD_TYPE} > workload_config.inp
15 | echo ${KEY_TYPE} >> workload_config.inp
16 | python gen_workload.py workload_config.inp
17 | mv workloads/load_${KEY_TYPE}_workload${WORKLOAD_TYPE} workloads/load${WORKLOAD_TYPE}_zipf_int_100M.dat
18 | mv workloads/txn_${KEY_TYPE}_workload${WORKLOAD_TYPE} workloads/txns${WORKLOAD_TYPE}_zipf_int_100M.dat
19 | done
20 |
21 |
--------------------------------------------------------------------------------
/rotate-skiplist/atomic_ops/standard_ao_double_t.h:
--------------------------------------------------------------------------------
1 | /* NEC LE-IT: For 64Bit OS we extend the double type to hold two int64's
2 | *
3 | * x86-64: __m128 serves as placeholder which also requires the compiler
4 | * to align it on 16 byte boundary (as required by cmpxchg16.
5 | * Similar things could be done for PowerPC 64bit using a VMX data type... */
6 |
7 | #if (defined(__x86_64__) && defined(__GNUC__)) || defined(_WIN64)
8 | # include
9 | typedef __m128 double_ptr_storage;
10 | #elif defined(_WIN32) && !defined(__GNUC__)
11 | typedef unsigned __int64 double_ptr_storage;
12 | #else
13 | typedef unsigned long long double_ptr_storage;
14 | #endif
15 |
16 | # define AO_HAVE_DOUBLE_PTR_STORAGE
17 |
18 | typedef union {
19 | double_ptr_storage AO_whole;
20 | struct {AO_t AO_v1; AO_t AO_v2;} AO_parts;
21 | } AO_double_t;
22 |
23 | #define AO_HAVE_double_t
24 | #define AO_val1 AO_parts.AO_v1
25 | #define AO_val2 AO_parts.AO_v2
26 |
--------------------------------------------------------------------------------
/rotate-skiplist/ptst.h:
--------------------------------------------------------------------------------
1 | /*
2 | * the per-thread state interface
3 | */
4 | #ifndef PTST_H_
5 | #define PTST_H_
6 |
7 | #include
8 |
9 | typedef struct sl_ptst ptst_t;
10 | struct sl_ptst {
11 | /* thread id */
12 | unsigned int id;
13 |
14 | /* state management */
15 | ptst_t *next;
16 | unsigned int count;
17 |
18 | /* utility structures */
19 | struct gc_st *gc;
20 | };
21 |
22 | extern pthread_key_t ptst_key;
23 |
24 | /*
25 | * enter/leave a critical section - a thread gets a state handle for
26 | * use during critical regions
27 | */
28 | ptst_t* ptst_critical_enter(void);
29 | #define ptst_critical_exit(_p) gc_exit(_p);
30 |
31 | /* Iterators */
32 | extern ptst_t *ptst_list;
33 | #define ptst_first() (ptst_list)
34 | #define ptst_next(_p) ((_p)->next)
35 |
36 | /* Called once at the beginning of the application */
37 | void ptst_subsystem_init(void);
38 |
39 | #endif /* PTST_H_ */
40 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/atomic_ops/standard_ao_double_t.h:
--------------------------------------------------------------------------------
1 | /* NEC LE-IT: For 64Bit OS we extend the double type to hold two int64's
2 | *
3 | * x86-64: __m128 serves as placeholder which also requires the compiler
4 | * to align it on 16 byte boundary (as required by cmpxchg16.
5 | * Similar things could be done for PowerPC 64bit using a VMX data type... */
6 |
7 | #if (defined(__x86_64__) && defined(__GNUC__)) || defined(_WIN64)
8 | # include
9 | typedef __m128 double_ptr_storage;
10 | #elif defined(_WIN32) && !defined(__GNUC__)
11 | typedef unsigned __int64 double_ptr_storage;
12 | #else
13 | typedef unsigned long long double_ptr_storage;
14 | #endif
15 |
16 | # define AO_HAVE_DOUBLE_PTR_STORAGE
17 |
18 | typedef union {
19 | double_ptr_storage AO_whole;
20 | struct {AO_t AO_v1; AO_t AO_v2;} AO_parts;
21 | } AO_double_t;
22 |
23 | #define AO_HAVE_double_t
24 | #define AO_val1 AO_parts.AO_v1
25 | #define AO_val2 AO_parts.AO_v2
26 |
--------------------------------------------------------------------------------
/masstree/value_string.cc:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2014 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2014 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #include "kvrow.hh"
17 | #include "value_string.hh"
18 | #include
19 |
--------------------------------------------------------------------------------
/rotate-skiplist/common.h:
--------------------------------------------------------------------------------
1 | /*
2 | * common definitions shared by all modules
3 | */
4 | #ifndef COMMON_H_
5 | #define COMMON_H_
6 |
7 | #include "./atomic_ops/atomic_ops.h"
8 |
9 | #define VOLATILE /* volatile */
10 | #define BARRIER() asm volatile("" ::: "memory")
11 |
12 | #define CAS(_m, _o, _n) AO_compare_and_swap_full(((VOLATILE AO_t*) _m), ((AO_t) _o), ((AO_t) _n))
13 |
14 | #define FAI(a) AO_fetch_and_add_full((VOLATILE AO_t*) (a), 1)
15 | #define FAD(a) AO_fetch_and_add_full((VOLATILE AO_t*) (a), -1)
16 |
17 | /*
18 | * Allow us to efficiently align and pad structures so that shared fields
19 | * don't cause contention on thread-local or read-only fields.
20 | */
21 | #define CACHE_PAD(_n) char __pad ## _n [CACHE_LINE_SIZE]
22 | #define ALIGNED_ALLOC(_s) \
23 | ((void *)(((unsigned long)malloc((_s)+CACHE_LINE_SIZE*2) + \
24 | CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE-1)))
25 |
26 | #define CACHE_LINE_SIZE 64
27 |
28 | #endif /* COMMON_H_ */
29 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/common.h:
--------------------------------------------------------------------------------
1 | /*
2 | * common definitions shared by all modules
3 | */
4 | #ifndef COMMON_H_
5 | #define COMMON_H_
6 |
7 | #include "./atomic_ops/atomic_ops.h"
8 |
9 | #define VOLATILE /* volatile */
10 | #define BARRIER() asm volatile("" ::: "memory");
11 |
12 | #define CAS(_m, _o, _n) \
13 | AO_compare_and_swap_full(((volatile AO_t*) _m), ((AO_t) _o), ((AO_t) _n))
14 |
15 | #define FAI(a) AO_fetch_and_add_full((volatile AO_t*) (a), 1)
16 | #define FAD(a) AO_fetch_and_add_full((volatile AO_t*) (a), -1)
17 |
18 | /*
19 | * Allow us to efficiently align and pad structures so that shared fields
20 | * don't cause contention on thread-local or read-only fields.
21 | */
22 | #define CACHE_PAD(_n) char __pad ## _n [CACHE_LINE_SIZE]
23 | #define ALIGNED_ALLOC(_s) \
24 | ((void *)(((unsigned long)malloc((_s)+CACHE_LINE_SIZE*2) + \
25 | CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE-1)))
26 |
27 | #define CACHE_LINE_SIZE 64
28 |
29 |
30 |
31 | #endif /* COMMON_H_ */
32 |
--------------------------------------------------------------------------------
/rotate-skiplist/nohotspot_ops.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Interface for the No Hot Spot Non-Blocking Skip List
3 | * operations.
4 | *
5 | * Author: Ian Dick, 2013.
6 | */
7 |
8 | #ifndef NOHOTSPOT_OPS_H_
9 | #define NOHOTSPOT_OPS_H_
10 |
11 | #include "skiplist.h"
12 |
13 | enum sl_optype {
14 | CONTAINS,
15 | DELETE,
16 | INSERT,
17 | SCAN,
18 | };
19 |
20 | typedef enum sl_optype sl_optype_t;
21 |
22 | int sl_do_operation(set_t *set, sl_optype_t optype,
23 | sl_key_type key, sl_value_type val);
24 |
25 | /* these are macros instead of functions to improve performance */
26 | #define sl_contains(a, b) sl_do_operation((a), CONTAINS, (b), NULL);
27 | #define sl_delete(a, b) sl_do_operation((a), DELETE, (b), NULL);
28 | #define sl_insert(a, b, c) sl_do_operation((a), INSERT, (b), (c));
29 | // Note that the range must keep valid before this function returns
30 | #define sl_scan(a, start_key, range) sl_do_operation((a), SCAN, (start_key), (void *)&(range))
31 |
32 | #endif /* NOHOTSPOT_OPS_H_ */
33 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/ptst.h:
--------------------------------------------------------------------------------
1 | /*
2 | * the per-thread state interface
3 | */
4 | #ifndef PTST_H_
5 | #define PTST_H_
6 |
7 | #include
8 |
9 | typedef struct sl_ptst ptst_t;
10 |
11 | #include "garbagecoll.h"
12 |
13 | struct sl_ptst {
14 | /* thread id */
15 | unsigned int id;
16 |
17 | /* state management */
18 | struct sl_ptst *next;
19 | unsigned int count;
20 |
21 | /* utility structures */
22 | gc_st *gc;
23 | unsigned long rand;
24 | };
25 |
26 | extern pthread_key_t ptst_key;
27 |
28 | /*
29 | * enter/leave a critical section - a thread gets a state handle for
30 | * use during critical regions
31 | */
32 | ptst_t* ptst_critical_enter(void);
33 | #define ptst_critical_exit(_p) gc_exit(_p);
34 |
35 | /* Iterators */
36 | extern ptst_t *ptst_list;
37 | #define ptst_first() (ptst_list)
38 | #define ptst_next(_p) ((_p)->next)
39 |
40 | /* Called once at the beginning of the application */
41 | void ptst_subsystem_init(void);
42 |
43 | #endif /* PTST_H_ */
44 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr.xcodeproj/xcuserdata/aiott.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PcmMsr.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | PcmMsrLibrary.xcscheme
13 |
14 | orderHint
15 | 1
16 |
17 |
18 | SuppressBuildableAutocreation
19 |
20 | 81ADBF11156EEB93006D9B47
21 |
22 | primary
23 |
24 |
25 | 81DEAF55157008B7005E8EC6
26 |
27 | primary
28 |
29 |
30 | 81F91BBB156D9BF8007DD788
31 |
32 | primary
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/nohotspot_ops.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Interface for the No Hot Spot Non-Blocking Skip List
3 | * operations.
4 | *
5 | * Author: Ian Dick, 2013.
6 | */
7 |
8 | #ifndef NOHOTSPOT_OPS_H_
9 | #define NOHOTSPOT_OPS_H_
10 |
11 | #include "skiplist.h"
12 |
13 | enum sl_optype {
14 | CONTAINS,
15 | DELETE,
16 | INSERT,
17 | SCAN,
18 | };
19 | typedef enum sl_optype sl_optype_t;
20 |
21 | int sl_do_operation(long *steps, set_t *set, sl_optype_t optype, sl_key_t key, val_t val);
22 |
23 | /* these are macros instead of functions to improve performance */
24 | #define sl_contains(steps, a, b) sl_do_operation((steps), (a), CONTAINS, (b), NULL);
25 | #define sl_delete(steps, a, b) sl_do_operation((steps), (a), DELETE, (b), NULL);
26 | #define sl_insert(steps, a, b, c) sl_do_operation((steps), (a), INSERT, (b), (c));
27 | // Note that the range must keep valid before this function returns
28 | #define sl_scan(steps, a, start_key, range) sl_do_operation((steps), (a), SCAN, (start_key), (void *)&(range))
29 |
30 | #endif /* NOHOTSPOT_OPS_H_ */
31 |
--------------------------------------------------------------------------------
/rotate-skiplist-cpp/rotate-skiplist.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "rotate-skiplist.h"
3 |
4 | using namespace rotate_skiplist;
5 |
6 | /////////////////////////////////////////////////////////////////////
7 | // Global varialbes: GCGlobalState
8 | /////////////////////////////////////////////////////////////////////
9 |
10 | // Initialized once on Init() call of class GCGlobalState
11 | GCGlobalState *GCGlobalState::global_state_p = nullptr;
12 |
13 | /////////////////////////////////////////////////////////////////////
14 | // Global varialbes: ThreadState
15 | /////////////////////////////////////////////////////////////////////
16 |
17 | // Three global variables defined within thread state object
18 | // which mains the global linked list of thread objects
19 | pthread_key_t ThreadState::thread_state_key{};
20 |
21 | // Will initialize these two in the global initializer
22 | std::atomic ThreadState::next_id{0U};
23 | std::atomic ThreadState::thread_state_head_p{nullptr};
24 |
25 | // Has not been initialized yet
26 | bool ThreadState::inited = false;
--------------------------------------------------------------------------------
/nohotspot-skiplist/intset.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File:
3 | * intset.h
4 | * Author(s):
5 | * Vincent Gramoli
6 | * Description:
7 | * Skip list integer set operations
8 | *
9 | * Copyright (c) 2009-2010.
10 | *
11 | * intset.h is part of Synchrobench
12 | *
13 | * Synchrobench is free software: you can redistribute it and/or
14 | * modify it under the terms of the GNU General Public License
15 | * as published by the Free Software Foundation, version 2
16 | * of the License.
17 | *
18 | * This program is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU General Public License for more details.
22 | */
23 |
24 | #ifndef INTSET_H_
25 | #define INTSET_T_
26 |
27 | #include "skiplist.h"
28 |
29 | int sl_contains_old(set_t *set, unsigned int key, int transactional);
30 | int sl_add_old(set_t *set, unsigned int key, int transactional);
31 | int sl_remove_old(set_t *set, unsigned int key, int transactional);
32 |
33 | #endif /* INTSET_H_ */
34 |
--------------------------------------------------------------------------------
/rotate-skiplist/intset.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File:
3 | * intset.h
4 | * Author(s):
5 | * Vincent Gramoli
6 | * Description:
7 | * Skip list integer set operations
8 | *
9 | * Copyright (c) 2009-2010.
10 | *
11 | * intset.h is part of Synchrobench
12 | *
13 | * Synchrobench is free software: you can redistribute it and/or
14 | * modify it under the terms of the GNU General Public License
15 | * as published by the Free Software Foundation, version 2
16 | * of the License.
17 | *
18 | * This program is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU General Public License for more details.
22 | */
23 |
24 | #ifndef INTSET_H_
25 | #define INTSET_T_
26 |
27 | #include "skiplist.h"
28 |
29 | int sl_contains_old(set_t *set, unsigned long key, int transactional);
30 | int sl_add_old(set_t *set, unsigned long key, int transactional);
31 | int sl_remove_old(set_t *set, unsigned long key, int transactional);
32 |
33 | #endif /* INTSET_H_ */
34 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/lockfree.h:
--------------------------------------------------------------------------------
1 |
2 | # define NL 1
3 | # define EL 0
4 | # define TX_START(type) /* nothing */
5 | # define TX_LOAD(addr) (*(addr))
6 | # define TX_STORE(addr, val) (*(addr) = (val))
7 | # define TX_END /* nothing */
8 | # define FREE(addr, size) free(addr)
9 | # define MALLOC(size) malloc(size)
10 | # define TM_CALLABLE /* nothing */
11 | # define TM_ARGDECL_ALONE /* nothing */
12 | # define TM_ARGDECL /* nothing */
13 | # define TM_ARG /* nothing */
14 | # define TM_ARG_ALONE /* nothing */
15 | # define TM_ARG_LAST /* nothing */
16 | # define TM_STARTUP() /* nothing */
17 | # define TM_SHUTDOWN() /* nothing */
18 | # define TM_STARTUP() /* nothing */
19 | # define TM_SHUTDOWN() /* nothing */
20 | # define TM_THREAD_ENTER() /* nothing */
21 | # define TM_THREAD_EXIT() /* nothing */
22 |
--------------------------------------------------------------------------------
/rotate-skiplist/lockfree.h:
--------------------------------------------------------------------------------
1 |
2 | # define NL 1
3 | # define EL 0
4 | # define TX_START(type) /* nothing */
5 | # define TX_LOAD(addr) (*(addr))
6 | # define TX_STORE(addr, val) (*(addr) = (val))
7 | # define TX_END /* nothing */
8 | # define FREE(addr, size) free(addr)
9 | # define MALLOC(size) malloc(size)
10 | # define TM_CALLABLE /* nothing */
11 | # define TM_ARGDECL_ALONE /* nothing */
12 | # define TM_ARGDECL /* nothing */
13 | # define TM_ARG /* nothing */
14 | # define TM_ARG_ALONE /* nothing */
15 | # define TM_ARG_LAST /* nothing */
16 | # define TM_STARTUP() /* nothing */
17 | # define TM_SHUTDOWN() /* nothing */
18 | # define TM_STARTUP() /* nothing */
19 | # define TM_SHUTDOWN() /* nothing */
20 | # define TM_THREAD_ENTER() /* nothing */
21 | # define TM_THREAD_EXIT() /* nothing */
22 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/garbagecoll.h:
--------------------------------------------------------------------------------
1 | /*
2 | * interface for garbage collection
3 | */
4 |
5 | #ifndef GARBAGECOLL_H_
6 | #define GARBAGECOLL_H_
7 |
8 | /* comment out to disable garbage collection */
9 | #define USE_GC
10 |
11 | #include "ptst.h"
12 |
13 | typedef struct gc_st gc_st;
14 |
15 | /* Initialise GC section of per-thread state */
16 | gc_st* gc_init(void);
17 |
18 | int gc_add_allocator(int alloc_size);
19 | void gc_remove_allocator(int alloc_id);
20 |
21 | void* gc_alloc(ptst_t *ptst, int alloc_id);
22 | void gc_free(ptst_t *ptst, void *p, int alloc_id);
23 | void gc_free_unsafe(ptst_t *ptst, void *p, int alloc_id);
24 |
25 | /* Hook registry - allows users to hook in their own epoch-delay lists */
26 | typedef void (*gc_hookfn)(ptst_t*, void*);
27 | int gc_add_hook(gc_hookfn hookfn);
28 | void gc_remove_hook(int hookid);
29 | void gc_hooklist_addptr(ptst_t *ptst, void *ptr, int hookid);
30 |
31 | /* Per-thread entry/exit from critical regions */
32 | void gc_enter(ptst_t* ptst);
33 | void gc_exit(ptst_t* ptst);
34 |
35 | /* Initialisation of GC */
36 | void gc_subsystem_init(void);
37 | void gc_subsystem_destroy(void);
38 |
39 | #endif /* GARBAGECOLL_H_ */
40 |
--------------------------------------------------------------------------------
/pcm/mutex.h:
--------------------------------------------------------------------------------
1 | #ifndef MUTEX_HEADER_
2 | #define MUTEX_HEADER_
3 |
4 | #ifdef _MSC_VER
5 | #include
6 | #else
7 | #include
8 | #endif
9 |
10 | #include
11 |
12 | namespace PCM_Util
13 | {
14 | class Mutex {
15 | #ifdef _MSC_VER
16 | HANDLE mutex_;
17 | #else
18 | pthread_mutex_t mutex_;
19 | #endif
20 |
21 | public:
22 | Mutex()
23 | {
24 | #ifdef _MSC_VER
25 | mutex_ = CreateMutex(NULL, FALSE, NULL);
26 | #else
27 | pthread_mutex_init(&mutex_, NULL);
28 | #endif
29 | }
30 | virtual ~Mutex()
31 | {
32 | #ifdef _MSC_VER
33 | CloseHandle(mutex_);
34 | #else
35 | pthread_mutex_destroy(&mutex_);
36 | #endif
37 | }
38 |
39 | void lock()
40 | {
41 | #ifdef _MSC_VER
42 | WaitForSingleObject(mutex_, INFINITE);
43 | #else
44 | pthread_mutex_lock(&mutex_);
45 | #endif
46 | }
47 | void unlock()
48 | {
49 | #ifdef _MSC_VER
50 | ReleaseMutex(mutex_);
51 | #else
52 | pthread_mutex_unlock(&mutex_);
53 | #endif
54 | }
55 | };
56 | }
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/pcm/freegetopt/ChangeLog:
--------------------------------------------------------------------------------
1 | 2003-10-25 Mark K. Kim {getopt*cbreak.org}
2 |
3 | * *: freegetopt 0.11 released.
4 |
5 | 2003-10-25 Mark K. Kim {getopt*cbreak.org}
6 |
7 | * ChangeLog: ChangeLog file added.
8 |
9 | * LICENSE: License file added. License is now officially BSD.
10 |
11 | * README: Updated to reflect the new license. CVS tracking data
12 | added.
13 |
14 | * getopt.h, getopt.c: License text added to the beginning of
15 | each file. CVS tracking data added.
16 |
17 | * test.c: License text added to the beginning of the file.
18 | CVS tracking data added.
19 |
20 | 2003-10-20 Mark K. Kim {getopt*cbreak.org}
21 |
22 | * *: Sourceforge project approval. Name changed to freegetopt.
23 | License is now officially BSD.
24 |
25 | 2003-09-29 Jon Higdon {jhigdon*nni.com}
26 |
27 | * test.c: GCC 3.x gives compound statement warning. Fixed.
28 |
29 | 2003.01.12 Mark K. Kim {getopt*cbreak.org}
30 |
31 | * *: Getopt 1.0 released! Supports only short options, but
32 | I think it's fully compatible with GNU getopt except for the
33 | value of optind while getopt is still running. The value
34 | of optind is same after getopt finishes running, however.
35 |
36 |
--------------------------------------------------------------------------------
/rotate-skiplist/intset.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * File:
3 | * intset.c
4 | * Author(s):
5 | * Vincent Gramoli
6 | * Description:
7 | * Skip list integer set operations
8 | *
9 | * Copyright (c) 2009-2010.
10 | *
11 | * intset.c is part of Synchrobench
12 | *
13 | * Synchrobench is free software: you can redistribute it and/or
14 | * modify it under the terms of the GNU General Public License
15 | * as published by the Free Software Foundation, version 2
16 | * of the License.
17 | *
18 | * This program is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU General Public License for more details.
22 | */
23 |
24 | #include "intset.h"
25 | #include "skiplist.h"
26 | #include "nohotspot_ops.h"
27 |
28 | #define MAXLEVEL 32
29 |
30 | int sl_contains_old(set_t *set, sl_key_type key, int transactional)
31 | {
32 | return sl_contains(set, key);
33 | }
34 |
35 | int sl_add_old(set_t *set, sl_key_type key, int transactional)
36 | {
37 | return sl_insert(set, key, (void*)&key);
38 | }
39 |
40 | int sl_remove_old(set_t *set, sl_key_type key, int transactional)
41 | {
42 | return sl_delete(set, key);
43 | }
44 |
--------------------------------------------------------------------------------
/rotate-skiplist/Makefile:
--------------------------------------------------------------------------------
1 | #-include Makefile.common
2 |
3 | CXX=g++-5
4 | CXX_FLAGS=-std=c++11 -pthread -O3 -g
5 |
6 | .PHONY: all clean
7 |
8 | all: main
9 |
10 | ptst.o: ptst.h common.h
11 | $(CXX) $(CFLAGS) $(CXX_FLAGS) -std=c++11 -c -o ./ptst.o ptst.cpp
12 |
13 | garbagecoll.o: garbagecoll.h ptst.h common.h
14 | $(CXX) $(CFLAGS) $(CXX_FLAGS) -std=c++11 -c -o ./garbagecoll.o garbagecoll.cpp
15 |
16 | nohotspot_ops.o: skiplist.h background.h nohotspot_ops.h common.h
17 | $(CXX) $(CFLAGS) $(CXX_FLAGS) -std=c++11 -c -o ./nohotspot_ops.o nohotspot_ops.cpp
18 |
19 | skiplist.o: skiplist.h background.h common.h
20 | $(CXX) $(CFLAGS) $(CXX_FLAGS) -std=c++11 -c -o ./skiplist.o skiplist.cpp
21 |
22 | background.o: background.h skiplist.h common.h
23 | $(CXX) $(CFLAGS) $(CXX_FLAGS) -std=c++11 -c -o ./background.o background.cpp
24 |
25 | intset.o: intset.h nohotspot_ops.h skiplist.h
26 | $(CXX) $(CFLAGS) $(CXX_FLAGS) -std=c++11 -c -o ./intset.o intset.cpp
27 |
28 | test.o: intset.h test.c
29 | $(CXX) $(CFLAGS) $(CXX_FLAGS) -std=c++11 -c -o ./test.o test.c
30 |
31 | main: intset.o background.o skiplist.o nohotspot_ops.o test.o ptst.o garbagecoll.o
32 | $(CXX) $(CFLAGS) $(CXX_FLAGS) garbagecoll.o ptst.o skiplist.o nohotspot_ops.o intset.o background.o test.o -o ./main $(LDFLAGS)
33 |
34 | clean:
35 | -rm -rf *.o
36 | -rm -f ./main
37 |
--------------------------------------------------------------------------------
/rotate-skiplist/intset.c:
--------------------------------------------------------------------------------
1 | /*
2 | * File:
3 | * intset.c
4 | * Author(s):
5 | * Vincent Gramoli
6 | * Description:
7 | * Skip list integer set operations
8 | *
9 | * Copyright (c) 2009-2010.
10 | *
11 | * intset.c is part of Synchrobench
12 | *
13 | * Synchrobench is free software: you can redistribute it and/or
14 | * modify it under the terms of the GNU General Public License
15 | * as published by the Free Software Foundation, version 2
16 | * of the License.
17 | *
18 | * This program is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU General Public License for more details.
22 | */
23 |
24 | #include "intset.h"
25 | #include "skiplist.h"
26 | #include "nohotspot_ops.h"
27 |
28 | #define MAXLEVEL 32
29 |
30 | int sl_contains_old(set_t *set, unsigned long key, int transactional)
31 | {
32 | return sl_contains(set, key);
33 | }
34 |
35 | int sl_add_old(set_t *set, unsigned long key, int transactional)
36 | {
37 | return sl_insert(set, key, (void*) key);
38 | }
39 |
40 | int sl_remove_old(set_t *set, unsigned long key, int transactional)
41 | {
42 | return sl_delete(set, key);
43 | }
44 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/Makefile:
--------------------------------------------------------------------------------
1 |
2 | include Makefile.common
3 |
4 | BINS = .
5 | INCLUDE_DIR=./atomic_ops
6 | BUILDIR=.
7 |
8 | .PHONY: all clean
9 |
10 | all: main
11 |
12 | ptst.o: ptst.h
13 | $(CC) $(CFLAGS) -c -o $(BUILDIR)/ptst.o ptst.cpp -I$(INCLUDE_DIR)
14 |
15 | garbagecoll.o: garbagecoll.h ptst.h
16 | $(CC) $(CFLAGS) -c -o $(BUILDIR)/garbagecoll.o garbagecoll.cpp -I$(INCLUDE_DIR)
17 |
18 | nohotspot_ops.o: skiplist.h background.h nohotspot_ops.h
19 | $(CC) $(CFLAGS) -c -o $(BUILDIR)/nohotspot_ops.o nohotspot_ops.cpp -I$(INCLUDE_DIR)
20 |
21 | skiplist.o: skiplist.h background.h
22 | $(CC) $(CFLAGS) -c -o $(BUILDIR)/skiplist.o skiplist.cpp -I$(INCLUDE_DIR)
23 |
24 | background.o: background.h skiplist.h
25 | $(CC) $(CFLAGS) -c -o $(BUILDIR)/background.o background.cpp -I$(INCLUDE_DIR)
26 |
27 | intset.o: intset.h nohotspot_ops.h skiplist.h
28 | $(CC) $(CFLAGS) -c -o $(BUILDIR)/intset.o intset.cpp -I$(INCLUDE_DIR)
29 |
30 | test.o: intset.h
31 | $(CC) $(CFLAGS) -c -o $(BUILDIR)/test.o test.c -I$(INCLUDE_DIR)
32 |
33 | main: intset.o background.o skiplist.o nohotspot_ops.o test.o ptst.o garbagecoll.o
34 | $(CC) $(CFLAGS) $(BUILDIR)/garbagecoll.o $(BUILDIR)/ptst.o $(BUILDIR)/skiplist.o $(BUILDIR)/nohotspot_ops.o $(BUILDIR)/intset.o $(BUILDIR)/background.o $(BUILDIR)/test.o -o $(BINS)/test $(LDFLAGS)
35 |
36 | clean:
37 | -rm -f $(BINS)/*.o
38 | rm -f ./test
39 |
--------------------------------------------------------------------------------
/masstree/checkpoint.cc:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #include "checkpoint.hh"
17 |
18 | // add one key/value to a checkpoint.
19 | // called by checkpoint_tree() for each node.
20 | bool ckstate::visit_value(Str key, const row_type* value, threadinfo&) {
21 | if (endkey && key >= endkey)
22 | return false;
23 | if (!row_is_marker(value)) {
24 | msgpack::unparser up(*vals);
25 | up.write(key).write_wide(value->timestamp());
26 | value->checkpoint_write(up);
27 | ++count;
28 | }
29 | return true;
30 | }
31 |
--------------------------------------------------------------------------------
/masstree/doc/patches.mp:
--------------------------------------------------------------------------------
1 | input elements;
2 |
3 | def thediamond_(suffix $) =
4 | $.e -- $.n -- $.w -- $s -- cycle
5 | enddef;
6 |
7 | vardef sizediamond_(suffix $) =
8 | save a_, b_;
9 | (a_,b_) = .5*(urcorner pic_$ - llcorner pic_$);
10 | if (unknown $dy or unknown $dx) and unknown $squatness: $squatness = 1; fi
11 | if unknown $dy: $dy = $squatness * ($dx + a_) - b_; fi
12 | if unknown $dy:
13 | $dy = b_ + circmargin * sqrt($squatness+1) + $squatness * a_;
14 | fi
15 | sizeelement_($);
16 | enddef;
17 |
18 | vardef cleardiamond_(suffix $) =
19 | _n_ := str $;
20 | generic_redeclare(numeric) _n.squatness;
21 | enddef;
22 |
23 | vardef patchit@#(expr s, type) =
24 | _elementit.@#(s, 0, 0, push, false, false);
25 | if type = 0:
26 | pproc_.@# := "thecirc_";
27 | % sproc_.@# := "sizecirc_";
28 | elseif type = 2:
29 | _n_ := str @#;
30 | generic_declare(numeric) _n.squatness, _n.dx, _n.dy;
31 | pproc_.@# := "thediamond_";
32 | sproc_.@# := "sizediamond_";
33 | expandafter def expandafter clearboxes expandafter =
34 | clearboxes cleardiamond_(@#);
35 | enddef
36 | elseif type = 3:
37 | pproc_.@# := "rboxpath_";
38 | fi;
39 | enddef;
40 |
41 | vardef drawconnpatch(suffix $,$$)(text conn) text rest =
42 | interim linejoin := mitered;
43 | drawarrow ($.c conn $$.c) cutbefore bpath.$ cutafter bpath.$$ withpen connectionpen rest
44 | enddef;
45 |
--------------------------------------------------------------------------------
/rotate-skiplist/garbagecoll.h:
--------------------------------------------------------------------------------
1 | /*
2 | * interface for garbage collection
3 | */
4 |
5 | #ifndef GARBAGECOLL_H_
6 | #define GARBAGECOLL_H_
7 |
8 | #define ADD_TO(_v,_x) \
9 | do { \
10 | unsigned long __val = (_v); \
11 | while (!CAS(&(_v),__val,__val+(_x))) \
12 | __val = (_v); \
13 | } while ( 0 )
14 |
15 | typedef struct gc_st gc_st;
16 |
17 | #include "ptst.h"
18 |
19 | typedef struct gc_chunk gc_chunk;
20 |
21 | /* Initialise GC section of per-thread state */
22 | gc_st* gc_init(void);
23 |
24 | int gc_add_allocator(int alloc_size);
25 | void gc_remove_allocator(int alloc_id);
26 |
27 | void* gc_alloc(ptst_t *ptst, int alloc_id);
28 | void gc_free(ptst_t *ptst, void *p, int alloc_id);
29 | void gc_free_unsafe(ptst_t *ptst, void *p, int alloc_id);
30 |
31 | /* Hook registry - allows users to hook in their own epoch-delay lists */
32 | typedef void (*gc_hookfn)(ptst_t*, void*);
33 | int gc_add_hook(gc_hookfn hookfn);
34 | void gc_remove_hook(int hookid);
35 | void gc_hooklist_addptr(ptst_t *ptst, void *ptr, int hookid);
36 |
37 | /* Per-thread entry/exit from critical regions */
38 | void gc_enter(ptst_t* ptst);
39 | void gc_exit(ptst_t* ptst);
40 |
41 | /* Initialisation of GC */
42 | void gc_subsystem_init(void);
43 | void gc_subsystem_destroy(void);
44 |
45 | #endif /* GARBAGECOLL_H_ */
46 |
--------------------------------------------------------------------------------
/masstree/perfstat.hh:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #ifndef PERF_STAT_HH
17 | #define PERF_STAT_HH 1
18 | #include "compiler.hh"
19 | #include "misc.hh"
20 | #include
21 | #include
22 |
23 | namespace Perf {
24 | struct stat {
25 | /** @brief An initialization call from main function
26 | */
27 | static void initmain(bool pinthreads);
28 | #if GCSTATS
29 | int gc_nfree;
30 | #endif
31 | void initialize(int cid) {
32 | this->cid = cid;
33 | }
34 | static void print(const stat **s, int n);
35 | int cid; // core index
36 | };
37 | }
38 | #endif
39 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/intset.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * File:
3 | * intset.c
4 | * Author(s):
5 | * Vincent Gramoli
6 | * Description:
7 | * Skip list integer set operations
8 | *
9 | * Copyright (c) 2009-2010.
10 | *
11 | * intset.c is part of Synchrobench
12 | *
13 | * Synchrobench is free software: you can redistribute it and/or
14 | * modify it under the terms of the GNU General Public License
15 | * as published by the Free Software Foundation, version 2
16 | * of the License.
17 | *
18 | * This program is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU General Public License for more details.
22 | */
23 |
24 | #include "intset.h"
25 | #include "skiplist.h"
26 | #include "nohotspot_ops.h"
27 |
28 | #define MAXLEVEL 32
29 |
30 | int sl_contains_old(set_t *set, unsigned int key, int transactional)
31 | {
32 | long null = 0L;
33 | return sl_contains(&null, set, (sl_key_t) key);
34 | }
35 |
36 | int sl_add_old(set_t *set, unsigned int key, int transactional)
37 | {
38 | long null = 0L;
39 | return sl_insert(&null, set, (sl_key_t) key, (val_t) ((long)key));
40 | }
41 |
42 | int sl_remove_old(set_t *set, unsigned int key, int transactional)
43 | {
44 | long null = 0L;
45 | return sl_delete(&null, set, (sl_key_t) key);
46 | }
47 |
--------------------------------------------------------------------------------
/BwTree/bwtree.cpp:
--------------------------------------------------------------------------------
1 |
2 | //===----------------------------------------------------------------------===//
3 | //
4 | // Peloton
5 | //
6 | // bwtree.cpp
7 | //
8 | // Identification: src/index/bwtree.cpp
9 | //
10 | // Copyright (c) 2015-16, Carnegie Mellon University Database Group
11 | //
12 | //===----------------------------------------------------------------------===//
13 |
14 | #include "bwtree.h"
15 |
16 | #ifdef BWTREE_PELOTON
17 | namespace peloton {
18 | namespace index {
19 | #else
20 | namespace wangziqi2013 {
21 | namespace bwtree {
22 | #endif
23 |
24 | bool print_flag = true;
25 |
26 | // This will be initialized when thread is initialized and in a per-thread
27 | // basis, i.e. each thread will get the same initialization image and then
28 | // is free to change them
29 | thread_local int BwTreeBase::gc_id = -1;
30 |
31 | std::atomic BwTreeBase::total_thread_num{0UL};
32 |
33 | #ifdef BWTREE_COLLECT_STATISTICS
34 | const char *BwTreeBase::GCMetaData::COUNTER_NAME_LIST[] = {
35 | "INSERT",
36 | "UPSERT",
37 | "DELETE",
38 | "READ",
39 |
40 | "LEAF_SPLIT",
41 | "INNER_SPLIT",
42 | "LEAF_MERGE",
43 | "INNER_MERGE",
44 | "LEAF_CONSOLIDATE",
45 | "INNER_CONSOLIDATE",
46 |
47 | "MODIFY_ABORT",
48 | "READ_ABORT",
49 |
50 | "ADD_TO_GC",
51 | "SCAN_GC_CHAIN",
52 | };
53 | #endif
54 |
55 | } // End index/bwtree namespace
56 | } // End peloton/wangziqi2013 namespace
57 |
58 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # index-microbench
2 |
3 | ## Generate Workloads ##
4 |
5 | 1. Download [YCSB](https://github.com/brianfrankcooper/YCSB/releases/latest)
6 |
7 | ```sh
8 | curl -O --location https://github.com/brianfrankcooper/YCSB/releases/download/0.11.0/ycsb-0.11.0.tar.gz
9 | tar xfvz ycsb-0.11.0.tar.gz
10 | mv ycsb-0.11.0 YCSB
11 | ```
12 |
13 | 2. Create Workload Spec
14 |
15 | The default workload a-f are in ./workload_spec
16 |
17 | You can of course generate your own spec and put it in this folder.
18 |
19 | 3. Modify workload_config.inp
20 |
21 | 1st arg: workload spec file name
22 | 2nd arg: key type (randint = random integer; monoint = monotonically increasing integer; email = email keys with host name reversed)
23 |
24 | 4. Generate
25 |
26 | ```sh
27 | make generate_workload
28 | ```
29 |
30 | The generated workload files will be in ./workloads
31 |
32 | 5. NOTE: To generate email-key workloads, you need an email list (list.txt)# index-microbench
33 |
34 | ## Publications ##
35 |
36 | This index benchmarking framework has been used as the experimental environment for the following research papers:
37 |
38 | Ziqi Wang, Andrew Pavlo, Hyeontaek Lim, Viktor Leis, Huanchen Zhang,
39 | Michael Kaminsky, and David G. Andersen. 2018. **Building a Bw-Tree Takes
40 | More Than Just Buzz Words.** In Proceedings of 2018 International Conference
41 | on Management of Data (SIGMOD’18). ACM, New York, NY, USA, 16 pages.
42 | https://doi.org/10.1145/3183713.3196895
43 |
--------------------------------------------------------------------------------
/pcm/PCM-Service_Win/app.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 |
7 | /////////////////////////////////////////////////////////////////////////////
8 | #undef APSTUDIO_READONLY_SYMBOLS
9 |
10 | /////////////////////////////////////////////////////////////////////////////
11 | // English (U.S.) resources
12 |
13 |
14 | /////////////////////////////////////////////////////////////////////////////
15 | //
16 | // Icon
17 | //
18 |
19 | // Icon placed first or with lowest ID value becomes application icon
20 |
21 | LANGUAGE 9, 1
22 | #pragma code_page(1252)
23 | 1 ICON "app.ico"
24 |
25 | #ifdef APSTUDIO_INVOKED
26 | /////////////////////////////////////////////////////////////////////////////
27 | //
28 | // TEXTINCLUDE
29 | //
30 |
31 | 1 TEXTINCLUDE
32 | BEGIN
33 | "resource.h\0"
34 | "\0"
35 | END
36 |
37 | 2 TEXTINCLUDE
38 | BEGIN
39 | "#include ""afxres.h""\r\n"
40 | "\0"
41 | END
42 |
43 | 3 TEXTINCLUDE
44 | BEGIN
45 | "\0"
46 | END
47 |
48 | #endif // APSTUDIO_INVOKED
49 |
50 | /////////////////////////////////////////////////////////////////////////////
51 |
52 |
53 |
54 | #ifndef APSTUDIO_INVOKED
55 | /////////////////////////////////////////////////////////////////////////////
56 | //
57 | // Generated from the TEXTINCLUDE 3 resource.
58 | //
59 |
60 |
61 | /////////////////////////////////////////////////////////////////////////////
62 | #endif // not APSTUDIO_INVOKED
63 |
64 |
--------------------------------------------------------------------------------
/run_all.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | RUNS=1
4 |
5 | for RUN in `seq 1 $RUNS`; do
6 | for KEY_TYPE in mono rand rdtsc; do
7 | for WORKLOAD_TYPE in c a e; do
8 | for THREAD_COUNT in 1 2 20 40; do
9 | # Use only one workload and many threads for rdtsc keys
10 | if [ "$KEY_TYPE" = "rdtsc" ] && ([ "$WORKLOAD_TYPE" != "c" ] || [ "$THREAD_COUNT" -eq 1 ] || [ "$THREAD_COUNT" -eq 2 ]); then
11 | continue
12 | fi
13 |
14 | for INDEX_TYPE in bwtree masstree btreeolc artolc; do
15 | # broken?
16 | if [ "$INDEX_TYPE" = "btreeolc" ] && [ "$WORKLOAD_TYPE" == "e" ]; then
17 | continue
18 | fi
19 | if [ "$INDEX_TYPE" = "artolc" ] && [ "$WORKLOAD_TYPE" == "e" ] && [ "$THREAD_COUNT" -eq 40 ]; then
20 | continue
21 | fi
22 |
23 | CMD="./workload $WORKLOAD_TYPE $KEY_TYPE $INDEX_TYPE $THREAD_COUNT"
24 | OUTPUT="result_${THREAD_COUNT}_${KEY_TYPE}_${WORKLOAD_TYPE}_${INDEX_TYPE}_${RUN}"
25 | echo
26 | echo ===========================================
27 | echo RUN=$RUN CMD=$CMD
28 | echo ===========================================
29 | if [ -e "$OUTPUT" ]; then
30 | echo skipping
31 | continue
32 | fi
33 |
34 | $CMD 2>&1 | tee ${OUTPUT}.tmp
35 | if [ $? -ne 0 ]; then
36 | echo exiting; status=$?
37 | exit 1
38 | fi
39 |
40 | mv ${OUTPUT}.tmp ${OUTPUT}
41 |
42 | echo
43 | done
44 | done
45 | done
46 | done
47 | done
48 |
--------------------------------------------------------------------------------
/pcm/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2016, opcm
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | * Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/masstree/kvrandom.cc:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #include "kvrandom.hh"
17 | #include "compiler.hh"
18 | #include
19 |
20 | const uint32_t kvrandom_psdes_nr::c1[] = {
21 | 0xBAA96887U, 0x1E17D32CU, 0x03BCDC3CU, 0x0F33D1B2U
22 | };
23 | const uint32_t kvrandom_psdes_nr::c2[] = {
24 | 0x4B0F3B58U, 0xE874F0C3U, 0x6955C5A6U, 0x55A7CA46U
25 | };
26 |
27 | uint32_t kvrandom_psdes_nr::psdes(uint32_t lword, uint32_t irword) {
28 | for (int i = 0; i < niter; ++i) {
29 | uint32_t iswap = irword;
30 | uint32_t ia = irword ^ c1[i];
31 | uint32_t il = ia & 0xFFFF, ih = ia >> 16;
32 | uint32_t ib = il * il + ~(ih * ih);
33 | ia = (ib >> 16) | (ib << 16);
34 | irword = lword ^ ((ia ^ c2[i]) + il * ih);
35 | lword = iswap;
36 | }
37 | return irword;
38 | }
39 |
--------------------------------------------------------------------------------
/pcm/PCM-Service_Win/PCMInstaller.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | /*
14 | ** Written by Otto Bruggeman
15 | */
16 |
17 |
18 | #include "PCMInstaller.h"
19 |
--------------------------------------------------------------------------------
/pcm/winpmem/winpmem.h:
--------------------------------------------------------------------------------
1 | #include "windows.h"
2 | #include "stdio.h"
3 | #include "tchar.h"
4 |
5 | // Executable version.
6 | static TCHAR version[] = TEXT("1.3. Built ") TEXT(__DATE__);
7 | #define PMEM_DEVICE_NAME "pmem"
8 | #define PMEM_SERVICE_NAME TEXT("winpmem")
9 |
10 | #define PAGE_SIZE 0x1000
11 |
12 | class WinPmem {
13 | public:
14 | WinPmem();
15 | virtual ~WinPmem();
16 |
17 | virtual int install_driver(bool delete_driver = true);
18 | virtual int uninstall_driver();
19 | virtual int set_acquisition_mode(__int32 mode);
20 |
21 | unsigned int read32(__int64 start);
22 |
23 | // This is set if output should be suppressed (e.g. if we pipe the
24 | // image to the STDOUT).
25 | int suppress_output;
26 | TCHAR last_error[1024];
27 |
28 | protected:
29 | virtual int load_driver_() = 0;
30 |
31 | virtual void LogError(TCHAR *message);
32 | virtual void Log(const TCHAR *message, ...);
33 |
34 | // The file handle to the pmem device.
35 | HANDLE fd_;
36 |
37 | // The file handle to the image file.
38 | HANDLE out_fd_;
39 | TCHAR *service_name;
40 | TCHAR driver_filename[MAX_PATH];
41 |
42 | // This is the maximum size of memory calculated.
43 | __int64 max_physical_memory_;
44 | };
45 |
46 | // This is the filename of the driver we drop.
47 | static TCHAR driver_filename[MAX_PATH];
48 |
49 | // ioctl to get memory ranges from our driver.
50 | #define PMEM_CTRL_IOCTRL CTL_CODE(0x22, 0x101, 0, 3)
51 | #define PMEM_WRITE_ENABLE CTL_CODE(0x22, 0x102, 0, 3)
52 | #define PMEM_INFO_IOCTRL CTL_CODE(0x22, 0x103, 0, 3)
53 |
54 | // Available modes
55 | #define PMEM_MODE_IOSPACE 0
56 | #define PMEM_MODE_PHYSICAL 1
57 |
--------------------------------------------------------------------------------
/pcm/freegetopt/LICENSE:
--------------------------------------------------------------------------------
1 | Free Getopt
2 | Copyright (c)2002-2003 Mark K. Kim
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions
7 | are met:
8 |
9 | * Redistributions of source code must retain the above copyright
10 | notice, this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in
14 | the documentation and/or other materials provided with the
15 | distribution.
16 |
17 | * Neither the original author of this software nor the names of its
18 | contributors may be used to endorse or promote products derived
19 | from this software without specific prior written permission.
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
31 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
32 | DAMAGE.
33 |
34 |
--------------------------------------------------------------------------------
/pcm/PCM_Win/pcm.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2011, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | // pcm.cpp : Defines the entry point for the console application.
15 | //
16 |
17 | #include "stdafx.h"
18 |
19 | #include "../pcm.cpp"
20 |
--------------------------------------------------------------------------------
/masstree/kvproto.hh:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #ifndef KVPROTO_HH
17 | #define KVPROTO_HH
18 | #include "compiler.hh"
19 |
20 | enum {
21 | Cmd_None = 0,
22 | Cmd_Get = 2,
23 | Cmd_Scan = 4,
24 | Cmd_Put = 6,
25 | Cmd_Replace = 8,
26 | Cmd_Remove = 10,
27 | Cmd_Checkpoint = 12,
28 | Cmd_Handshake = 14,
29 | Cmd_Max
30 | };
31 |
32 | enum result_t {
33 | NotFound = -2,
34 | Retry,
35 | OutOfDate,
36 | Inserted,
37 | Updated,
38 | Found,
39 | ScanDone
40 | };
41 |
42 | enum ckptrav_order_t {
43 | ckptrav_inorder = 0,
44 | ckptrav_preorder
45 | };
46 |
47 | struct row_marker {
48 | enum { mt_remove = 1, mt_delta = 2 };
49 | int marker_type_;
50 | };
51 |
52 | template
53 | inline bool row_is_marker(const R* row) {
54 | return row->timestamp() & 1;
55 | }
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/pcm/daemon/daemon/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2016, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Steven Briscoe
14 |
15 | #include "daemon.h"
16 |
17 | int main(int argc, char *argv[])
18 | {
19 | PCMDaemon::Daemon daemon(argc, argv);
20 |
21 | return daemon.run();
22 | }
23 |
--------------------------------------------------------------------------------
/pcm/PCM-Lib_Win/pcm-lib.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | ** Written by Otto Bruggeman
16 | */
17 |
18 | // pcm-lib.cpp : Defines the exported functions for the DLL application.
19 | //
20 |
21 |
22 | #include "pcm-lib.h"
23 |
24 |
25 |
--------------------------------------------------------------------------------
/masstree/misc.cc:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #include "misc.hh"
17 | #include
18 | #include "kvthread.hh"
19 |
20 | int clp_parse_suffixdouble(Clp_Parser *clp, const char *vstr,
21 | int complain, void *)
22 | {
23 | const char *post;
24 | if (*vstr == 0 || isspace((unsigned char) *vstr))
25 | post = vstr;
26 | else
27 | clp->val.d = strtod(vstr, (char **) &post);
28 | if (vstr != post && (*post == 'K' || *post == 'k'))
29 | clp->val.d *= 1000, ++post;
30 | else if (vstr != post && (*post == 'M' || *post == 'm'))
31 | clp->val.d *= 1000000, ++post;
32 | else if (vstr != post && (*post == 'B' || *post == 'b' || *post == 'G' || *post == 'g'))
33 | clp->val.d *= 1000000000, ++post;
34 | if (*vstr != 0 && *post == 0)
35 | return 1;
36 | else if (complain)
37 | return Clp_OptionError(clp, "%<%O%> expects a real number, not %<%s%>", vstr);
38 | else
39 | return 0;
40 | }
41 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/atomic_ops/test_and_set_t_is_char.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | /*
24 | * These are common definitions for architectures on which test_and_set
25 | * operates on byte sized quantities, the "clear" value contains
26 | * all zeroes, and the "set" value contains all ones.
27 | */
28 |
29 | #define AO_TS_t unsigned char
30 | typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val;
31 | #define AO_TS_VAL_t AO_BYTE_TS_val
32 | #define AO_TS_CLEAR AO_BYTE_TS_clear
33 | #define AO_TS_SET AO_BYTE_TS_set
34 |
35 | #define AO_CHAR_TS_T 1
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/rotate-skiplist/atomic_ops/test_and_set_t_is_char.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | /*
24 | * These are common definitions for architectures on which test_and_set
25 | * operates on byte sized quantities, the "clear" value contains
26 | * all zeroes, and the "set" value contains all ones.
27 | */
28 |
29 | #define AO_TS_t unsigned char
30 | typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val;
31 | #define AO_TS_VAL_t AO_BYTE_TS_val
32 | #define AO_TS_CLEAR AO_BYTE_TS_clear
33 | #define AO_TS_SET AO_BYTE_TS_set
34 |
35 | #define AO_CHAR_TS_T 1
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/atomic_ops/test_and_set_t_is_ao_t.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | /*
24 | * These are common definitions for architectures on which test_and_set
25 | * operates on pointer-sized quantities, the "clear" value contains
26 | * all zeroes, and the "set" value contains only one lowest bit set.
27 | * This can be used if test_and_set is synthesized from compare_and_swap.
28 | */
29 | typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val;
30 | #define AO_TS_VAL_t AO_TS_val
31 | #define AO_TS_CLEAR AO_TS_clear
32 | #define AO_TS_SET AO_TS_set
33 |
34 | #define AO_TS_t AO_t
35 |
36 | #define AO_AO_TS_T 1
37 |
--------------------------------------------------------------------------------
/rotate-skiplist/atomic_ops/test_and_set_t_is_ao_t.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | /*
24 | * These are common definitions for architectures on which test_and_set
25 | * operates on pointer-sized quantities, the "clear" value contains
26 | * all zeroes, and the "set" value contains only one lowest bit set.
27 | * This can be used if test_and_set is synthesized from compare_and_swap.
28 | */
29 | typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val;
30 | #define AO_TS_VAL_t AO_TS_val
31 | #define AO_TS_CLEAR AO_TS_clear
32 | #define AO_TS_SET AO_TS_set
33 |
34 | #define AO_TS_t AO_t
35 |
36 | #define AO_AO_TS_T 1
37 |
--------------------------------------------------------------------------------
/pcm/WinMSRDriver/Win7/msr.h:
--------------------------------------------------------------------------------
1 | #ifndef MSR_INCLUDED
2 | #define MSR_INCLUDED
3 |
4 | /*
5 | Copyright (c) 2009-2012, Intel Corporation
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
9 |
10 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
13 |
14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 | */
16 | /*
17 | written by Roman Dementiev
18 | */
19 |
20 |
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include "msrstruct.h"
26 |
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/pcm/PCM_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2011, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | // stdafx.cpp : source file that includes just the standard includes
15 | // pcm.pch will be the pre-compiled header
16 | // stdafx.obj will contain the pre-compiled type information
17 |
18 | #include "stdafx.h"
19 |
20 | // TODO: reference any additional headers you need in STDAFX.H
21 | // and not in this file
22 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/skiplist.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Interface for the skip list data stucture.
3 | *
4 | * Author: Ian Dick, 2013
5 | *
6 | */
7 | #ifndef SKIPLIST_H_
8 | #define SKIPLIST_H_
9 |
10 | #include "./atomic_ops/atomic_ops.h"
11 | #include
12 | #include "../indexkey.h"
13 |
14 | #include "common.h"
15 | #include "ptst.h"
16 | #include "garbagecoll.h"
17 |
18 | #define MAX_LEVELS 128
19 |
20 | #define NUM_LEVELS 2
21 | #define NODE_LEVEL 0
22 | #define INODE_LEVEL 1
23 |
24 | #ifndef USE_GENERIC_KEY
25 | using sl_key_t = uint64_t;
26 | #else
27 | using sl_key_t = GenericKey<31>;
28 | #endif
29 | using val_t = void *;
30 |
31 | /* bottom-level nodes */
32 | typedef VOLATILE struct sl_node node_t;
33 | struct sl_node {
34 | sl_key_t key;
35 | val_t val;
36 | struct sl_node *prev;
37 | struct sl_node *next;
38 | unsigned int level;
39 | unsigned int marker;
40 | };
41 |
42 | /* index-level nodes */
43 | typedef VOLATILE struct sl_inode inode_t;
44 | struct sl_inode {
45 | struct sl_inode *right;
46 | struct sl_inode *down;
47 | struct sl_node *node;
48 | };
49 |
50 | /* the skip list set */
51 | typedef VOLATILE struct sl_set set_t;
52 | struct sl_set {
53 | inode_t *top;
54 | node_t *head;
55 | int raises;
56 | };
57 |
58 | node_t* node_new(sl_key_t key, val_t val, node_t *prev, node_t *next,
59 | unsigned int level, ptst_t *ptst);
60 |
61 | inode_t* inode_new(inode_t *right, inode_t *down, node_t *node, ptst_t *ptst);
62 |
63 | void node_delete(node_t *node, ptst_t *ptst);
64 | void inode_delete(inode_t *inode, ptst_t *ptst);
65 |
66 | set_t* set_new(int bg_start);
67 | void set_delete(set_t *set);
68 | void set_print(set_t *set, int flag);
69 | int set_size(set_t *set, int flag);
70 |
71 | void set_subsystem_init(void);
72 |
73 | #endif /* SKIPLIST_H_ */
74 |
--------------------------------------------------------------------------------
/rotate-skiplist/skiplist.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Interface for the skip list data stucture.
3 | *
4 | * Author: Ian Dick, 2013
5 | *
6 | */
7 | #ifndef SKIPLIST_H_
8 | #define SKIPLIST_H_
9 |
10 | #include "./atomic_ops/atomic_ops.h"
11 |
12 | #include "common.h"
13 | #include "ptst.h"
14 | #include "garbagecoll.h"
15 | #include
16 | #include "../indexkey.h"
17 |
18 | #define MAX_LEVELS 30
19 |
20 | #define NUM_SIZES 1
21 | #define NODE_SIZE 0
22 |
23 | #define IDX(_i, _z) ((_z) + (_i)) % MAX_LEVELS
24 | extern unsigned long sl_zero;
25 |
26 | #ifndef USE_GENERIC_KEY
27 | using sl_key_type = uint64_t;
28 | #else
29 | using sl_key_type = GenericKey<31>;
30 | #endif
31 | // Always need a void * value type
32 | using sl_value_type = void *;
33 |
34 | /* bottom-level nodes */
35 | typedef VOLATILE struct sl_node node_t;
36 | struct sl_node {
37 | unsigned long level;
38 | struct sl_node *prev;
39 | struct sl_node *next;
40 | sl_key_type key;
41 | sl_value_type val;
42 | struct sl_node *succs[MAX_LEVELS];
43 | unsigned long marker;
44 | unsigned long raise_or_remove;
45 | };
46 |
47 | /* the skip list set */
48 | typedef struct sl_set set_t;
49 | struct sl_set {
50 | struct sl_node *head;
51 | };
52 |
53 | node_t* node_new(sl_key_type key, sl_value_type val, node_t *prev, node_t *next,
54 | unsigned int level, ptst_t *ptst);
55 |
56 | node_t* marker_new(node_t *prev, node_t *next, ptst_t *ptst);
57 |
58 | void node_delete(node_t *node, ptst_t *ptst);
59 | void marker_delete(node_t *node, ptst_t *ptst);
60 |
61 | set_t* set_new(int start);
62 | void set_delete(set_t *set);
63 | void set_print(set_t *set, int flag);
64 | int set_size(set_t *set, int flag);
65 |
66 | void set_subsystem_init(void);
67 | void set_print_nodenums(set_t *set, int flag);
68 |
69 | #endif /* SKIPLIST_H_ */
70 |
--------------------------------------------------------------------------------
/masstree/kvstats.hh:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #ifndef KVSTATS_HH
17 | #define KVSTATS_HH 1
18 | #include
19 |
20 | struct kvstats {
21 | double min, max, sum, sumsq;
22 | long count;
23 | kvstats()
24 | : min(-1), max(-1), sum(0), sumsq(0), count(0) {
25 | }
26 | void add(double x) {
27 | if (!count || x < min)
28 | min = x;
29 | if (max < x)
30 | max = x;
31 | sum += x;
32 | sumsq += x * x;
33 | count += 1;
34 | }
35 | typedef void (kvstats::*unspecified_bool_type)(double);
36 | operator unspecified_bool_type() const {
37 | return count ? &kvstats::add : 0;
38 | }
39 | void print_report(const char *name) const {
40 | if (count)
41 | printf("%s: n %ld, total %.0f, average %.0f, min %.0f, max %.0f, stddev %.0f\n",
42 | name, count, sum, sum / count, min, max,
43 | sqrt((sumsq - sum * sum / count) / (count - 1)));
44 | }
45 | double avg() {
46 | if (count)
47 | return sum / count;
48 | else
49 | return 0;
50 | }
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr/PcmMsr-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | PcmMsrDriver
9 | CFBundleIdentifier
10 | com.intel.driver.PcmMsr
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | PcmMsrDriver
15 | CFBundlePackageType
16 | KEXT
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | IOKitPersonalities
24 |
25 | PcmMsrClient
26 |
27 | CFBundleIdentifier
28 | com.intel.driver.PcmMsr
29 | IOClass
30 | com_intel_driver_PcmMsr
31 | IOMatchCategory
32 | com_intel_driver_PcmMsr
33 | IOProbeScore
34 | 1000
35 | IOProviderClass
36 | IOResources
37 | IOResourceMatch
38 | IOKit
39 | IOUserClientClass
40 | com_intel_driver_PcmMsrClient
41 |
42 |
43 | OSBundleLibraries
44 |
45 | com.apple.kpi.bsd
46 | 10.9
47 | com.apple.kpi.mach
48 | 10.9
49 | com.apple.kpi.unsupported
50 | 10.9
51 | com.apple.kpi.iokit
52 | 10.9
53 | com.apple.kpi.libkern
54 | 10.9
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/atomic_ops/aligned_atomic_load_store.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | /*
24 | * Definitions for architectures on which loads and stores of AO_t are
25 | * atomic fo all legal alignments.
26 | */
27 |
28 | AO_INLINE AO_t
29 | AO_load(const volatile AO_t *addr)
30 | {
31 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0);
32 | /* Cast away the volatile for architectures where */
33 | /* volatile adds barrier semantics. */
34 | return *(AO_t *)addr;
35 | }
36 |
37 | #define AO_HAVE_load
38 |
39 | AO_INLINE void
40 | AO_store(volatile AO_t *addr, AO_t new_val)
41 | {
42 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0);
43 | (*(AO_t *)addr) = new_val;
44 | }
45 |
46 | #define AO_HAVE_store
47 |
--------------------------------------------------------------------------------
/rotate-skiplist/atomic_ops/aligned_atomic_load_store.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | /*
24 | * Definitions for architectures on which loads and stores of AO_t are
25 | * atomic fo all legal alignments.
26 | */
27 |
28 | AO_INLINE AO_t
29 | AO_load(const volatile AO_t *addr)
30 | {
31 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0);
32 | /* Cast away the volatile for architectures where */
33 | /* volatile adds barrier semantics. */
34 | return *(AO_t *)addr;
35 | }
36 |
37 | #define AO_HAVE_load
38 |
39 | AO_INLINE void
40 | AO_store(volatile AO_t *addr, AO_t new_val)
41 | {
42 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0);
43 | (*(AO_t *)addr) = new_val;
44 | }
45 |
46 | #define AO_HAVE_store
47 |
--------------------------------------------------------------------------------
/masstree/mtIndexAPI.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include "mtIndexAPI.hh"
3 |
4 | volatile uint64_t globalepoch = 1;
5 | volatile bool recovering = false;
6 | kvtimestamp_t initial_timestamp;
7 | kvepoch_t global_log_epoch = 0;
8 |
9 | /*
10 | template
11 | void mt_index::setup() {
12 | ti_ = new threadinfo();
13 | ti_->rcu_start();
14 | table_ = new T;
15 | table_->initialize(*ti_);
16 | }
17 |
18 | template
19 | void mt_index::put(const Str &key, const Str &value) {
20 | q_[0].run_replace(table_->table(), key, value, *ti_);
21 | }
22 |
23 | template
24 | void mt_index::put(const char *key, int keylen, const char *value, int valuelen) {
25 | put(Str(key, keylen), Str(value, valuelen));
26 | }
27 |
28 | template
29 | bool mt_index::get(const char *key, int keylen, Str &value) {
30 | return q_[0].run_get1(table_->table(), Str(key, keylen), 0, value, *ti_);
31 | }
32 | */
33 | /*
34 | template
35 | bool mt_index::remove(const Str &key) {
36 | return q_[0].run_remove(table_->table(), key, *ti_);
37 | }
38 |
39 | template
40 | bool mt_index::remove(const char *key, int keylen) {
41 | return remove(Str(key, keylen));
42 | }
43 | */
44 | /*
45 | int main () {
46 | std::cout << "test\n";
47 | mt_index mti;
48 |
49 | mti.setup();
50 |
51 | mti.put("huanchen", 8, "yingjie", 7);
52 | mti.put("zhuo", 4, "yangzi", 6);
53 | mti.put("julian", 6, "wenlu", 5);
54 | Str value;
55 | bool get_success;
56 | get_success = mti.get("huanchen", 8, value);
57 | std::cout << get_success << "\t" << value.s << "\n";
58 | get_success = mti.get("zhuo", 4, value);
59 | std::cout << get_success << "\t" << value.s << "\n";
60 | get_success = mti.get("julian", 6, value);
61 | std::cout << get_success << "\t" << value.s << "\n";
62 | get_success = mti.get("dave", 4, value);
63 | std::cout << get_success << "\t" << value.s << "\n";
64 |
65 | return 0;
66 | }
67 | */
68 |
--------------------------------------------------------------------------------
/masstree/LICENSE:
--------------------------------------------------------------------------------
1 | This software is subject to the license below, which is referenced
2 | elsewhere using the phrase "the Masstree LICENSE file". This license
3 | is an MIT license, plus a clause (taken from the W3C license)
4 | requiring prior written permission to use our names in publicity. The
5 | AUTHORS file lists the people who have contributed to this software.
6 |
7 | ===========================================================================
8 |
9 | (c) 2011-2013 President and Fellows of Harvard College
10 | (c) 2010-2011 Regents of the University of California
11 | (c) 2010-2013 Massachusetts Institute of Technology
12 |
13 | Permission is hereby granted, free of charge, to any person obtaining a
14 | copy of this software and associated documentation files (the "Software"),
15 | to deal in the Software without restriction, including without limitation
16 | the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 | and/or sell copies of the Software, and to permit persons to whom the
18 | Software is furnished to do so, subject to the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be included in
21 | all copies or substantial portions of the Software.
22 |
23 | The name and trademarks of copyright holders may NOT be used in advertising
24 | or publicity pertaining to the Software without specific, written prior
25 | permission. Title to copyright in this Software and any associated
26 | documentation will at all times remain with copyright holders.
27 |
28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
34 | DEALINGS IN THE SOFTWARE.
35 |
--------------------------------------------------------------------------------
/pcm/daemon/daemon/pcm.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2016, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Steven Briscoe
14 |
15 | #ifndef PCM_H_
16 | #define PCM_H_
17 |
18 | #ifdef _MSC_VER
19 | #include
20 | #include "../../../PCM_Win/windriver.h"
21 | #else
22 | #include
23 | #include
24 | #include // for gettimeofday()
25 | #endif
26 | #include "../../cpucounters.h"
27 | #include "../../utils.h"
28 | #ifdef _MSC_VER
29 | #include "../../freegetopt/getopt.h"
30 | #endif
31 |
32 | #endif /* PCM_H_ */
33 |
--------------------------------------------------------------------------------
/pcm/freegetopt/README:
--------------------------------------------------------------------------------
1 | Free Getopt
2 |
3 | ******************************************************************************
4 | Please read the file LICENSE for the terms of use and distribution of this
5 | software.
6 | ******************************************************************************
7 |
8 | "getopt" is a library that allows a parsing of arguments passed
9 | to a program. This is a useful library used in many software.
10 | There are many versions of the getopt library available, two
11 | popular versions being the BSD getopt and the GNU getopt.
12 |
13 | BSD getopt is somewhat old, dated, and isn't very user-friendly.
14 | The GNU getopt is great, except the user license doesn't let you
15 | statically link the library to a proprietary software. This
16 | is usually not a problem on modern operating systems that allow
17 | dynamic links to libraries, but sometimes you just gotta link
18 | the library statically for one reason or another. That's where
19 | Free Getopt steps in.
20 |
21 | Functionally, this getopt library is equivalent to GNU's getopt
22 | library (the short option version, not the long one) in almost
23 | every aspect. The only exception is how the "optind" variable
24 | increments. Apparently due to different algorithms used by my
25 | program and the GNU getopt, the "optind" changes quite differently
26 | between our two software. I personally find my algorithm to be
27 | quite elegant; I couldn't tell you about the GNU version since
28 | I never looked at its source.
29 |
30 | GNU's getopt_long support is in progress.
31 |
32 | This library was deliberately left in non-library (not in
33 | *.lib, *.so, or *.a) form because it's most likely to be
34 | statically-linked in various platforms, and linking it
35 | directly from source is probably the most straight-forward
36 | way to use the software in any platform.
37 |
38 | I hope you find this software useful.
39 |
40 | Mark K. Kim
41 |
42 | $Header: /cvsroot/freegetopt/freegetopt/README,v 1.2 2003/10/26 03:10:19 vindaci Exp $
43 |
44 |
--------------------------------------------------------------------------------
/masstree/mtcounters.hh:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #ifndef MTCOUNTERS_HH
17 | #define MTCOUNTERS_HH 1
18 |
19 | enum memtag {
20 | memtag_none = 0x0,
21 | memtag_value = 0x1,
22 | memtag_limbo = 0x5,
23 | memtag_masstree_leaf = 0x10,
24 | memtag_masstree_internode = 0x11,
25 | memtag_masstree_ksuffixes = 0x12,
26 | memtag_masstree_gc = 0x13
27 | };
28 |
29 | enum threadcounter {
30 | // order is important among tc_alloc constants:
31 | tc_alloc,
32 | tc_alloc_value = tc_alloc,
33 | tc_alloc_other = tc_alloc + 1,
34 | // end tc_alloc constants
35 | tc_gc,
36 | tc_limbo_slots,
37 | tc_replay_create_delta,
38 | tc_replay_remove_delta,
39 | tc_root_retry,
40 | tc_internode_retry,
41 | tc_leaf_retry,
42 | tc_leaf_walk,
43 | // order is important among tc_stable constants:
44 | tc_stable,
45 | tc_stable_internode_insert = tc_stable + 0,
46 | tc_stable_internode_split = tc_stable + 1,
47 | tc_stable_leaf_insert = tc_stable + 2,
48 | tc_stable_leaf_split = tc_stable + 3,
49 | // end tc_stable constants
50 | tc_internode_lock,
51 | tc_leaf_lock,
52 | tc_max
53 | };
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/masstree/testrunner.hh:
--------------------------------------------------------------------------------
1 | #ifndef MASSTREE_TESTRUNNER_HH
2 | #define MASSTREE_TESTRUNNER_HH
3 | #include "string.hh"
4 | #include
5 |
6 | class testrunner_base {
7 | public:
8 | testrunner_base(const lcdf::String& name)
9 | : name_(name), next_(0) {
10 | thehead ? thetail->next_ = this : thehead = this;
11 | thetail = this;
12 | }
13 | virtual ~testrunner_base() {
14 | }
15 | const lcdf::String& name() const {
16 | return name_;
17 | }
18 | static testrunner_base* first() {
19 | return thehead;
20 | }
21 | static testrunner_base* find(const lcdf::String& name) {
22 | testrunner_base* t = thehead;
23 | while (t && t->name_ != name)
24 | t = t->next_;
25 | return t;
26 | }
27 | static void print_names(FILE* stream, int maxcol);
28 | private:
29 | static testrunner_base* thehead;
30 | static testrunner_base* thetail;
31 | lcdf::String name_;
32 | testrunner_base* next_;
33 | };
34 |
35 | #ifdef TESTRUNNER_CLIENT_TYPE
36 |
37 | class testrunner : public testrunner_base {
38 | public:
39 | inline testrunner(const lcdf::String& name)
40 | : testrunner_base(name) {
41 | }
42 | static testrunner* first() {
43 | return static_cast(testrunner_base::first());
44 | }
45 | static testrunner* find(const lcdf::String& name) {
46 | return static_cast(testrunner_base::find(name));
47 | }
48 | virtual void run(TESTRUNNER_CLIENT_TYPE) = 0;
49 | };
50 |
51 | #define MAKE_TESTRUNNER(name, text) \
52 | namespace { \
53 | class testrunner_##name : public testrunner { \
54 | public: \
55 | testrunner_##name() : testrunner(#name) {} \
56 | void run(TESTRUNNER_CLIENT_TYPE client) { text; client.finish(); } \
57 | }; static testrunner_##name testrunner_##name##_instance; }
58 |
59 | #endif
60 | #endif
61 |
--------------------------------------------------------------------------------
/pcm/PCM-Lib_Win/dllmain.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | ** Written by Otto Bruggeman
16 | */
17 |
18 | // dllmain.cpp : Defines the entry point for the DLL application.
19 |
20 | #include
21 |
22 | BOOL APIENTRY DllMain( HMODULE hModule,
23 | DWORD ul_reason_for_call,
24 | LPVOID lpReserved
25 | )
26 | {
27 | switch (ul_reason_for_call)
28 | {
29 | case DLL_PROCESS_ATTACH:
30 | case DLL_THREAD_ATTACH:
31 | case DLL_THREAD_DETACH:
32 | case DLL_PROCESS_DETACH:
33 | break;
34 | }
35 | return TRUE;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/pcm/PCM_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | /*
7 | Copyright (c) 2009-2011, Intel Corporation
8 | All rights reserved.
9 |
10 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
11 |
12 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
13 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
14 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 | */
18 |
19 | #pragma once
20 |
21 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
22 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
23 | #endif
24 |
25 | #include
26 | #include
27 |
28 |
29 | // TODO: reference additional headers your program requires here
30 |
--------------------------------------------------------------------------------
/masstree/checkpoint.hh:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #ifndef MASSTREE_CHECKPOINT_HH
17 | #define MASSTREE_CHECKPOINT_HH
18 | #include "kvrow.hh"
19 | #include "kvio.hh"
20 | #include "msgpack.hh"
21 |
22 | struct ckstate {
23 | kvout *vals; // key, val, timestamp in msgpack
24 | uint64_t count; // total nodes written
25 | uint64_t bytes;
26 | pthread_cond_t state_cond;
27 | volatile int state;
28 | threadinfo *ti;
29 | Str startkey;
30 | Str endkey;
31 |
32 | template
33 | void visit_leaf(const SS&, const K&, threadinfo&) {
34 | }
35 | bool visit_value(Str key, const row_type* value, threadinfo& ti);
36 |
37 | template
38 | static void insert(T& table, msgpack::parser& par, threadinfo& ti);
39 | };
40 |
41 | template
42 | void ckstate::insert(T& table, msgpack::parser& par, threadinfo& ti) {
43 | Str key;
44 | kvtimestamp_t ts{};
45 | par >> key >> ts;
46 | row_type* row = row_type::checkpoint_read(par, ts, ti);
47 |
48 | typename T::cursor_type lp(table, key);
49 | bool found = lp.find_insert(ti);
50 | masstree_invariant(!found); (void) found;
51 | ti.advance_timestamp(lp.node_timestamp());
52 | lp.value() = row;
53 | lp.finish(1, ti);
54 | }
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/masstree/timestamp.hh:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #ifndef TIMESTAMP_HH
17 | #define TIMESTAMP_HH
18 | #include "compiler.hh"
19 | #include
20 | #include
21 | #include
22 |
23 | #if HAVE_INT64_T_IS_LONG_LONG
24 | #define PRIuKVTS "llu"
25 | #else
26 | #define PRIuKVTS "lu"
27 | #endif
28 | #define PRIKVTSPARTS "%lu.%06lu"
29 |
30 | #define KVTS_HIGHPART(t) ((unsigned long) ((t) >> 32))
31 | #define KVTS_LOWPART(t) ((unsigned long) (uint32_t) (t))
32 |
33 | typedef uint64_t kvtimestamp_t;
34 |
35 | inline kvtimestamp_t timestamp() {
36 | struct timeval tv;
37 | gettimeofday(&tv, 0);
38 | return ((kvtimestamp_t) tv.tv_sec << 32) | (unsigned int)tv.tv_usec;
39 | }
40 |
41 | inline kvtimestamp_t timestamp_sub(kvtimestamp_t a, kvtimestamp_t b) {
42 | a -= b;
43 | if (KVTS_LOWPART(a) > 999999)
44 | a -= ((kvtimestamp_t) 1 << 32) - 1000000;
45 | return a;
46 | }
47 |
48 | extern kvtimestamp_t initial_timestamp;
49 |
50 | inline double now() {
51 | struct timeval tv;
52 | gettimeofday(&tv, 0);
53 | return tv.tv_sec + tv.tv_usec / 1000000.0;
54 | }
55 |
56 | inline struct timespec &set_timespec(struct timespec &x, double y) {
57 | double ipart = floor(y);
58 | x.tv_sec = (long) ipart;
59 | x.tv_nsec = (long) ((y - ipart) * 1e9);
60 | return x;
61 | }
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/masstree/doc/examples.mp:
--------------------------------------------------------------------------------
1 | input masstree;
2 | verbatimtex %&latex
3 | \documentclass[12pt]{article}
4 | \usepackage{elemfig,amsmath}
5 | \begin{document}
6 | \newcommand{\xlab}[1]{\mlabel{\textsc{#1}}}
7 | etex;
8 |
9 | picture data[];
10 | data[0] = btex \xlab{a} etex; data[1] = btex \xlab{b} etex; data[2] = btex \xlab{c} etex;
11 | data[3] = btex \xlab{d} etex; data[4] = btex \xlab{e} etex; data[5] = btex \xlab{f} etex;
12 | data[6] = btex \xlab{g} etex; data[7] = btex \xlab{h} etex; data[8] = btex \xlab{i} etex;
13 | data[9] = btex \xlab{j} etex; data[10] = btex \xlab{k} etex; data[11] = btex \xlab{l} etex;
14 | data[12] = btex \xlab{m} etex; data[13] = btex \xlab{n} etex; data[14] = btex \xlab{o} etex;
15 |
16 | pair min_reasonable_cell; min_reasonable_cell := (0,0);
17 | for _i_ = 0 upto 14:
18 | min_reasonable_cell :=
19 | (max(xpart min_reasonable_cell, xpart (urcorner data[_i_] - llcorner data[_i_])),
20 | max(ypart min_reasonable_cell, ypart (urcorner data[_i_] - llcorner data[_i_])));
21 | endfor;
22 | color deletedelement; deletedelement = .5white;
23 |
24 | picture emptyqueue; emptyqueue := btex \phantom{\elementlabel{Queue}} etex;
25 | picture vemptyqueue; vemptyqueue := emptyqueue rotated 90 xscaled .4;
26 | hardborderscale = 3;
27 |
28 | beginfig(1);
29 | % initial tree
30 | boxjoin(b.w - a.e = (20,0));
31 | leafit.a(data[0], data[1], data[2]);
32 | leafit.d(data[3], data[4], data[5]);
33 | leafit.g(data[6], data[7], data[8]);
34 | leafit.j(data[9], data[10], data[11]);
35 | leafit.m(data[12], data[13], data[14]);
36 | boxjoin();
37 | internalnodeit.ina(data[3], data[6], nullpicture);
38 | internalnodeit.inj(data[12], nullpicture, nullpicture);
39 | internalnodeit.root(data[9], nullpicture, nullpicture);
40 | ina.s = .5[a.nw,g.ne] + (0,24);
41 | inj.s = .5[j.nw,m.ne] + (0,24);
42 | root.s = .5[ina.nw,inj.ne] + (0,24);
43 | fixelement(a,d,g,j,m);
44 | fixelement(root,ina,inj);
45 | leafconnect(a,d,g,j,m);
46 | drawelement(a,d,g,j,m,ina,inj,root);
47 | internalnodeconnect(ina,a,d,g);
48 | internalnodeconnect(inj,j,m);
49 | internalnodeconnect(root,ina,inj);
50 | label.lft(btex \small{(1)~~} etex, inj.w);
51 | endfig;
52 |
53 | end
54 |
--------------------------------------------------------------------------------
/pcm/PCM_Win/restrictDriverAccess.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | #include
14 | #include
15 |
16 | //! restrict usage of driver to system (SY) and builtin admins (BA)
17 | void restrictDriverAccess(LPCWSTR path)
18 | {
19 | try {
20 | System::Security::AccessControl::FileSecurity^ fSecurity = System::IO::File::GetAccessControl(gcnew System::String(path));
21 | fSecurity->SetSecurityDescriptorSddlForm("O:BAG:SYD:(A;;FA;;;SY)(A;;FA;;;BA)");
22 | System::IO::File::SetAccessControl(gcnew System::String(path), fSecurity);
23 | }
24 | catch (...)
25 | {
26 | std::wcerr << "Error in GetAccessControl/SetSecurityDescriptorSddlForm for " << path << " driver." << std::endl;
27 | }
28 | }
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/MSRAccessorPublic.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #ifndef MSRACCESSOR_HEADER
16 | #define MSRACCESSOR_HEADER
17 |
18 | #include
19 | #include
20 | class MSRAccessor{
21 | private:
22 | uint64_t num_cores;
23 | void closeConnection();
24 | public:
25 | MSRAccessor();
26 | int32_t read(uint32_t cpu_num, uint64_t msr_num, uint64_t * value);
27 | int32_t write(uint32_t cpu_num, uint64_t msr_num, uint64_t value);
28 | int32_t buildTopology(uint32_t num_cores, void*);
29 | uint32_t getNumInstances();
30 | uint32_t incrementNumInstances();
31 | uint32_t decrementNumInstances();
32 | ~MSRAccessor();
33 | };
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/masstree/kvio.hh:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2014 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2014 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #ifndef KVIO_H
17 | #define KVIO_H
18 | #include
19 | #include
20 | #include
21 | #include "string.hh"
22 | #include "str.hh"
23 |
24 | struct kvout {
25 | int fd;
26 | char* buf;
27 | unsigned capacity; // allocated size of buf
28 | unsigned n; // # of chars we've written to buf
29 |
30 | inline void append(char c);
31 | inline char* reserve(int n);
32 | inline void adjust_length(int delta);
33 | inline void set_end(char* end);
34 | void grow(unsigned want);
35 | };
36 |
37 | kvout* new_kvout(int fd, int buflen);
38 | kvout* new_bufkvout();
39 | void kvout_reset(kvout* kv);
40 | void free_kvout(kvout* kv);
41 | int kvwrite(kvout* kv, const void* buf, unsigned int n);
42 | void kvflush(kvout* kv);
43 |
44 | inline void kvout::append(char c) {
45 | if (n == capacity)
46 | grow(0);
47 | buf[n] = c;
48 | ++n;
49 | }
50 |
51 | inline char* kvout::reserve(int nchars) {
52 | if (n + nchars > capacity)
53 | grow(n + nchars);
54 | return buf + n;
55 | }
56 |
57 | inline void kvout::adjust_length(int delta) {
58 | masstree_precondition(n + delta <= capacity);
59 | n += delta;
60 | }
61 |
62 | inline void kvout::set_end(char* x) {
63 | masstree_precondition(x >= buf && x <= buf + capacity);
64 | n = x - buf;
65 | }
66 |
67 | #endif
68 |
--------------------------------------------------------------------------------
/pcm/daemon/client/client.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2016, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Steven Briscoe
14 |
15 | #include
16 | #include
17 | #include
18 |
19 |
20 | #ifndef CLIENT_H_
21 | #define CLIENT_H_
22 |
23 | #include "../daemon/common.h"
24 |
25 | namespace PCMDaemon {
26 |
27 | class Client {
28 | public:
29 | Client();
30 | void setPollInterval(int pollMs);
31 | PCMDaemon::SharedPCMState& read();
32 | bool countersHaveUpdated();
33 | private:
34 | void setupSharedMemory(key_t key = SHARED_MEMORY_KEY);
35 |
36 | int pollIntervalMs_;
37 | PCMDaemon::SharedPCMState* sharedPCMState_;
38 | PCMDaemon::uint64 lastUpdatedClientTsc_;
39 | };
40 |
41 | }
42 |
43 |
44 | #endif /* CLIENT_H_ */
45 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/MSRAccessor.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #include
16 | extern "C" {
17 | #include "DriverInterface.h"
18 | }
19 |
20 | class MSRAccessor{
21 | private:
22 | io_service_t service;
23 | io_connect_t connect;
24 | kern_return_t openConnection();
25 | void closeConnection();
26 | public:
27 | MSRAccessor();
28 | int32_t read(uint32_t cpu_num,uint64_t msr_num, uint64_t * value);
29 | int32_t write(uint32_t cpu_num, uint64_t msr_num, uint64_t value);
30 | int32_t buildTopology(uint32_t num_cores, void*);
31 |
32 | uint32_t getNumInstances();
33 | uint32_t incrementNumInstances();
34 | uint32_t decrementNumInstances();
35 | ~MSRAccessor();
36 | };
37 |
--------------------------------------------------------------------------------
/masstree/testrunner.cc:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #include "testrunner.hh"
17 | #include
18 | #include
19 | #include
20 |
21 | testrunner_base* testrunner_base::thehead;
22 | testrunner_base* testrunner_base::thetail;
23 |
24 | void testrunner_base::print_names(FILE* stream, int ncol) {
25 | masstree_precondition(ncol >= 1);
26 |
27 | std::vector names;
28 | for (testrunner_base* tr = thehead; tr; tr = tr->next_)
29 | names.push_back(tr->name());
30 |
31 | size_t percol;
32 | std::vector colwidth;
33 | while (1) {
34 | percol = (names.size() + ncol - 1) / ncol;
35 | colwidth.assign(ncol, 0);
36 | for (size_t i = 0; i != names.size(); ++i)
37 | colwidth[i/percol] = std::max(colwidth[i/percol], names[i].length());
38 | if (ncol == 1
39 | || std::accumulate(colwidth.begin(), colwidth.end(), 0)
40 | + ncol * 3 <= 78)
41 | break;
42 | --ncol;
43 | }
44 |
45 | for (size_t row = 0; row != percol; ++row) {
46 | size_t off = row;
47 | for (int col = 0; col != ncol; ++col, off += percol)
48 | if (off < names.size())
49 | fprintf(stream, "%*s %s",
50 | col ? colwidth[col-1] - names[off-percol].length() : 0, "",
51 | names[off].c_str());
52 | fprintf(stream, "\n");
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/pcm/PCM-Lib_Win/pcm-lib.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | ** Written by Otto Bruggeman
16 | */
17 |
18 | // The following ifdef block is the standard way of creating macros which make exporting
19 | // from a DLL simpler. All files within this DLL are compiled with the PCM_EXPORTS
20 | // symbol defined on the command line. this symbol should not be defined on any project
21 | // that uses this DLL. This way any other project whose source files include this file see
22 | // PCM_API functions as being imported from a DLL, whereas this DLL sees symbols
23 | // defined with this macro as being exported.
24 | #ifdef PCM_EXPORTS
25 | #define PCM_API __declspec(dllexport)
26 | #else
27 | #define PCM_API __declspec(dllimport)
28 | #endif
29 |
30 | #include "..\cpucounters.h"
31 |
--------------------------------------------------------------------------------
/masstree/compiler.cc:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2014 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2014 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #include "compiler.hh"
17 | #include
18 | #include
19 |
20 | void fail_always_assert(const char* file, int line,
21 | const char* assertion, const char* message) {
22 | if (message)
23 | fprintf(stderr, "assertion \"%s\" [%s] failed: file \"%s\", line %d\n",
24 | message, assertion, file, line);
25 | else
26 | fprintf(stderr, "assertion \"%s\" failed: file \"%s\", line %d\n",
27 | assertion, file, line);
28 | abort();
29 | }
30 |
31 | void fail_masstree_invariant(const char* file, int line,
32 | const char* assertion, const char* message) {
33 | if (message)
34 | fprintf(stderr, "invariant \"%s\" [%s] failed: file \"%s\", line %d\n",
35 | message, assertion, file, line);
36 | else
37 | fprintf(stderr, "invariant \"%s\" failed: file \"%s\", line %d\n",
38 | assertion, file, line);
39 | abort();
40 | }
41 |
42 | void fail_masstree_precondition(const char* file, int line,
43 | const char* assertion, const char* message) {
44 | if (message)
45 | fprintf(stderr, "precondition \"%s\" [%s] failed: file \"%s\", line %d\n",
46 | message, assertion, file, line);
47 | else
48 | fprintf(stderr, "precondition \"%s\" failed: file \"%s\", line %d\n",
49 | assertion, file, line);
50 | abort();
51 | }
52 |
--------------------------------------------------------------------------------
/pcm/freegetopt/getopt.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | * getopt.h - competent and free getopt library.
3 | * $Header: /cvsroot/freegetopt/freegetopt/getopt.h,v 1.2 2003/10/26 03:10:20 vindaci Exp $
4 | *
5 | * Copyright (c)2002-2003 Mark K. Kim
6 | * All rights reserved.
7 | *
8 | * Redistribution and use in source and binary forms, with or without
9 | * modification, are permitted provided that the following conditions
10 | * are met:
11 | *
12 | * * Redistributions of source code must retain the above copyright
13 | * notice, this list of conditions and the following disclaimer.
14 | *
15 | * * Redistributions in binary form must reproduce the above copyright
16 | * notice, this list of conditions and the following disclaimer in
17 | * the documentation and/or other materials provided with the
18 | * distribution.
19 | *
20 | * * Neither the original author of this software nor the names of its
21 | * contributors may be used to endorse or promote products derived
22 | * from this software without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
31 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
34 | * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
35 | * DAMAGE.
36 | */
37 | #ifndef GETOPT_H_
38 | #define GETOPT_H_
39 |
40 |
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 |
46 | extern char* optarg;
47 | extern int optind;
48 | extern int opterr;
49 | extern int optopt;
50 |
51 | int getopt(int argc, char** argv, char* optstr);
52 |
53 |
54 | #ifdef __cplusplus
55 | }
56 | #endif
57 |
58 |
59 | #endif /* GETOPT_H_ */
60 |
61 |
62 | /* vim:ts=3
63 | */
64 |
--------------------------------------------------------------------------------
/pcm/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2009-2015 Intel Corporation
3 | # written by Roman Dementiev and Jim Harris
4 | #
5 |
6 | EXE = pcm-numa.x pcm-power.x pcm.x pcm-sensor.x pcm-msr.x pcm-memory.x pcm-tsx.x pcm-pcie.x pcm-core.x
7 |
8 | all: lib
9 |
10 | lib: libPCM.a
11 |
12 | klocwork: $(EXE)
13 |
14 | CXXFLAGS += -Wall -g -O3 -Wno-unknown-pragmas
15 |
16 | # rely on Linux perf support (user needs CAP_SYS_ADMIN privileges), comment out to disable
17 | ifneq ($(wildcard /usr/include/linux/perf_event.h),)
18 | CXXFLAGS += -DPCM_USE_PERF
19 | endif
20 |
21 | UNAME:=$(shell uname)
22 |
23 | ifeq ($(UNAME), Linux)
24 | LIB= -pthread -lrt
25 | CXXFLAGS += -std=c++11
26 | endif
27 | ifeq ($(UNAME), DragonFly)
28 | LIB= -pthread -lrt
29 | CXXFLAGS += -std=c++0x
30 | endif
31 | ifeq ($(UNAME), Darwin)
32 | LIB= -lpthread MacMSRDriver/build/Release/libPcmMsr.dylib
33 | CXXFLAGS += -I/usr/include -IMacMSRDriver -std=c++0x
34 | endif
35 | ifeq ($(UNAME), FreeBSD)
36 | CXX=c++
37 | LIB= -lpthread -lc++
38 | CXXFLAGS += -std=c++0x
39 | endif
40 |
41 | COMMON_OBJS = msr.o cpucounters.o pci.o client_bw.o utils.o
42 | EXE_OBJS = $(EXE:.x=.o)
43 | OBJS = $(COMMON_OBJS) $(EXE_OBJS)
44 |
45 | # ensure 'make' does not delete the intermediate .o files
46 | .PRECIOUS: $(OBJS)
47 |
48 | -include $(OBJS:.o=.d)
49 | libPCM.a: $(OBJS)
50 | ar -rcs $@ $^
51 |
52 | %.x: %.o $(COMMON_OBJS)
53 | $(CXX) -o $@ $^ $(LIB)
54 |
55 | %.o: %.cpp
56 | $(CXX) $(CXXFLAGS) -c $*.cpp -o $*.o
57 | @# the following lines generate dependency files for the
58 | @# target object
59 | @# from http://scottmcpeak.com/autodepend/autodepend.html
60 | $(CXX) -MM $(CXXFLAGS) $*.cpp > $*.d
61 | @# these sed/fmt commands modify the .d file to add a target
62 | @# rule for each .h and .cpp file with no dependencies;
63 | @# this will force 'make' to rebuild any objects that
64 | @# depend on a file that has been renamed rather than
65 | @# exiting with an error
66 | @mv -f $*.d $*.d.tmp
67 | @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
68 | @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
69 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
70 | @rm -f $*.d.tmp
71 |
72 | nice:
73 | uncrustify --replace -c ~/uncrustify.cfg *.cpp *.h WinMSRDriver/Win7/*.h WinMSRDriver/Win7/*.c WinMSRDriver/WinXP/*.h WinMSRDriver/WinXP/*.c PCM_Win/*.h PCM_Win/*.cpp
74 |
75 | clean:
76 | rm -rf *.x *.o *~ *.d
77 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr.xcodeproj/xcuserdata/aiott.xcuserdatad/xcschemes/PcmMsr.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
14 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
41 |
42 |
43 |
44 |
50 |
51 |
53 |
54 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PcmMsr.xcodeproj/xcuserdata/aiott.xcuserdatad/xcschemes/PcmMsrLibrary.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
14 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
41 |
42 |
43 |
44 |
50 |
51 |
53 |
54 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/masstree/GNUmakefile.in:
--------------------------------------------------------------------------------
1 | AR = ar
2 | CC = @CC@
3 | CXX = @CXX@
4 | CFLAGS = -g -W -Wall -O2 -fPIC
5 | DEPSDIR := .deps
6 | DEPCFLAGS = -MD -MF $(DEPSDIR)/$*.d -MP
7 | ifeq ($(strip $(MEMMGR)), )
8 | MEMMGR = @MALLOC_LIBS@
9 | endif
10 | ifneq ($(strip $(KEYSWAP)), )
11 | CFLAGS += -DKEYSWAP
12 | endif
13 | ifneq ($(strip $(NOPREFETCH)), )
14 | CFLAGS += -DNOPREFETCH
15 | endif
16 | ifneq ($(strip $(NOSUPERPAGE)), )
17 | CFLAGS += -DNOSUPERPAGE
18 | endif
19 | LIBS = @LIBS@ -lpthread -lm
20 | LDFLAGS = @LDFLAGS@
21 |
22 | all: mtIndexAPI.a
23 |
24 | %.o: %.c config.h $(DEPSDIR)/stamp
25 | $(CXX) $(CFLAGS) $(DEPCFLAGS) -include config.h -c -o $@ $<
26 |
27 | %.o: %.cc config.h $(DEPSDIR)/stamp
28 | $(CXX) $(CFLAGS) $(DEPCFLAGS) -include config.h -c -o $@ $<
29 |
30 | %.S: %.o
31 | objdump -S $< > $@
32 |
33 | libjson.a: json.o string.o straccum.o str.o msgpack.o \
34 | clp.o kvrandom.o compiler.o kvthread.o
35 | @/bin/rm -f $@
36 | $(AR) cru $@ $^
37 |
38 | mtIndexAPI.a: mtIndexAPI.o misc.o checkpoint.o $(KVTREES) testrunner.o \
39 | kvio.o json.o string.o straccum.o str.o msgpack.o \
40 | clp.o kvrandom.o compiler.o kvthread.o
41 | $(AR) cru $@ $^
42 |
43 | KVTREES = query_masstree.o \
44 | value_string.o value_array.o value_versioned_array.o \
45 | string_slice.o
46 |
47 | test_string: test_string.o string.o straccum.o compiler.o
48 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS)
49 |
50 | jsontest: jsontest.o string.o straccum.o json.o compiler.o
51 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS)
52 |
53 | msgpacktest: msgpacktest.o string.o straccum.o json.o compiler.o msgpack.o
54 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS)
55 |
56 | config.h: stamp-h
57 |
58 | GNUmakefile: GNUmakefile.in config.status
59 | CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
60 |
61 | configure config.h.in: configure.ac
62 | autoreconf -i
63 | touch config.h.in
64 |
65 | config.status: configure
66 | ./configure @ac_configure_args@
67 |
68 | $(DEPSDIR)/stamp:
69 | mkdir -p $(DEPSDIR)
70 | touch $@
71 |
72 | stamp-h: config.h.in config.status
73 | CONFIG_FILES= $(SHELL) ./config.status
74 | echo > stamp-h
75 |
76 | clean:
77 | rm -f test_string *.o libjson.a mtIndexAPI.a config.status
78 | rm -rf .deps
79 |
80 | DEPFILES := $(wildcard $(DEPSDIR)/*.d)
81 | ifneq ($(DEPFILES),)
82 | include $(DEPFILES)
83 | endif
84 |
85 | .PHONY: clean all
86 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/DriverInterface.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include "PcmMsr/UserKernelShared.h"
20 |
21 | kern_return_t openMSRClient(io_connect_t connect);
22 | kern_return_t closeMSRClient(io_connect_t connect);
23 | kern_return_t readMSR(io_connect_t connect, pcm_msr_data_t* idata, size_t* idata_size, pcm_msr_data_t* odata, size_t* odata_size);
24 | kern_return_t writeMSR(io_connect_t connect, pcm_msr_data_t* data, size_t* data_size);
25 | kern_return_t getTopologyInfo(io_connect_t connect, topologyEntry* data, size_t* data_size);
26 | kern_return_t getNumClients(io_connect_t connect, uint32_t* num_insts);
27 | kern_return_t incrementNumClients(io_connect_t connect, uint32_t* num_insts);
28 | kern_return_t decrementNumClients(io_connect_t connect, uint32_t* num_insts);
--------------------------------------------------------------------------------
/ARTOLC/N256.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "N.h"
4 |
5 | namespace ART_OLC {
6 |
7 | bool N256::isFull() const {
8 | return false;
9 | }
10 |
11 | bool N256::isUnderfull() const {
12 | return count == 37;
13 | }
14 |
15 | void N256::deleteChildren() {
16 | for (uint64_t i = 0; i < 256; ++i) {
17 | if (children[i] != nullptr) {
18 | N::deleteChildren(children[i]);
19 | N::deleteNode(children[i]);
20 | }
21 | }
22 | }
23 |
24 | void N256::insert(uint8_t key, N *val) {
25 | children[key] = val;
26 | count++;
27 | }
28 |
29 | template
30 | void N256::copyTo(NODE *n) const {
31 | for (int i = 0; i < 256; ++i) {
32 | if (children[i] != nullptr) {
33 | n->insert(i, children[i]);
34 | }
35 | }
36 | }
37 |
38 | bool N256::change(uint8_t key, N *n) {
39 | children[key] = n;
40 | return true;
41 | }
42 |
43 | N *N256::getChild(const uint8_t k) const {
44 | return children[k];
45 | }
46 |
47 | void N256::remove(uint8_t k) {
48 | children[k] = nullptr;
49 | count--;
50 | }
51 |
52 | N *N256::getAnyChild() const {
53 | N *anyChild = nullptr;
54 | for (uint64_t i = 0; i < 256; ++i) {
55 | if (children[i] != nullptr) {
56 | if (N::isLeaf(children[i])) {
57 | return children[i];
58 | } else {
59 | anyChild = children[i];
60 | }
61 | }
62 | }
63 | return anyChild;
64 | }
65 |
66 | uint64_t N256::getChildren(uint8_t start, uint8_t end, std::tuple *&children,
67 | uint32_t &childrenCount) const {
68 | restart:
69 | bool needRestart = false;
70 | uint64_t v;
71 | v = readLockOrRestart(needRestart);
72 | if (needRestart) goto restart;
73 | childrenCount = 0;
74 | for (unsigned i = start; i <= end; i++) {
75 | if (this->children[i] != nullptr) {
76 | children[childrenCount] = std::make_tuple(i, this->children[i]);
77 | childrenCount++;
78 | }
79 | }
80 | readUnlockOrRestart(v, needRestart);
81 | if (needRestart) goto restart;
82 | return v;
83 | }
84 | }
--------------------------------------------------------------------------------
/pcm/daemon/daemon/test/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "../common.h"
6 |
7 | #define ALIGNMENT 64
8 |
9 | void checkAlignment(char const * debugMessage, void* ptr)
10 | {
11 | printf("Checking: %-20s\t\t", debugMessage);
12 | uint64_t currentAlignment = (uint64_t)ptr % ALIGNMENT;
13 | if(currentAlignment != 0)
14 | {
15 | printf("Failed\n");
16 | printf("Current alignment: %lu\n\n", currentAlignment);
17 | exit(EXIT_FAILURE);
18 | }
19 | else
20 | {
21 | printf("Passed\n");
22 | }
23 | }
24 |
25 | int main()
26 | {
27 | printf("Testing alignment\n\n");
28 |
29 | PCMDaemon::SharedPCMState* pcmState = (PCMDaemon::SharedPCMState*)aligned_alloc(ALIGNMENT, sizeof(PCMDaemon::SharedPCMState));
30 |
31 | checkAlignment("pcmState", pcmState);
32 |
33 | checkAlignment("pcm", &pcmState->pcm);
34 |
35 | checkAlignment("pcm core", &pcmState->pcm.core);
36 | checkAlignment("pcm memory", &pcmState->pcm.memory);
37 | checkAlignment("pcm qpi", &pcmState->pcm.qpi);
38 |
39 | for(uint32_t i(0); i < MAX_CPU_CORES; ++i)
40 | {
41 | checkAlignment("pcm core cores", &pcmState->pcm.core.cores[i]);
42 | }
43 |
44 | checkAlignment("pcm core energyUsed", &pcmState->pcm.core.energyUsedBySockets);
45 |
46 | for(uint32_t i(0); i < MAX_SOCKETS; ++i)
47 | {
48 | checkAlignment("pcm memory sockets", &pcmState->pcm.memory.sockets[i]);
49 | }
50 |
51 | checkAlignment("pcm memory dramEnergy", &pcmState->pcm.memory.dramEnergyForSockets);
52 |
53 | for(uint32_t i(0); i < MAX_SOCKETS; ++i)
54 | {
55 | checkAlignment("pcm qpi incoming", &pcmState->pcm.qpi.incoming[i]);
56 | }
57 |
58 | for(uint32_t i(0); i < MAX_SOCKETS; ++i)
59 | {
60 | for(uint32_t j(0); j < QPI_MAX_LINKS; ++j)
61 | {
62 | checkAlignment("pcm qpi incoming links", &pcmState->pcm.qpi.incoming[i].links[j]);
63 | }
64 | }
65 |
66 | for(uint32_t i(0); i < MAX_SOCKETS; ++i)
67 | {
68 | checkAlignment("pcm qpi outgoing", &pcmState->pcm.qpi.outgoing[i]);
69 | }
70 |
71 | for(uint32_t i(0); i < MAX_SOCKETS; ++i)
72 | {
73 | for(uint32_t j(0); j < QPI_MAX_LINKS; ++j)
74 | {
75 | checkAlignment("pcm qpi outgoing links", &pcmState->pcm.qpi.outgoing[i].links[j]);
76 | }
77 | }
78 |
79 | free(pcmState);
80 |
81 | printf("\n------ All passed ------\n\n");
82 |
83 | return EXIT_SUCCESS;
84 | }
--------------------------------------------------------------------------------
/masstree/GNUmakefile:
--------------------------------------------------------------------------------
1 | AR = ar
2 | CC = gcc
3 | CXX = g++ -std=gnu++0x
4 | CFLAGS = -g -W -Wall -O2 -fPIC
5 | DEPSDIR := .deps
6 | DEPCFLAGS = -MD -MF $(DEPSDIR)/$*.d -MP
7 | ifeq ($(strip $(MEMMGR)), )
8 | MEMMGR = -ljemalloc
9 | endif
10 | ifneq ($(strip $(KEYSWAP)), )
11 | CFLAGS += -DKEYSWAP
12 | endif
13 | ifneq ($(strip $(NOPREFETCH)), )
14 | CFLAGS += -DNOPREFETCH
15 | endif
16 | ifneq ($(strip $(NOSUPERPAGE)), )
17 | CFLAGS += -DNOSUPERPAGE
18 | endif
19 | LIBS = -lpthread -lm
20 | LDFLAGS =
21 |
22 | all: mtIndexAPI.a
23 |
24 | %.o: %.c config.h $(DEPSDIR)/stamp
25 | $(CXX) $(CFLAGS) $(DEPCFLAGS) -include config.h -c -o $@ $<
26 |
27 | %.o: %.cc config.h $(DEPSDIR)/stamp
28 | $(CXX) $(CFLAGS) $(DEPCFLAGS) -include config.h -c -o $@ $<
29 |
30 | %.S: %.o
31 | objdump -S $< > $@
32 |
33 | libjson.a: json.o string.o straccum.o str.o msgpack.o \
34 | clp.o kvrandom.o compiler.o kvthread.o
35 | @/bin/rm -f $@
36 | $(AR) cru $@ $^
37 |
38 | mtIndexAPI.a: mtIndexAPI.o misc.o checkpoint.o $(KVTREES) testrunner.o \
39 | kvio.o json.o string.o straccum.o str.o msgpack.o \
40 | clp.o kvrandom.o compiler.o kvthread.o
41 | $(AR) cru $@ $^
42 |
43 | KVTREES = query_masstree.o \
44 | value_string.o value_array.o value_versioned_array.o \
45 | string_slice.o
46 |
47 | test_string: test_string.o string.o straccum.o compiler.o
48 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS)
49 |
50 | jsontest: jsontest.o string.o straccum.o json.o compiler.o
51 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS)
52 |
53 | msgpacktest: msgpacktest.o string.o straccum.o json.o compiler.o msgpack.o
54 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS)
55 |
56 | config.h: stamp-h
57 |
58 | GNUmakefile: GNUmakefile.in config.status
59 | CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
60 |
61 | configure config.h.in: configure.ac
62 | autoreconf -i
63 | touch config.h.in
64 |
65 | config.status: configure
66 | ./configure 'enable_memdebug=no' 'enable_assert=no' 'enable_assertions=no' 'enable_preconditions=no' 'enable_invariants=no'
67 |
68 | $(DEPSDIR)/stamp:
69 | mkdir -p $(DEPSDIR)
70 | touch $@
71 |
72 | stamp-h: config.h.in config.status
73 | CONFIG_FILES= $(SHELL) ./config.status
74 | echo > stamp-h
75 |
76 | clean:
77 | rm -f test_string *.o libjson.a mtIndexAPI.a config.status
78 | rm -rf .deps
79 |
80 | DEPFILES := $(wildcard $(DEPSDIR)/*.d)
81 | ifneq ($(DEPFILES),)
82 | include $(DEPFILES)
83 | endif
84 |
85 | .PHONY: clean all
86 |
--------------------------------------------------------------------------------
/indexkey.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef _INDEX_KEY_H
3 | #define _INDEX_KEY_H
4 |
5 | #include
6 | #include
7 |
8 | template
9 | class GenericKey {
10 | public:
11 | char data[keySize];
12 | public:
13 | inline void setFromString(std::string key) {
14 | memset(data, 0, keySize);
15 | if(key.size() >= keySize) {
16 | memcpy(data, key.c_str(), keySize - 1);
17 | data[keySize - 1] = '\0';
18 | } else {
19 | strcpy(data, key.c_str());
20 | }
21 |
22 | return;
23 | }
24 |
25 | // Constructor - Fills it with 0x00
26 | // This is for the skiplist to initialize an empty node
27 | GenericKey(int) { memset(data, 0x00, keySize); }
28 | GenericKey() { memset(data, 0x00, keySize); }
29 | // Copy constructor
30 | GenericKey(const GenericKey &other) { memcpy(data, other.data, keySize); }
31 | inline GenericKey &operator=(const GenericKey &other) {
32 | memcpy(data, other.data, keySize);
33 | return *this;
34 | }
35 |
36 | inline bool operator<(const GenericKey &other) { return strcmp(data, other.data) < 0; }
37 | inline bool operator>(const GenericKey &other) { return strcmp(data, other.data) > 0; }
38 | inline bool operator==(const GenericKey &other) { return strcmp(data, other.data) == 0; }
39 | // Derived operators
40 | inline bool operator!=(const GenericKey &other) { return !(*this == other); }
41 | inline bool operator<=(const GenericKey &other) { return !(*this > other); }
42 | inline bool operator>=(const GenericKey &other) { return !(*this < other); }
43 | };
44 |
45 | template
46 | class GenericComparator {
47 | public:
48 | GenericComparator() {}
49 |
50 | inline bool operator()(const GenericKey &lhs, const GenericKey &rhs) const {
51 | int diff = strcmp(lhs.data, rhs.data);
52 | return diff < 0;
53 | }
54 | };
55 |
56 | template
57 | class GenericEqualityChecker {
58 | public:
59 | GenericEqualityChecker() {}
60 |
61 | inline bool operator()(const GenericKey &lhs, const GenericKey &rhs) const {
62 | int diff = strcmp(lhs.data, rhs.data);
63 | return diff == 0;
64 | }
65 | };
66 |
67 | template
68 | class GenericHasher {
69 | public:
70 | GenericHasher() {}
71 |
72 | inline size_t operator()(const GenericKey &lhs) const {
73 | (void)lhs;
74 | return 0UL;
75 | }
76 | };
77 |
78 | #endif
79 |
--------------------------------------------------------------------------------
/masstree/str.cc:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #include "str.hh"
17 | namespace lcdf {
18 |
19 | const Str Str::maxkey("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
20 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
21 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
22 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
23 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
24 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
25 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
26 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
27 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
28 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
29 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
30 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
31 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
32 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
33 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
34 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
35 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
36 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
37 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
38 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
39 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
40 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
41 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
42 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
43 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
44 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
45 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
46 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
47 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
48 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
49 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
50 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
51 | "\xFF", 257);
52 |
53 | } // namespace lcdf
54 |
--------------------------------------------------------------------------------
/pcm/pcm.so/c_example.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | struct {
7 | int (*pcm_c_build_core_event)(uint8_t id, const char * argv);
8 | int (*pcm_c_init)();
9 | void (*pcm_c_start)();
10 | void (*pcm_c_stop)();
11 | uint64_t (*pcm_c_get_cycles)(uint32_t core_id);
12 | uint64_t (*pcm_c_get_instr)(uint32_t core_id);
13 | uint64_t (*pcm_c_get_core_event)(uint32_t core_id, uint32_t event_id);
14 | } PCM;
15 |
16 | int main(int argc, const char *argv[])
17 | {
18 | int i,a[100],b[100],c[100];
19 | int lcore_id;
20 |
21 | void * handle = dlopen("libpcm.so", RTLD_LAZY);
22 | if(!handle)
23 | return -1;
24 |
25 | PCM.pcm_c_build_core_event = (int (*)(uint8_t, const char *)) dlsym(handle, "pcm_c_build_core_event");
26 | PCM.pcm_c_init = (int (*)()) dlsym(handle, "pcm_c_init");
27 | PCM.pcm_c_start = (void (*)()) dlsym(handle, "pcm_c_start");
28 | PCM.pcm_c_stop = (void (*)()) dlsym(handle, "pcm_c_stop");
29 | PCM.pcm_c_get_cycles = (uint64_t (*)(uint32_t)) dlsym(handle, "pcm_c_get_cycles");
30 | PCM.pcm_c_get_instr = (uint64_t (*)(uint32_t)) dlsym(handle, "pcm_c_get_instr");
31 | PCM.pcm_c_get_core_event = (uint64_t (*)(uint32_t,uint32_t)) dlsym(handle, "pcm_c_get_core_event");
32 |
33 | if(PCM.pcm_c_init == NULL || PCM.pcm_c_start == NULL || PCM.pcm_c_stop == NULL ||
34 | PCM.pcm_c_get_cycles == NULL || PCM.pcm_c_get_instr == NULL ||
35 | PCM.pcm_c_build_core_event == NULL)
36 | return -1;
37 | switch(argc-1)
38 | {
39 | case 4:
40 | PCM.pcm_c_build_core_event(3,argv[3]);
41 | case 3:
42 | PCM.pcm_c_build_core_event(2,argv[2]);
43 | case 2:
44 | PCM.pcm_c_build_core_event(1,argv[2]);
45 | case 1:
46 | PCM.pcm_c_build_core_event(0,argv[1]);
47 | case 0:
48 | break;
49 | default:
50 | printf("Number of arguments are too many! exit...\n");
51 | return -2;
52 | }
53 |
54 | PCM.pcm_c_init();
55 | PCM.pcm_c_start();
56 | for(i=0;i<10000;i++)
57 | c[i%100] = 4 * a[i%100] + b[i%100];
58 | PCM.pcm_c_stop();
59 |
60 | lcore_id = sched_getcpu();
61 | printf("C:%lu I:%lu, IPC:%3.2f\n",
62 | PCM.pcm_c_get_cycles(lcore_id),
63 | PCM.pcm_c_get_instr(lcore_id),
64 | (double)PCM.pcm_c_get_instr(lcore_id)/PCM.pcm_c_get_cycles(lcore_id));
65 | printf("CPU%d E0: %lu, E1: %lu, E2: %lu, E3: %lu\n",
66 | lcore_id,
67 | PCM.pcm_c_get_core_event(lcore_id,0),
68 | PCM.pcm_c_get_core_event(lcore_id,1),
69 | PCM.pcm_c_get_core_event(lcore_id,2),
70 | PCM.pcm_c_get_core_event(lcore_id,3));
71 |
72 | return 0;
73 | }
74 |
--------------------------------------------------------------------------------
/pcm/winring0/OlsDef.h:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | // Author : hiyohiyo
3 | // Mail : hiyohiyo@crystalmark.info
4 | // Web : http://openlibsys.org/
5 | // License : The modified BSD license
6 | //
7 | // Copyright 2007 OpenLibSys.org. All rights reserved.
8 | //-----------------------------------------------------------------------------
9 |
10 | #pragma once
11 |
12 | //-----------------------------------------------------------------------------
13 | //
14 | // DLL Status Code
15 | //
16 | //-----------------------------------------------------------------------------
17 |
18 | #define OLS_DLL_NO_ERROR 0
19 | #define OLS_DLL_UNSUPPORTED_PLATFORM 1
20 | #define OLS_DLL_DRIVER_NOT_LOADED 2
21 | #define OLS_DLL_DRIVER_NOT_FOUND 3
22 | #define OLS_DLL_DRIVER_UNLOADED 4
23 | #define OLS_DLL_DRIVER_NOT_LOADED_ON_NETWORK 5
24 | #define OLS_DLL_UNKNOWN_ERROR 9
25 |
26 | //-----------------------------------------------------------------------------
27 | //
28 | // Driver Type
29 | //
30 | //-----------------------------------------------------------------------------
31 |
32 | #define OLS_DRIVER_TYPE_UNKNOWN 0
33 | #define OLS_DRIVER_TYPE_WIN_9X 1
34 | #define OLS_DRIVER_TYPE_WIN_NT 2
35 | #define OLS_DRIVER_TYPE_WIN_NT4 3 // Obsolete
36 | #define OLS_DRIVER_TYPE_WIN_NT_X64 4
37 | #define OLS_DRIVER_TYPE_WIN_NT_IA64 5 // Reseved
38 |
39 | //-----------------------------------------------------------------------------
40 | //
41 | // PCI Error Code
42 | //
43 | //-----------------------------------------------------------------------------
44 |
45 | #define OLS_ERROR_PCI_BUS_NOT_EXIST (0xE0000001L)
46 | #define OLS_ERROR_PCI_NO_DEVICE (0xE0000002L)
47 | #define OLS_ERROR_PCI_WRITE_CONFIG (0xE0000003L)
48 | #define OLS_ERROR_PCI_READ_CONFIG (0xE0000004L)
49 |
50 | //-----------------------------------------------------------------------------
51 | //
52 | // Support Macros
53 | //
54 | //-----------------------------------------------------------------------------
55 |
56 | // Bus Number, Device Number and Function Number to PCI Device Address
57 | #define PciBusDevFunc(Bus, Dev, Func) ((Bus&0xFF)<<8) | ((Dev&0x1F)<<3) | (Func&7)
58 | // PCI Device Address to Bus Number
59 | #define PciGetBus(address) ((address>>8) & 0xFF)
60 | // PCI Device Address to Device Number
61 | #define PciGetDev(address) ((address>>3) & 0x1F)
62 | // PCI Device Address to Function Number
63 | #define PciGetFunc(address) (address&7)
64 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/MSRKernel.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #define PcmMsrDriverClassName com_intel_driver_PcmMsr
16 | #define kPcmMsrDriverClassName "com_intel_driver_PcmMsr"
17 | #ifndef MSR_KERNEL_SHARED
18 | #define MSR_KERNEL_SHARED
19 | #include
20 | typedef struct {
21 | uint64_t value;
22 | uint32_t cpu_num;
23 | uint32_t msr_num;
24 | } pcm_msr_data_t;
25 |
26 | /*
27 | // The topologyEntry struct that is used by PCM
28 | typedef struct{
29 | uint32_t os_id;
30 | uint32_t socket;
31 | uint32_t core_id;
32 | } topologyEntry;
33 |
34 | // A kernel version of the topology entry structure. It has
35 | // an extra unused int to explicitly align the struct on a 64bit
36 | // boundary, preventing the compiler from adding extra padding.
37 | enum {
38 | kOpenDriver,
39 | kCloseDriver,
40 | kReadMSR,
41 | kWriteMSR,
42 | kBuildTopology,
43 | kGetNumInstances,
44 | kIncrementNumInstances,
45 | kDecrementNumInstances,
46 | kNumberOfMethods
47 | };
48 | */
49 | #endif
50 |
--------------------------------------------------------------------------------
/pcm/WinMSRDriver/Win7/MSR.inf:
--------------------------------------------------------------------------------
1 | ;
2 | ; MSR.inf
3 | ;
4 |
5 | [Version]
6 | Signature="$WINDOWS NT$"
7 | Class=Sample ; TODO: edit Class
8 | ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid
9 | Provider=%ManufacturerName%
10 | CatalogFile=MSR.cat
11 | DriverVer= ; TODO: set DriverVer in stampinf property pages
12 |
13 | [DestinationDirs]
14 | DefaultDestDir = 12
15 |
16 | ; ================= Class section =====================
17 |
18 | [ClassInstall32]
19 | Addreg=SampleClassReg
20 |
21 | [SampleClassReg]
22 | HKR,,,0,%ClassName%
23 | HKR,,Icon,,-5
24 |
25 | [SourceDisksNames]
26 | 1 = %DiskName%,,,""
27 |
28 | [SourceDisksFiles]
29 | MSR.sys = 1,,
30 |
31 | ;*****************************************
32 | ; Install Section
33 | ;*****************************************
34 |
35 | [Manufacturer]
36 | %ManufacturerName%=Standard,NT$ARCH$
37 |
38 | [Standard.NT$ARCH$]
39 | %MSR.DeviceDesc%=MSR_Device, Root\MSR ; TODO: edit hw-id
40 |
41 | [MSR_Device.NT]
42 | CopyFiles=Drivers_Dir
43 |
44 | [Drivers_Dir]
45 | MSR.sys
46 |
47 | ;-------------- Service installation
48 | [MSR_Device.NT.Services]
49 | AddService = MSR,%SPSVCINST_ASSOCSERVICE%, MSR_Service_Inst
50 |
51 | ; -------------- MSR driver install sections
52 | [MSR_Service_Inst]
53 | DisplayName = %MSR.SVCDESC%
54 | ServiceType = 1 ; SERVICE_KERNEL_DRIVER
55 | StartType = 3 ; SERVICE_DEMAND_START
56 | ErrorControl = 1 ; SERVICE_ERROR_NORMAL
57 | ServiceBinary = %12%\MSR.sys
58 |
59 | ;
60 | ;--- MSR_Device Coinstaller installation ------
61 | ;
62 |
63 | [DestinationDirs]
64 | MSR_Device_CoInstaller_CopyFiles = 11
65 |
66 | [MSR_Device.NT.CoInstallers]
67 | AddReg=MSR_Device_CoInstaller_AddReg
68 | CopyFiles=MSR_Device_CoInstaller_CopyFiles
69 |
70 | [MSR_Device_CoInstaller_AddReg]
71 | HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller"
72 |
73 | [MSR_Device_CoInstaller_CopyFiles]
74 | WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll
75 |
76 | [SourceDisksFiles]
77 | WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames
78 |
79 | [MSR_Device.NT.Wdf]
80 | KmdfService = MSR, MSR_wdfsect
81 | [MSR_wdfsect]
82 | KmdfLibraryVersion = $KMDFVERSION$
83 |
84 | [Strings]
85 | SPSVCINST_ASSOCSERVICE= 0x00000002
86 | ManufacturerName="" ;TODO: Replace with your manufacturer name
87 | ClassName="Samples" ; TODO: edit ClassName
88 | DiskName = "MSR Installation Disk"
89 | MSR.DeviceDesc = "MSR Device"
90 | MSR.SVCDESC = "MSR Service"
91 |
--------------------------------------------------------------------------------
/pcm/WinMSRDriver/Win7/msrstruct.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | written by Roman Dementiev
16 | */
17 |
18 | #ifndef MSR_STRUCT_HEADER
19 | #define MSR_STRUCT_HEADER
20 |
21 |
22 | #ifndef CTL_CODE
23 | #include
24 | #endif
25 |
26 | #define MSR_DEV_TYPE 50000
27 |
28 | #define IO_CTL_MSR_READ CTL_CODE(MSR_DEV_TYPE, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
29 | #define IO_CTL_MSR_WRITE CTL_CODE(MSR_DEV_TYPE, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
30 | #define IO_CTL_PCICFG_READ CTL_CODE(MSR_DEV_TYPE, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS)
31 | #define IO_CTL_PCICFG_WRITE CTL_CODE(MSR_DEV_TYPE, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS)
32 |
33 | struct MSR_Request
34 | {
35 | int core_id;
36 | ULONG64 msr_address;
37 | ULONG64 write_value; /* value to write if write requet
38 | ignored if read request */
39 | };
40 |
41 | struct PCICFG_Request
42 | {
43 | ULONG bus, dev, func, reg, bytes;
44 | // "bytes" can be only 4 or 8
45 | /* value to write if write request ignored if read request */
46 | ULONG64 write_value;
47 | };
48 |
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/ARTOLC/Tree.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by florian on 18.11.15.
3 | //
4 |
5 | #ifndef ART_OPTIMISTICLOCK_COUPLING_N_H
6 | #define ART_OPTIMISTICLOCK_COUPLING_N_H
7 | #include "N.h"
8 |
9 | using namespace ART;
10 |
11 | namespace ART_OLC {
12 |
13 | class Tree {
14 | public:
15 | using LoadKeyFunction = void (*)(TID tid, Key &key);
16 |
17 | private:
18 | N *const root;
19 |
20 | TID checkKey(const TID tid, const Key &k) const;
21 |
22 | LoadKeyFunction loadKey;
23 |
24 | Epoche epoche{256};
25 |
26 | public:
27 | enum class CheckPrefixResult : uint8_t {
28 | Match,
29 | NoMatch,
30 | OptimisticMatch
31 | };
32 |
33 | enum class CheckPrefixPessimisticResult : uint8_t {
34 | Match,
35 | NoMatch,
36 | };
37 |
38 | enum class PCCompareResults : uint8_t {
39 | Smaller,
40 | Equal,
41 | Bigger,
42 | };
43 | enum class PCEqualsResults : uint8_t {
44 | BothMatch,
45 | Contained,
46 | NoMatch
47 | };
48 | static CheckPrefixResult checkPrefix(N* n, const Key &k, uint32_t &level);
49 |
50 | static CheckPrefixPessimisticResult checkPrefixPessimistic(N *n, const Key &k, uint32_t &level,
51 | uint8_t &nonMatchingKey,
52 | Prefix &nonMatchingPrefix,
53 | LoadKeyFunction loadKey, bool &needRestart);
54 |
55 | static PCCompareResults checkPrefixCompare(const N* n, const Key &k, uint8_t fillKey, uint32_t &level, LoadKeyFunction loadKey, bool &needRestart);
56 |
57 | static PCEqualsResults checkPrefixEquals(const N* n, uint32_t &level, const Key &start, const Key &end, LoadKeyFunction loadKey, bool &needRestart);
58 |
59 | public:
60 |
61 | Tree(LoadKeyFunction loadKey);
62 |
63 | Tree(const Tree &) = delete;
64 |
65 | Tree(Tree &&t) : root(t.root), loadKey(t.loadKey) { }
66 |
67 | ~Tree();
68 |
69 | ThreadInfo getThreadInfo();
70 |
71 | TID lookup(const Key &k, ThreadInfo &threadEpocheInfo) const;
72 |
73 | bool lookupRange(const Key &start, const Key &end, Key &continueKey, TID result[], std::size_t resultLen,
74 | std::size_t &resultCount, ThreadInfo &threadEpocheInfo) const;
75 |
76 | void insert(const Key &k, TID tid, ThreadInfo &epocheInfo);
77 |
78 | void remove(const Key &k, TID tid, ThreadInfo &epocheInfo);
79 | };
80 | }
81 | #endif //ART_OPTIMISTICLOCK_COUPLING_N_H
82 |
--------------------------------------------------------------------------------
/masstree/misc.hh:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #ifndef MISC_HH
17 | #define MISC_HH
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include "str.hh"
24 | #include "timestamp.hh"
25 | #include "clp.h"
26 |
27 | inline void xalarm(double d) {
28 | double ip, fp = modf(d, &ip);
29 | struct itimerval x;
30 | timerclear(&x.it_interval);
31 | x.it_value.tv_sec = (long) ip;
32 | x.it_value.tv_usec = (long) (fp * 1000000);
33 | setitimer(ITIMER_REAL, &x, 0);
34 | }
35 |
36 | inline void napms(int n) /* nap n milliseconds */
37 | {
38 | int ret;
39 | struct timespec req, rem;
40 |
41 | req.tv_sec = n / 1000;
42 | req.tv_nsec = (n % 1000) * 1000000;
43 | ret = nanosleep(&req, &rem);
44 | if(ret == -1 && errno != EINTR){
45 | perror("nanosleep");
46 | exit(EXIT_FAILURE);
47 | }
48 | }
49 |
50 | struct quick_istr {
51 | char buf_[32];
52 | char *bbuf_;
53 | quick_istr() {
54 | set(0);
55 | }
56 | quick_istr(unsigned long x, int minlen = 0) {
57 | set(x, minlen);
58 | }
59 | void set(unsigned long x, int minlen = 0){
60 | bbuf_ = buf_ + sizeof(buf_) - 1;
61 | do {
62 | *--bbuf_ = (x % 10) + '0';
63 | x /= 10;
64 | } while (--minlen > 0 || x != 0);
65 | }
66 | lcdf::Str string() const {
67 | return lcdf::Str(bbuf_, buf_ + sizeof(buf_) - 1);
68 | }
69 | const char *c_str() {
70 | buf_[sizeof(buf_) - 1] = 0;
71 | return bbuf_;
72 | }
73 | bool operator==(lcdf::Str s) const {
74 | return s.len == (buf_ + sizeof(buf_) - 1) - bbuf_
75 | && memcmp(s.s, bbuf_, s.len) == 0;
76 | }
77 | bool operator!=(lcdf::Str s) const {
78 | return !(*this == s);
79 | }
80 | };
81 |
82 | struct Clp_Parser;
83 | int clp_parse_suffixdouble(struct Clp_Parser *clp, const char *vstr,
84 | int complain, void *user_data);
85 |
86 | #endif
87 |
--------------------------------------------------------------------------------
/pcm/MacMSRDriver/PCIDriverInterface.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Patrick Konsor
14 | //
15 |
16 | #ifndef pci_driver_driverinterface_h
17 | #define pci_driver_driverinterface_h
18 |
19 | #ifdef __cplusplus
20 | extern "C" {
21 | #endif
22 |
23 | #define PCI_ENABLE 0x80000000
24 | #define FORM_PCI_ADDR(bus,dev,fun,off) (((PCI_ENABLE)) | \
25 | ((bus & 0xFF) << 16) | \
26 | ((dev & 0x1F) << 11) | \
27 | ((fun & 0x07) << 8) | \
28 | ((off & 0xFF) << 0))
29 |
30 | uint32_t PCIDriver_read32(uint32_t addr, uint32_t* val);
31 | uint32_t PCIDriver_read64(uint32_t addr, uint64_t* val);
32 | uint32_t PCIDriver_write32(uint32_t addr, uint32_t val);
33 | uint32_t PCIDriver_write64(uint32_t addr, uint64_t val);
34 | uint32_t PCIDriver_mapMemory(uint32_t address, uint8_t** virtual_address);
35 | uint32_t PCIDriver_unmapMemory(uint8_t* virtual_address);
36 | uint32_t PCIDriver_readMemory32(uint8_t* address, uint32_t* val);
37 | uint32_t PCIDriver_readMemory64(uint8_t* address, uint64_t* val);
38 |
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/pcm/client_bw.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012-2013, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | //
15 |
16 | #ifndef CPUCounters_CLIENTBW_H
17 | #define CPUCounters_CLIENTBW_H
18 |
19 | /*! \file client_bw.h
20 | \brief Interface to access client bandwidth counters
21 |
22 | */
23 |
24 | #include "types.h"
25 |
26 | #ifdef _MSC_VER
27 | #include "windows.h"
28 | #include "winpmem\winpmem.h"
29 | #else
30 | #include
31 | #endif
32 |
33 | #include "mutex.h"
34 | #include
35 |
36 | #define PCM_CLIENT_IMC_BAR_OFFSET (0x0048)
37 | #define PCM_CLIENT_IMC_DRAM_IO_REQESTS (0x5048)
38 | #define PCM_CLIENT_IMC_DRAM_DATA_READS (0x5050)
39 | #define PCM_CLIENT_IMC_DRAM_DATA_WRITES (0x5054)
40 | #define PCM_CLIENT_IMC_MMAP_SIZE (0x6000)
41 |
42 |
43 | class ClientBW
44 | {
45 | #if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
46 | int32 fd;
47 | char * mmapAddr;
48 | #endif
49 | #ifdef __APPLE__
50 | char * mmapAddr;
51 | #endif
52 | #ifdef _MSC_VER
53 | std::shared_ptr pmem;
54 | uint64 startAddr;
55 | PCM_Util::Mutex mutex;
56 | #endif
57 |
58 | public:
59 | ClientBW();
60 |
61 | uint64 getImcReads();
62 | uint64 getImcWrites();
63 | uint64 getIoRequests();
64 |
65 | ~ClientBW();
66 | };
67 |
68 |
69 | #endif
70 |
--------------------------------------------------------------------------------
/masstree/file.hh:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2014 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2014 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #ifndef KVDB_FILE_HH
17 | #define KVDB_FILE_HH 1
18 | #include
19 | #include
20 | #include
21 | #include "string.hh"
22 |
23 | inline ssize_t
24 | safe_read(int fd, void *buf, size_t count)
25 | {
26 | size_t pos = 0;
27 | while (pos != count) {
28 | ssize_t x = ::read(fd, buf, count - pos);
29 | if (x != -1 && x != 0) {
30 | buf = reinterpret_cast(buf) + x;
31 | pos += x;
32 | } else if (x == 0)
33 | break;
34 | else if (errno != EINTR && pos == 0)
35 | return -1;
36 | else if (errno != EINTR)
37 | break;
38 | }
39 | return pos;
40 | }
41 |
42 | inline ssize_t
43 | safe_write(int fd, const void *buf, size_t count)
44 | {
45 | size_t pos = 0;
46 | while (pos != count) {
47 | ssize_t x = ::write(fd, buf, count - pos);
48 | if (x != -1 && x != 0) {
49 | buf = reinterpret_cast(buf) + x;
50 | pos += x;
51 | } else if (x == 0)
52 | break;
53 | else if (errno != EINTR && pos == 0)
54 | return -1;
55 | else if (errno != EINTR)
56 | break;
57 | }
58 | return pos;
59 | }
60 |
61 | inline void
62 | checked_write(int fd, const void *buf, size_t count)
63 | {
64 | ssize_t x = safe_write(fd, buf, count);
65 | always_assert(size_t(x) == count);
66 | }
67 |
68 | template inline void
69 | checked_write(int fd, const T *x)
70 | {
71 | checked_write(fd, reinterpret_cast(x), sizeof(*x));
72 | }
73 |
74 |
75 | lcdf::String read_file_contents(int fd);
76 | lcdf::String read_file_contents(const char *filename);
77 | int sync_write_file_contents(const char *filename, const lcdf::String &contents,
78 | mode_t mode = 0666);
79 | int atomic_write_file_contents(const char *filename, const lcdf::String &contents,
80 | mode_t mode = 0666);
81 |
82 | #endif
83 |
--------------------------------------------------------------------------------
/masstree/doc/elemfig.sty:
--------------------------------------------------------------------------------
1 | % elemfig.sty -- LaTeX macros for Click configuration graphs in MetaPost
2 | % Eddie Kohler
3 | %
4 | % Copyright (c) 1999-2001 Massachusetts Institute of Technology
5 | % Copyright (c) 2001-2003 International Computer Science Institute
6 | %
7 | % Permission is hereby granted, free of charge, to any person obtaining a
8 | % copy of this software and associated documentation files (the "Software"),
9 | % to deal in the Software without restriction, subject to the conditions
10 | % listed in the Click LICENSE file. These conditions include: you must
11 | % preserve this copyright notice, and you cannot mention the copyright
12 | % holders in advertising related to the Software without their permission.
13 | % The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
14 | % notice is a summary of the Click LICENSE file; the license in that file is
15 | % legally binding.
16 |
17 | \makeatletter
18 | \usepackage{times,mathptmx}
19 | \usepackage[T1]{fontenc}
20 | %\input{../notation}
21 |
22 | \IfFileExists{./pfonts.sty}{\input{./pfonts.sty}}{%
23 | \IfFileExists{../pfonts.sty}{\input{../pfonts.sty}}{%
24 | \input{times.sty}%
25 | }%
26 | }%
27 | \@ifundefined{elementdefault}{}{\long\global\edef\rmdefault{\elementdefault}}
28 |
29 | % for MetaPost
30 |
31 | \renewcommand{\v}[1]{\ifmmode\mathit{#1\strut}\else\textit{#1}\fi}
32 |
33 | \let\elementshape\itshape
34 | \newdimen\@elementQdp\setbox0\hbox{\elementshape Q}\@elementQdp=\dp0
35 | \def\element#1{{\setbox0\hbox{\elementshape #1\vphantom{Q}}%
36 | \dimen0=\dp0\advance\dimen0 by-0.5\@elementQdp\dp0=\dimen0\box0}}%
37 | \def\belement#1{\textbf{\element{#1}}}%
38 | \newcommand{\elementlabel}[1]{\element{#1}}
39 |
40 | \newcommand{\melementlabel}[1]{{%
41 | \elementshape
42 | \begin{tabular}{@{}c@{}}%
43 | #1
44 | \end{tabular}%
45 | }}%
46 | \newcommand{\lmelementlabel}[1]{{%
47 | \elementshape
48 | \begin{tabular}{@{}l@{}}%
49 | #1
50 | \end{tabular}%
51 | }}%
52 | \newcommand{\rmelementlabel}[1]{{%
53 | \elementshape
54 | \begin{tabular}{@{}r@{}}%
55 | #1
56 | \end{tabular}%
57 | }}%
58 | \let\lelementlabel\lmelementlabel
59 | \let\relementlabel\rmelementlabel
60 | \newcommand{\mlabel}[1]{{%
61 | \begin{tabular}{@{}c@{}}%
62 | #1
63 | \end{tabular}%
64 | }}%
65 | \newcommand{\lmlabel}[1]{{%
66 | \begin{tabular}{@{}l@{}}%
67 | #1
68 | \end{tabular}%
69 | }}%
70 | \newcommand{\rmlabel}[1]{{%
71 | \begin{tabular}{@{}r@{}}%
72 | #1
73 | \end{tabular}%
74 | }}%
75 | \let\llabel\lmlabel
76 | \let\rlabel\rmlabel
77 | \newcommand{\portlabel}[1]{\hbox{%
78 | \tiny\sffamily\baselineskip6pt\begin{tabular}{@{}c@{}}#1\end{tabular}%
79 | }}%
80 | \newcommand{\lportlabel}[1]{\hbox{%
81 | \tiny\sffamily\baselineskip6pt\begin{tabular}{@{}l@{}}#1\end{tabular}%
82 | }}%
83 | \newcommand{\rportlabel}[1]{\hbox{%
84 | \tiny\sffamily\baselineskip6pt\begin{tabular}{@{}r@{}}#1\end{tabular}%
85 | }}%
86 |
87 | \makeatother
88 | \endinput
89 |
--------------------------------------------------------------------------------
/masstree/file.cc:
--------------------------------------------------------------------------------
1 | /* Masstree
2 | * Eddie Kohler, Yandong Mao, Robert Morris
3 | * Copyright (c) 2012-2014 President and Fellows of Harvard College
4 | * Copyright (c) 2012-2014 Massachusetts Institute of Technology
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a
7 | * copy of this software and associated documentation files (the "Software"),
8 | * to deal in the Software without restriction, subject to the conditions
9 | * listed in the Masstree LICENSE file. These conditions include: you must
10 | * preserve this copyright notice, and you cannot mention the copyright
11 | * holders in advertising related to the Software without their permission.
12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 | * notice is a summary of the Masstree LICENSE file; the license in that file
14 | * is legally binding.
15 | */
16 | #include "file.hh"
17 | #include "straccum.hh"
18 | #include
19 | #include
20 |
21 | lcdf::String read_file_contents(int fd) {
22 | lcdf::StringAccum sa;
23 | while (1) {
24 | char *buf = sa.reserve(4096);
25 | if (!buf) {
26 | errno = ENOMEM;
27 | return lcdf::String();
28 | }
29 |
30 | ssize_t x = read(fd, buf, 4096);
31 | if (x != -1 && x != 0)
32 | sa.adjust_length(x);
33 | else if (x == 0)
34 | break;
35 | else if (errno != EINTR)
36 | return lcdf::String();
37 | }
38 |
39 | errno = 0;
40 | return sa.take_string();
41 | }
42 |
43 | lcdf::String read_file_contents(const char *filename) {
44 | int fd = open(filename, O_RDONLY);
45 | if (fd == -1)
46 | return lcdf::String();
47 |
48 | lcdf::String text = read_file_contents(fd);
49 |
50 | if (text.empty() && errno) {
51 | int saved_errno = errno;
52 | close(fd);
53 | errno = saved_errno;
54 | }
55 | return text;
56 | }
57 |
58 | int sync_write_file_contents(const char *filename, const lcdf::String &contents,
59 | mode_t mode)
60 | {
61 | int fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, mode);
62 | if (fd == -1)
63 | return -1;
64 |
65 | ssize_t x = safe_write(fd, contents.data(), contents.length());
66 | if (x != contents.length()) {
67 | error:
68 | close(fd);
69 | return -1;
70 | }
71 |
72 | int r = fsync(fd);
73 | if (r != 0)
74 | goto error;
75 |
76 | r = close(fd);
77 | if (r != 0)
78 | goto error;
79 |
80 | return 0;
81 | }
82 |
83 | int atomic_write_file_contents(const char *filename, const lcdf::String &contents,
84 | mode_t mode)
85 | {
86 | lcdf::String tmp_filename = lcdf::String(filename) + ".tmp";
87 | int r = sync_write_file_contents(tmp_filename.c_str(), contents, mode);
88 | if (r != 0)
89 | return -1;
90 |
91 | return rename(tmp_filename.c_str(), filename);
92 | }
93 |
--------------------------------------------------------------------------------
/rotate-skiplist/atomic_ops/sparc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
3 | * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
4 | * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
5 | *
6 | *
7 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
9 | *
10 | * Permission is hereby granted to use or copy this program
11 | * for any purpose, provided the above notices are retained on all copies.
12 | * Permission to modify the code and to distribute modified code is granted,
13 | * provided the above notices are retained, and a notice that the code was
14 | * modified is included with the above copyright notice.
15 | *
16 | */
17 |
18 | /* FIXME. Very incomplete. No support for sparc64. */
19 | /* Non-ancient SPARCs provide compare-and-swap (casa). */
20 | /* We should make that available. */
21 |
22 | #include "./aligned_atomic_load_store.h"
23 |
24 | /* Real SPARC code uses TSO: */
25 | #include "./ordered_except_wr.h"
26 |
27 | /* Test_and_set location is just a byte. */
28 | #include "./test_and_set_t_is_char.h"
29 |
30 | AO_INLINE AO_TS_VAL_t
31 | AO_test_and_set_full(volatile AO_TS_t *addr) {
32 | AO_TS_VAL_t oldval;
33 |
34 | __asm__ __volatile__("ldstub %1,%0"
35 | : "=r"(oldval), "=m"(*addr)
36 | : "m"(*addr) : "memory");
37 | return oldval;
38 | }
39 |
40 | #define AO_HAVE_test_and_set_full
41 |
42 | #ifndef AO_NO_SPARC_V9
43 | /* Returns nonzero if the comparison succeeded. */
44 | AO_INLINE int
45 | AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) {
46 | char ret;
47 | __asm__ __volatile__ ("membar #StoreLoad | #LoadLoad\n\t"
48 | # if defined(__arch64__)
49 | "casx [%2],%0,%1\n\t"
50 | # else
51 | "cas [%2],%0,%1\n\t" /* 32-bit version */
52 | # endif
53 | "membar #StoreLoad | #StoreStore\n\t"
54 | "cmp %0,%1\n\t"
55 | "be,a 0f\n\t"
56 | "mov 1,%0\n\t"/* one insn after branch always executed */
57 | "clr %0\n\t"
58 | "0:\n\t"
59 | : "=r" (ret), "+r" (new_val)
60 | : "r" (addr), "0" (old)
61 | : "memory", "cc");
62 | return (int)ret;
63 | }
64 |
65 | #define AO_HAVE_compare_and_swap_full
66 | #endif /* AO_NO_SPARC_V9 */
67 |
68 | /* FIXME: This needs to be extended for SPARC v8 and v9. */
69 | /* SPARC V8 also has swap. V9 has CAS. */
70 | /* There are barriers like membar #LoadStore. */
71 | /* CASA (32-bit) and CASXA(64-bit) instructions were */
72 | /* added in V9. */
73 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/atomic_ops/sparc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
3 | * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
4 | * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
5 | *
6 | *
7 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
9 | *
10 | * Permission is hereby granted to use or copy this program
11 | * for any purpose, provided the above notices are retained on all copies.
12 | * Permission to modify the code and to distribute modified code is granted,
13 | * provided the above notices are retained, and a notice that the code was
14 | * modified is included with the above copyright notice.
15 | *
16 | */
17 |
18 | /* FIXME. Very incomplete. No support for sparc64. */
19 | /* Non-ancient SPARCs provide compare-and-swap (casa). */
20 | /* We should make that available. */
21 |
22 | #include "./aligned_atomic_load_store.h"
23 |
24 | /* Real SPARC code uses TSO: */
25 | #include "./ordered_except_wr.h"
26 |
27 | /* Test_and_set location is just a byte. */
28 | #include "./test_and_set_t_is_char.h"
29 |
30 | AO_INLINE AO_TS_VAL_t
31 | AO_test_and_set_full(volatile AO_TS_t *addr) {
32 | AO_TS_VAL_t oldval;
33 |
34 | __asm__ __volatile__("ldstub %1,%0"
35 | : "=r"(oldval), "=m"(*addr)
36 | : "m"(*addr) : "memory");
37 | return oldval;
38 | }
39 |
40 | #define AO_HAVE_test_and_set_full
41 |
42 | #ifndef AO_NO_SPARC_V9
43 | /* Returns nonzero if the comparison succeeded. */
44 | AO_INLINE int
45 | AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) {
46 | char ret;
47 | __asm__ __volatile__ ("membar #StoreLoad | #LoadLoad\n\t"
48 | # if defined(__arch64__)
49 | "casx [%2],%0,%1\n\t"
50 | # else
51 | "cas [%2],%0,%1\n\t" /* 32-bit version */
52 | # endif
53 | "membar #StoreLoad | #StoreStore\n\t"
54 | "cmp %0,%1\n\t"
55 | "be,a 0f\n\t"
56 | "mov 1,%0\n\t"/* one insn after branch always executed */
57 | "clr %0\n\t"
58 | "0:\n\t"
59 | : "=r" (ret), "+r" (new_val)
60 | : "r" (addr), "0" (old)
61 | : "memory", "cc");
62 | return (int)ret;
63 | }
64 |
65 | #define AO_HAVE_compare_and_swap_full
66 | #endif /* AO_NO_SPARC_V9 */
67 |
68 | /* FIXME: This needs to be extended for SPARC v8 and v9. */
69 | /* SPARC V8 also has swap. V9 has CAS. */
70 | /* There are barriers like membar #LoadStore. */
71 | /* CASA (32-bit) and CASXA(64-bit) instructions were */
72 | /* added in V9. */
73 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | CC = gcc-5
2 | CXX = g++-5 -std=gnu++0x
3 | DEPSDIR := masstree/.deps
4 | DEPCFLAGS = -MD -MF $(DEPSDIR)/$*.d -MP
5 | MEMMGR = -lpapi -ltcmalloc_minimal
6 | CFLAGS = -g -O3 -Wno-invalid-offsetof -mcx16 -DNDEBUG -DBWTREE_NODEBUG $(DEPCFLAGS) -include masstree/config.h
7 |
8 | # By default just use 1 thread. Override this option to allow running the
9 | # benchmark with 20 threads. i.e. THREAD_NUM=20 make run_all_atrloc
10 | THREAD_NUM?=1
11 | TYPE?=bwtree
12 |
13 | # Can also change it to rotate skiplist
14 | SL_DIR=./nohotspot-skiplist
15 |
16 | # skiplist source files
17 | SL_OBJS=$(patsubst %.cpp,%.o,$(wildcard $(SL_DIR)/*.cpp))
18 | $(info skip list object files: $(SL_OBJS))
19 |
20 | SNAPPY = /usr/lib/libsnappy.so.1.3.0
21 |
22 | all: workload
23 |
24 | ifdef STRING_KEY
25 | $(info Using string key as key type)
26 | CFLAGS += -DUSE_GENERIC_KEY
27 | endif
28 |
29 | run_all: workload workload_string
30 | ./workload a rand $(TYPE) $(THREAD_NUM)
31 | ./workload c rand $(TYPE) $(THREAD_NUM)
32 | ./workload e rand $(TYPE) $(THREAD_NUM)
33 | ./workload a mono $(TYPE) $(THREAD_NUM)
34 | ./workload c mono $(TYPE) $(THREAD_NUM)
35 | ./workload e mono $(TYPE) $(THREAD_NUM)
36 | ./workload_string a email $(TYPE) $(THREAD_NUM)
37 | ./workload_string c email $(TYPE) $(THREAD_NUM)
38 | ./workload_string e email $(TYPE) $(THREAD_NUM)
39 |
40 | workload.o: workload.cpp microbench.h index.h util.h ./masstree/mtIndexAPI.hh ./BwTree/bwtree.h BTreeOLC/BTreeOLC.h BTreeOLC/BTreeOLC_child_layout.h ./pcm/pcm-memory.cpp ./pcm/pcm-numa.cpp ./papi_util.cpp
41 | $(CXX) $(CFLAGS) -c -o workload.o workload.cpp
42 |
43 | workload: skiplist-clean workload.o bwtree.o artolc.o btree.o ./masstree/mtIndexAPI.a ./pcm/libPCM.a $(SL_OBJS)
44 | $(CXX) $(CFLAGS) -o workload workload.o bwtree.o artolc.o btree.o $(SL_OBJS) masstree/mtIndexAPI.a ./pcm/libPCM.a $(MEMMGR) -lpthread -lm -ltbb
45 |
46 | workload_string.o: workload_string.cpp microbench.h index.h util.h ./masstree/mtIndexAPI.hh ./BwTree/bwtree.h BTreeOLC/BTreeOLC.h skiplist-clean
47 | $(CXX) $(CFLAGS) -c -o workload_string.o workload_string.cpp
48 |
49 | workload_string: skiplist-clean workload_string.o bwtree.o artolc.o ./masstree/mtIndexAPI.a $(SL_OBJS)
50 | $(CXX) $(CFLAGS) -o workload_string workload_string.o bwtree.o artolc.o $(SL_OBJS) masstree/mtIndexAPI.a $(MEMMGR) -lpthread -lm -ltbb
51 |
52 | bwtree.o: ./BwTree/bwtree.h ./BwTree/bwtree.cpp
53 | $(CXX) $(CFLAGS) -c -o bwtree.o ./BwTree/bwtree.cpp
54 |
55 | artolc.o: ./ARTOLC/*.cpp ./ARTOLC/*.h
56 | $(CXX) $(CFLAGS) ./ARTOLC/Tree.cpp -c -o artolc.o $(MEMMGR) -lpthread -lm -ltbb
57 |
58 | btree.o: ./btree-rtm/*.c ./btree-rtm/*.h
59 | $(CXX) $(CFLAGS) ./btree-rtm/btree.c -c -o btree.o $(MEMMGR) -lpthread -lm
60 |
61 | $(SL_DIR)/%.o: $(SL_DIR)/%.cpp $(SL_DIR)/%.h
62 | $(CXX) $(CFLAGS) -c -o $@ $< $(MEMMGR) -lpthread -lm -ltbb
63 |
64 | generate_workload:
65 | ./generate_all_workloads.sh
66 |
67 | clean:
68 | $(RM) workload workload_string *.o *~ *.d
69 | $(RM) $(SL_DIR)/*.o
70 |
71 | skiplist-clean:
72 | $(RM) rm $(SL_DIR)/*.o
73 |
--------------------------------------------------------------------------------
/nohotspot-skiplist/ptst.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * ptst.c: per-thread state for threads operating on the skip list
3 | *
4 | * Author: Ian Dick, 2013.
5 | */
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #include "common.h"
12 | #include "skiplist.h"
13 | #include "ptst.h"
14 | #include "garbagecoll.h"
15 |
16 | /* - Globals - */
17 | pthread_key_t ptst_key;
18 | ptst_t *ptst_list;
19 | static unsigned int next_id;
20 |
21 | /* - Private function declarations - */
22 | static void ptst_destructor(ptst_t *ptst);
23 |
24 | /* - Private function definitions - */
25 |
26 | /**
27 | * ptst_destructor - reclaim a recently released per-thread state
28 | * @ptst: the per-thread state to reclaim
29 | */
30 | static void ptst_destructor(ptst_t *ptst)
31 | {
32 | ptst->count = 0;
33 | }
34 |
35 | /* - Public ptst functions - */
36 |
37 | /**
38 | * ptst_critical_enter - enter/leave a critical section
39 | *
40 | * Returns a ptst handle for use by the calling thread during the
41 | * critical section.
42 | */
43 | ptst_t* ptst_critical_enter(void)
44 | {
45 | ptst_t *ptst, *next;
46 | unsigned int id;
47 |
48 | ptst = (ptst_t*) pthread_getspecific(ptst_key);
49 | if (NULL == ptst) {
50 | ptst = ptst_first();
51 | for ( ; NULL != ptst; ptst = ptst_next(ptst)) {
52 | if ((0 == ptst->count) && CAS(&ptst->count, 0, 1))
53 | break;
54 | }
55 |
56 | if (NULL == ptst) {
57 | ptst = (ptst_t *)ALIGNED_ALLOC(sizeof(ptst_t));
58 | if (!ptst) {
59 | perror("malloc: sl_ptst_critial_enter\n");
60 | exit(1);
61 | }
62 | memset(ptst, 0, sizeof(*ptst));
63 | ptst->gc = gc_init();
64 | ptst->count = 1;
65 | id = next_id;
66 | while ((!CAS(&next_id, id, id+1)))
67 | id = next_id;
68 | ptst->id = id;
69 | do {
70 | next = ptst_list;
71 | ptst->next = next;
72 | } while (!CAS(&ptst_list, next, ptst));
73 | }
74 |
75 | pthread_setspecific(ptst_key, ptst);
76 | }
77 |
78 | gc_enter(ptst);
79 |
80 | return ptst;
81 | }
82 |
83 | /**
84 | * ptst_subsystem_init - initialise the ptst subsystem
85 | *
86 | * Note: This should only happen once at the start of the application.
87 | */
88 | void ptst_subsystem_init(void)
89 | {
90 | ptst_list = NULL;
91 | next_id = 0;
92 | BARRIER();
93 | if (pthread_key_create(&ptst_key, (void (*)(void *))ptst_destructor)) {
94 | perror("pthread_key_create: ptst_subsystem_init\n");
95 | exit(1);
96 | }
97 | }
98 |
--------------------------------------------------------------------------------