Compare commits

...

No commits in common. "gh-pages" and "master" have entirely different histories.

797 changed files with 121188 additions and 1603 deletions

231
.cproject Normal file
View file

@ -0,0 +1,231 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.713831365">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.713831365" moduleId="org.eclipse.cdt.core.settings" name="Linux GCC">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="stasis" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.base.713831365" name="Linux GCC" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.base.713831365.1489428146" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.base.930492925" name="cdt.managedbuild.toolchain.gnu.base" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1380865982" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder buildPath="${workspace_loc:/stasis/build/}" id="cdt.managedbuild.target.gnu.builder.base.386827070" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" stopOnErr="false" superClass="cdt.managedbuild.target.gnu.builder.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.788388724" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.761900506" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1946158569" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
<option id="gnu.c.compiler.option.include.paths.2049135479" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/stasis/src/}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/stasis/}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/stasis/build/}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1962414466" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.2062053197" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base">
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1212285411" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.2025222543" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.base.1820567325" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.766467412" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="build" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="build"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="stasis.null.389853602" name="stasis"/>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Linux GCC">
<resource resourceType="PROJECT" workspacePath="/stasis"/>
</configuration>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.713831365;cdt.managedbuild.toolchain.gnu.base.713831365.1489428146;cdt.managedbuild.tool.gnu.c.compiler.base.1946158569;cdt.managedbuild.tool.gnu.c.compiler.input.1962414466">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>

22
.cvsignore Normal file
View file

@ -0,0 +1,22 @@
.cproject
.project
.settings
INSTALL
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.h
config.h.in
config.guess
config.log
config.status
config.sub
depcomp
install-sh
ltmain.sh
missing
py-compile
configure
libtool
stamp-h1

1
.gitattributes vendored
View file

@ -1 +0,0 @@
* text=auto

2
.gitignore vendored
View file

@ -1 +1 @@
*~
.svn

540
.htaccess
View file

@ -1,540 +0,0 @@
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
# ----------------------------------------------------------------------
# Better website experience for IE users
# ----------------------------------------------------------------------
# Force the latest IE version, in various cases when it may fall back to IE7 mode
# github.com/rails/rails/commit/123eb25#commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=Edge,chrome=1"
# mod_headers can't match by content-type, but we don't want to send this header on *everything*...
<FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
Header unset X-UA-Compatible
</FilesMatch>
</IfModule>
# ----------------------------------------------------------------------
# Cross-domain AJAX requests
# ----------------------------------------------------------------------
# Serve cross-domain Ajax requests, disabled by default.
# enable-cors.org
# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
# <IfModule mod_headers.c>
# Header set Access-Control-Allow-Origin "*"
# </IfModule>
# ----------------------------------------------------------------------
# CORS-enabled images (@crossorigin)
# ----------------------------------------------------------------------
# Send CORS headers if browsers request them; enabled by default for images.
# developer.mozilla.org/en/CORS_Enabled_Image
# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
# wiki.mozilla.org/Security/Reviews/crossoriginAttribute
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
# mod_headers, y u no match by Content-Type?!
<FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">
SetEnvIf Origin ":" IS_CORS
Header set Access-Control-Allow-Origin "*" env=IS_CORS
</FilesMatch>
</IfModule>
</IfModule>
# ----------------------------------------------------------------------
# Webfont access
# ----------------------------------------------------------------------
# Allow access from all domains for webfonts.
# Alternatively you could only whitelist your
# subdomains like "subdomain.example.com".
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
# ----------------------------------------------------------------------
# Proper MIME type for all files
# ----------------------------------------------------------------------
# JavaScript
# Normalize to standard type (it's sniffed in IE anyways)
# tools.ietf.org/html/rfc4329#section-7.2
AddType application/javascript js jsonp
AddType application/json json
# Audio
AddType audio/ogg oga ogg
AddType audio/mp4 m4a f4a f4b
# Video
AddType video/ogg ogv
AddType video/mp4 mp4 m4v f4v f4p
AddType video/webm webm
AddType video/x-flv flv
# SVG
# Required for svg webfonts on iPad
# twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
# Webfonts
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
AddType application/x-font-woff woff
# Assorted types
AddType image/x-icon ico
AddType image/webp webp
AddType text/cache-manifest appcache manifest
AddType text/x-component htc
AddType application/xml rss atom xml rdf
AddType application/x-chrome-extension crx
AddType application/x-opera-extension oex
AddType application/x-xpinstall xpi
AddType application/octet-stream safariextz
AddType application/x-web-app-manifest+json webapp
AddType text/x-vcard vcf
AddType application/x-shockwave-flash swf
AddType text/vtt vtt
# ----------------------------------------------------------------------
# Allow concatenation from within specific js and css files
# ----------------------------------------------------------------------
# e.g. Inside of script.combined.js you could have
# <!--#include file="libs/jquery-1.5.0.min.js" -->
# <!--#include file="plugins/jquery.idletimer.js" -->
# and they would be included into this single file.
# This is not in use in the boilerplate as it stands. You may
# choose to use this technique if you do not have a build process.
#<FilesMatch "\.combined\.js$">
# Options +Includes
# AddOutputFilterByType INCLUDES application/javascript application/json
# SetOutputFilter INCLUDES
#</FilesMatch>
#<FilesMatch "\.combined\.css$">
# Options +Includes
# AddOutputFilterByType INCLUDES text/css
# SetOutputFilter INCLUDES
#</FilesMatch>
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
# Compress all output labeled with one of the following MIME-types
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/rss+xml \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/html \
text/plain \
text/x-component \
text/xml
</IfModule>
</IfModule>
# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
# These are pretty far-future expires headers.
# They assume you control versioning with filename-based cache busting
# Additionally, consider that outdated proxies may miscache
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
# If you don't use filenames to version, lower the CSS and JS to something like
# "access plus 1 week".
<IfModule mod_expires.c>
ExpiresActive on
# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"
# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Your document html
ExpiresByType text/html "access plus 0 seconds"
# Data
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
# Feed
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/atom+xml "access plus 1 hour"
# Favicon (cannot be renamed)
ExpiresByType image/x-icon "access plus 1 week"
# Media: images, video, audio
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# HTC files (css3pie)
ExpiresByType text/x-component "access plus 1 month"
# Webfonts
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
# CSS and JavaScript
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
# ----------------------------------------------------------------------
# Prevent mobile network providers from modifying your site
# ----------------------------------------------------------------------
# The following header prevents modification of your code over 3G on some
# European providers.
# This is the official 'bypass' suggested by O2 in the UK.
# <IfModule mod_headers.c>
# Header set Cache-Control "no-transform"
# </IfModule>
# ----------------------------------------------------------------------
# ETag removal
# ----------------------------------------------------------------------
# FileETag None is not enough for every server.
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
# Since we're sending far-future expires, we don't need ETags for
# static content.
# developer.yahoo.com/performance/rules.html#etags
FileETag None
# ----------------------------------------------------------------------
# Stop screen flicker in IE on CSS rollovers
# ----------------------------------------------------------------------
# The following directives stop screen flicker in IE on CSS rollovers - in
# combination with the "ExpiresByType" rules for images (see above).
# BrowserMatch "MSIE" brokenvary=1
# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
# BrowserMatch "Opera" !brokenvary
# SetEnvIf brokenvary 1 force-no-vary
# ----------------------------------------------------------------------
# Set Keep-Alive Header
# ----------------------------------------------------------------------
# Keep-Alive allows the server to send multiple requests through one
# TCP-connection. Be aware of possible disadvantages of this setting. Turn on
# if you serve a lot of static content.
# <IfModule mod_headers.c>
# Header set Connection Keep-Alive
# </IfModule>
# ----------------------------------------------------------------------
# Cookie setting from iframes
# ----------------------------------------------------------------------
# Allow cookies to be set from iframes (for IE only)
# If needed, specify a path or regex in the Location directive.
# <IfModule mod_headers.c>
# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
# </IfModule>
# ----------------------------------------------------------------------
# Start rewrite engine
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and
# features. FollowSymLinks must be enabled for this to work.
# Some cloud hosting services require RewriteBase to be set: goo.gl/HOcPN
# If using the h5bp in a subdirectory, use `RewriteBase /foo` instead where
# 'foo' is your directory.
# If your web host doesn't allow the FollowSymlinks option, you may need to
# comment it out and use `Options +SymLinksIfOwnerMatch`, but be aware of the
# performance impact: http://goo.gl/Mluzd
<IfModule mod_rewrite.c>
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On
# RewriteBase /
</IfModule>
# ----------------------------------------------------------------------
# Suppress or force the "www." at the beginning of URLs
# ----------------------------------------------------------------------
# The same content should never be available under two different URLs -
# especially not with and without "www." at the beginning, since this can cause
# SEO problems (duplicate content). That's why you should choose one of the
# alternatives and redirect the other one.
# By default option 1 (no "www.") is activated.
# no-www.org/faq.php?q=class_b
# If you'd prefer to use option 2, just comment out all option 1 lines
# and uncomment option 2.
# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!
# ----------------------------------------------------------------------
# Option 1:
# Rewrite "www.example.com -> example.com".
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>
# ----------------------------------------------------------------------
# Option 2:
# Rewrite "example.com -> www.example.com".
# Be aware that the following rule might not be a good idea if you use "real"
# subdomains for certain parts of your website.
# <IfModule mod_rewrite.c>
# RewriteCond %{HTTPS} !=on
# RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# </IfModule>
# ----------------------------------------------------------------------
# Built-in filename-based cache busting
# ----------------------------------------------------------------------
# If you're not using the build script to manage your filename version revving,
# you might want to consider enabling this, which will route requests for
# `/css/style.20110203.css` to `/css/style.css`.
# To understand why this is important and a better idea than all.css?v1231,
# please refer to the bundled documentation about `.htaccess`.
# <IfModule mod_rewrite.c>
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]
# </IfModule>
# ----------------------------------------------------------------------
# Prevent SSL cert warnings
# ----------------------------------------------------------------------
# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
# https://www.example.com when your cert only allows https://secure.example.com
# <IfModule mod_rewrite.c>
# RewriteCond %{SERVER_PORT} !^443
# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
# </IfModule>
# ----------------------------------------------------------------------
# Prevent 404 errors for non-existing redirected folders
# ----------------------------------------------------------------------
# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the
# same name does not exist.
# webmasterworld.com/apache/3808792.htm
Options -MultiViews
# ----------------------------------------------------------------------
# Custom 404 page
# ----------------------------------------------------------------------
# You can add custom pages to handle 500 or 403 pretty easily, if you like.
# If you are hosting your site in subdirectory, adjust this accordingly
# e.g. ErrorDocument 404 /subdir/404.html
ErrorDocument 404 /404.html
# ----------------------------------------------------------------------
# UTF-8 encoding
# ----------------------------------------------------------------------
# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset utf-8
# Force UTF-8 for a number of file formats
AddCharset utf-8 .atom .css .js .json .rss .vtt .xml
# ----------------------------------------------------------------------
# A little more security
# ----------------------------------------------------------------------
# To avoid displaying the exact version number of Apache being used, add the
# following to httpd.conf (it will not work in .htaccess):
# ServerTokens Prod
# "-Indexes" will have Apache block users from browsing folders without a
# default document Usually you should leave this activated, because you
# shouldn't allow everybody to surf through every folder on your server (which
# includes rather private places like CMS system folders).
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# Block access to "hidden" directories or files whose names begin with a
# period. This includes directories used by version control systems such as
# Subversion or Git.
<IfModule mod_rewrite.c>
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]
</IfModule>
# Block access to backup and source files. These files may be left by some
# text/html editors and pose a great security danger, when anyone can access
# them.
<FilesMatch "(\.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
# If your server is not already configured as such, the following directive
# should be uncommented in order to set PHP's register_globals option to OFF.
# This closes a major security hole that is abused by most XSS (cross-site
# scripting) attacks. For more information: http://php.net/register_globals
#
# IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS:
#
# Your server does not allow PHP directives to be set via .htaccess. In that
# case you must make this change in your php.ini file instead. If you are
# using a commercial web host, contact the administrators for assistance in
# doing this. Not all servers allow local php.ini files, and they should
# include all PHP configurations (not just this one), or you will effectively
# reset everything to PHP defaults. Consult www.php.net for more detailed
# information about setting PHP directives.
# php_flag register_globals Off
# Rename session cookie to something else, than PHPSESSID
# php_value session.name sid
# Disable magic quotes (This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.)
# php_flag magic_quotes_gpc Off
# Do not show you are using PHP
# Note: Move this line to php.ini since it won't work in .htaccess
# php_flag expose_php Off
# Level of log detail - log all errors
# php_value error_reporting -1
# Write errors to log file
# php_flag log_errors On
# Do not display errors in browser (production - Off, development - On)
# php_flag display_errors Off
# Do not display startup errors (production - Off, development - On)
# php_flag display_startup_errors Off
# Format errors in plain text
# Note: Leave this setting 'On' for xdebug's var_dump() output
# php_flag html_errors Off
# Show multiple occurrence of error
# php_flag ignore_repeated_errors Off
# Show same errors from different sources
# php_flag ignore_repeated_source Off
# Size limit for error messages
# php_value log_errors_max_len 1024
# Don't precede error with string (doesn't accept empty string, use whitespace if you need)
# php_value error_prepend_string " "
# Don't prepend to error (doesn't accept empty string, use whitespace if you need)
# php_value error_append_string " "
# Increase cookie security
<IfModule php5_module>
php_value session.cookie_httponly true
</IfModule>

81
.project Normal file
View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>stasis</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>-j4</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/stasis/build/}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>

157
404.html
View file

@ -1,157 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Not Found :(</title>
<style>
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
html {
padding: 30px 10px;
font-size: 20px;
line-height: 1.4;
color: #737373;
background: #f0f0f0;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
input {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
max-width: 500px;
_width: 500px;
padding: 30px 20px 50px;
border: 1px solid #b3b3b3;
border-radius: 4px;
margin: 0 auto;
box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
background: #fcfcfc;
}
h1 {
margin: 0 10px;
font-size: 50px;
text-align: center;
}
h1 span {
color: #bbb;
}
h3 {
margin: 1.5em 0 0.5em;
}
p {
margin: 1em 0;
}
ul {
padding: 0 0 0 40px;
margin: 1em 0;
}
.container {
max-width: 380px;
_width: 380px;
margin: 0 auto;
}
/* google search */
#goog-fixurl ul {
list-style: none;
padding: 0;
margin: 0;
}
#goog-fixurl form {
margin: 0;
}
#goog-wm-qt,
#goog-wm-sb {
border: 1px solid #bbb;
font-size: 16px;
line-height: normal;
vertical-align: top;
color: #444;
border-radius: 2px;
}
#goog-wm-qt {
width: 220px;
height: 20px;
padding: 5px;
margin: 5px 10px 0 0;
box-shadow: inset 0 1px 1px #ccc;
}
#goog-wm-sb {
display: inline-block;
height: 32px;
padding: 0 10px;
margin: 5px 0 0;
white-space: nowrap;
cursor: pointer;
background-color: #f5f5f5;
background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
*overflow: visible;
*display: inline;
*zoom: 1;
}
#goog-wm-sb:hover,
#goog-wm-sb:focus {
border-color: #aaa;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
background-color: #f8f8f8;
}
#goog-wm-qt:hover,
#goog-wm-qt:focus {
border-color: #105cb6;
outline: 0;
color: #222;
}
input::-moz-focus-inner {
padding: 0;
border: 0;
}
</style>
</head>
<body>
<div class="container">
<h1>Not found <span>:(</span></h1>
<p>Sorry, but the page you were trying to view does not exist.</p>
<p>It looks like this was the result of either:</p>
<ul>
<li>a mistyped address</li>
<li>an out-of-date link</li>
</ul>
<script>
var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
</script>
<script src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
</div>
</body>
</html>

37
AUTHORS Normal file
View file

@ -0,0 +1,37 @@
Author:
Russell Sears sears@cs.berkeley.edu
The following people contributed to this software in the past:
--------------------------------------------------------------
Initial version of library:
Jason Bayer bayer@xcf.berkeley.edu
Jim Blomo jim@xcf.berkeley.edu
Jimmy Kittiyachavalit jkit@xcf.berkeley.edu
The following libraries are bundled with this software:
------------------------------------------------------
libredblack http://libredblack.sourceforge.net
(lladd/redblack.h, src/lladd/redblack.c)
crc32 http://www.axlradius.com/freestuff/crc2.c
(lladd/src/lladd/crc32.c)
Earlier versions of this software made use of:
----------------------------------------------
PBL - The Program Base Library
http://www.mission-base.com/peter/source/
PBL has been replaced with our own reentrant linear hash
implementation that includes (deprecated) compatibility with the
pblHt* interface.
check - C Unit Test Framework
http://check.sourceforge.net/
check has been replaced with test/check_impl.h, which implements a subset
of the check API.

198
CMakeLists.txt Normal file
View file

@ -0,0 +1,198 @@
cmake_minimum_required(VERSION 2.4) # For all I know, 2.0 works too...
# Make cmake warning go away. They changed the default library search behavior.
# The new behavior seems preferable, though it shouldn't affect us either way.
if(COMMAND cmake_policy)
# cmake_policy(SET CMP0014 OLD) ## This breaks builds on older cmake...
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
Project(Stasis)
SET(PACKAGE_VERSION 1)
SUBDIRS(src test utilities benchmarks examples lang)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
SET(FLEX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
SET(BISON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Main decisions
SET(BUILD_SHARED_LIBS ON)
#ENABLE_TESTING()
INCLUDE(CTest)
FIND_PACKAGE(FLEX)
FIND_PACKAGE(BISON)
STRING(REGEX MATCH NEW_ENOUGH_FLEX "^flex 2\\.5\\.3" FLEX_VERSION)
FIND_PACKAGE(Doxygen)
if(DOXYGEN_EXECUTABLE)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile
)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/doc/developers/html/index.html
COMMAND rm -rf ${CMAKE_BINARY_DIR}/doc/developers
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/doc/developers
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/Doxyfile
DEPENDS ${CMAKE_BINARY_DIR}/doc/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_custom_target(
docs ALL
DEPENDS
${CMAKE_BINARY_DIR}/doc/developers/html/index.html
)
else(DOXYGEN_EXECUTABLE)
message(STATUS "doxygen not found; documentation will not be built")
endif(DOXYGEN_EXECUTABLE)
FIND_LIBRARY(HAVE_CONFUSE NAMES confuse)
if(NOT HAVE_CONFUSE)
message(STATUS "libconfuse not found; sample application 'libdfa' will not be built")
endif(NOT HAVE_CONFUSE)
FIND_LIBRARY(HAVE_FUSE NAMES fuse)
if(NOT HAVE_FUSE)
message(STATUS "fuse not found; sample application 'stasis_fuse' will not be built")
endif(NOT HAVE_FUSE)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckCSourceCompiles)
CHECK_FUNCTION_EXISTS(sync_file_range HAVE_SYNC_FILE_RANGE)
CHECK_FUNCTION_EXISTS(posix_fallocate HAVE_POSIX_FALLOCATE)
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
CHECK_FUNCTION_EXISTS(posix_fadvise HAVE_POSIX_FADVISE)
CHECK_FUNCTION_EXISTS(fdatasync HAVE_FDATASYNC)
CHECK_FUNCTION_EXISTS(tdestroy HAVE_TDESTROY)
FIND_PACKAGE(JNI)
FIND_PACKAGE(PERL)
FIND_PACKAGE(RUBY)
FIND_LIBRARY(DBUG_TEST dbug-stubs /home/sears/local/dbug/lib/)
if(NOT DBUG_TEST)
message(STATUS "dbug not found. proceeding with normal build")
SET(DBUG "")
else(NOT DBUG_TEST)
message(STATUS "found dbug ${DBUG_TEST}")
SET(DBUG ${DBUG_TEST})
endif(NOT DBUG_TEST)
SET(CMAKE_REQUIRED_FLAGS "-lm")
CHECK_FUNCTION_EXISTS(powl HAVE_POWL)
MACRO(CHECK_CONSTANT_EXISTS FLAG)
CHECK_C_SOURCE_COMPILES("#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <limits.h>
int main(int argc, char * argv[]) {
argc = ${FLAG};
}
" HAVE_${FLAG})
ENDMACRO(CHECK_CONSTANT_EXISTS)
CHECK_CONSTANT_EXISTS(O_DIRECT)
CHECK_CONSTANT_EXISTS(O_DSYNC)
CHECK_CONSTANT_EXISTS(O_NOATIME)
CHECK_CONSTANT_EXISTS(PTHREAD_STACK_MIN)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
SET(ON_LINUX "LINUX")
ENDIF(CMAKE_SYSTEM_NAME)
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(ON_DARWIN "DARWIN")
ENDIF(CMAKE_SYSTEM_NAME)
#other options are "Windows" and "Solaris"
CHECK_C_SOURCE_COMPILES("#include <alloca.h>
int main(int argc, char * argv[]) { alloca(1); }" HAVE_ALLOCA_H)
CHECK_C_SOURCE_COMPILES("#define _GNU_SOURCE
#include <stdio.h>
int main(int argc, char * argv[]) {
getline(0,0,0);
}
" HAVE_GETLINE)
CHECK_C_SOURCE_COMPILES("
int main(int argc, char* argv[]) {
int i;
__sync_bool_compare_and_swap(&i, 0, 1);
}
" HAVE_GCC_ATOMICS)
MACRO(CREATE_CHECK NAME)
ADD_EXECUTABLE(${NAME} ${NAME}.c)
TARGET_LINK_LIBRARIES(${NAME} ${COMMON_LIBRARIES})
#SET_SOURCE_FILES_PROPERTIES( ${NAME}.c PROPERTIES LANGUAGE "CXX" )
#SET_TARGET_PROPERTIES(${NAME} PROPERTIES LINKER_LANGUAGE "CXX")
ADD_TEST(${NAME} nice ./${NAME})
ENDMACRO(CREATE_CHECK)
MACRO(CREATE_EXPERIMENTAL_CHECK NAME)
ADD_EXECUTABLE(${NAME} ${NAME}.c)
TARGET_LINK_LIBRARIES(${NAME} stasis_experimental ${COMMON_LIBRARIES})
ADD_TEST(${NAME} nice ./${NAME})
ENDMACRO(CREATE_EXPERIMENTAL_CHECK)
MACRO(CREATE_CHECK_OPT NAME OPT)
ADD_EXECUTABLE(${NAME} ${NAME}.c)
TARGET_LINK_LIBRARIES(${NAME} ${COMMON_LIBRARIES})
ADD_TEST(${NAME} nice ./${NAME} ${OPT})
ENDMACRO(CREATE_CHECK_OPT)
MACRO(CREATE_EXECUTABLE NAME)
ADD_EXECUTABLE(${NAME} ${NAME}.c)
TARGET_LINK_LIBRARIES(${NAME} ${COMMON_LIBRARIES})
ENDMACRO(CREATE_EXECUTABLE)
# Output the config.h file
#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
/usr/include)
# set linker path for this and all subdirs
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/stasis)
IF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
SET(COMMON_LIBRARIES stasis m pthread stdc++ ${DBUG}) # profiler)
SET(CMAKE_C_FLAGS "-g -Wall -Wextra -ansi -Wno-unused-parameter -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -Wall -Wextra -ansi -Wno-unused-parameter -std=c++98 -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
ELSEIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro" )
SET(COMMON_LIBRARIES stasis m pthread Crun Cstd)
SET(CMAKE_C_FLAGS "-g -xc99=all -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
ELSE( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
# TODO: how to detect compilers correctly on old cmake??? This is a huge hack; it uses old gcc
# options, since cmake is old...
SET(COMMON_LIBRARIES stasis m pthread stdc++ ${DBUG})
SET(CMAKE_C_FLAGS "-g -Wall -Wlong-long -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -Wall -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
ENDIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/stasis
DESTINATION include/
#FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
PATTERN ".deps" EXCLUDE)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/stasis
DESTINATION include/
#FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
PATTERN ".deps" EXCLUDE)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)

45
COPYING Normal file
View file

@ -0,0 +1,45 @@
/*
LLADD LICENSE TERMS - (TCL/TK License)
This software is copyrighted by the Regents of the University of
California, and other parties. The following terms apply to all files
associated with the software unless explicitly disclaimed in
individual files.
The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose,
provided that existing copyright notices are retained in all copies
and that this notice is included verbatim in any distributions. No
written agreement, license, or royalty fee is required for any of the
authorized uses. Modifications to this software may be copyrighted by
their authors and need not follow the licensing terms described here,
provided that the new terms are clearly indicated on the first page of
each file where they apply.
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND
THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights" in
the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are
acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
*/

22
CTestConfig.cmake Normal file
View file

@ -0,0 +1,22 @@
## DON'T SUBMIT TO KITWARE DASHBOARD SERVER!!!
# Dashboard is opened for submissions for a 24 hour period starting at
# the specified NIGHLY_START_TIME. Time is specified in 24 hour format.
SET (CTEST_NIGHTLY_START_TIME "23:00:00 EDT")
SET (CTEST_TIME_OUT 3000)
# Dart server to submit results (used by client)
IF(CTEST_DROP_METHOD MATCHES http)
# SET (CTEST_DROP_SITE "public.kitware.com")
SET (CTEST_DROP_SITE "localhost")
SET (CTEST_DROP_LOCATION "/cgi-bin/HTTPUploadDartFile.cgi")
ELSE(CTEST_DROP_METHOD MATCHES http)
# SET (CTEST_DROP_SITE "public.kitware.com")
SET (CTEST_DROP_SITE "localhost")
SET (CTEST_DROP_LOCATION "/incoming")
SET (CTEST_DROP_SITE_USER "ftpuser")
SET (CTEST_DROP_SITE_PASSWORD "public")
ENDIF(CTEST_DROP_METHOD MATCHES http)
SET (CTEST_TRIGGER_SITE
"http://${DROP_SITE}/cgi-bin/Submit-vtk-TestingResults.pl")

29
INSTALL Normal file
View file

@ -0,0 +1,29 @@
Prerequisites (ubuntu/debian):
build-essential cmake
Recommended build procedure:
mkdir build ; cd build ; cmake ..
make -j 4
cd test ; make test
Optional dependencies:
flex yacc (for a relational algebra language demo)
fuse (for a fuse demo)
swig (for python bindings)
libconfuse
Berkeley DB (for performance comparisons)
Obsolete build procedure
=========================
(Uses autoconf, automake and libtool)
./reconf ; ./configure --quiet
make -j 4
Extra requirements for obsolete build:
automake libtool

5
Makefile Normal file
View file

@ -0,0 +1,5 @@
LIBSRC = $(wildcard src/stasis/*.c) $(wildcard src/stasis/*/*.c) $(wildcard src/stasis/*/*/*.c) \
$(wildcard src/stasis/*.cpp) $(wildcard src/stasis/*/*.cpp) $(wildcard src/stasis/*/*/*.cpp)
LIBNAME = stasis
include config/Makefile.stasis

61
Makefile.am Normal file
View file

@ -0,0 +1,61 @@
EXTRA_DIST = reconf
SUBDIRS = stasis src test utilities benchmarks examples
export GLOBAL_CFLAGS = -g -Wall -pedantic -std=gnu99 -DPBL_COMPAT
nobase_include_HEADERS=stasis/rw.h # XXX move rw.h into stasis/ !!!
ACLOCAL_AMFLAGS = -I m4
## GOAL: Make these not warn!
#-Wextra -Wno-unused-parameter -Winline
# -feliminate-unused-debug-symbols -feliminate-unused-debug-types -funit-at-a-time -finline-functions -fno-keep-static-consts
#-funit-at-a-time => -finline-functions-called-once
#-Wconversion
doc/Doxyfile: doc/Doxyfile.in
./doc/gen_doxyfile.pl < $< > $@
docs: doc/Doxyfile
doxygen doc/Doxyfile
tidy: precoverage
find . -name '*~' -exec rm '{}' \;
find . -name 'core' -exec rm '{}' \;
find . -name 'core.[0-9]*' -exec rm '{}' \;
find . -name 'vgcore.*' -exec rm '{}' \;
find . -name '.\#*' -exec rm '{}' \;
find . -name '*.da' -exec rm '{}' \;
find . -name '*.gcda' -exec rm '{}' \;
find . -name '*.gcno' -exec rm '{}' \;
rm -f doc/Doxyfile
precoverage :
find . -name '*.bb' | xargs rm -f
find . -name '*.bbg' | xargs rm -f
find . -name '*.da' | xargs rm -f
rm -rf doc/coverage
coverage: precoverage
echo '(make profile requires CFLAGS="-fprofile-arcs -ftest-coverage -pg -O0")'
# cd test/lladd
# make check || true
rm -rf coverage
mkdir coverage
cp /home/sears/cron_stuff/CMakeCache.txt coverage
cd coverage ; pwd
cd coverage ; cmake ..
cd coverage ; mv DartConfiguration.tcl DartConfiguration.tcl~
cd coverage ; perl -ne 's/TimeOut\: 1500/TimeOut\: 3600/;print' < DartConfiguration.tcl~ > DartConfiguration.tcl
cd coverage ; make -j 4
cd coverage ; ctest || true
cd coverage ; lcov -c --directory src/stasis/ --directory test/ --directory src/apps/referential/ > tmp.info || true
cd coverage ; genhtml -o ../doc/coverage tmp.info || true
cd coverage ; rm tmp.info
# cd ../..
# lcov -c --directory src/libdfa/ --directory src/lladd/ --directory test/ > tmp.info
## lcov -c --directory . > tmp.info
# genhtml -o doc/coverage tmp.info
# rm tmp.info
.PHONY: docs precoverage coverage

41
Makefile.oink Normal file
View file

@ -0,0 +1,41 @@
# find . -type f -name *.c | grep -v \/pobj\/ | grep -v \/cht\/ | grep -v \/fuse\/ | grep -v \/libdfa\/ | grep -v \/cyrus\/ | grep -v \/lladd-old\/ | xargs -iqq mcpp -m64 -K -DPBL_COMPAT -I. -I src -I /usr/include -I /usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/ -I build qq > /dev/null
GCC_INC = -I /usr/lib/gcc/i486-linux-gnu/4.1/include
#/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include
TRACE_DIR = ./utilities/trace
OINK = ../oink-stack/oink/xform
OINK_ARGS = -fx-wrap-fun-call -x-wrap-fun-call-config-file $(TRACE_DIR)/smoketest.ca
STANDARD_INC = -I build -I . -I src -I /usr/include
cfiles = $(wildcard src/stasis/*.c) \
$(wildcard src/stasis/*/*.c) \
$(wildcard test/stasis/*.c)
ifiles = $(patsubst %.c,build-oink/%.i,$(cfiles))
patches = $(patsubst %.c,build-oink/%.patch,$(cfiles))
.PHONY : clean TREE
all : wrap.patch
wrap.patch : $(patches)
cat $^ > $@.tmp
$(TRACE_DIR)/dedup-patch.pl < $@.tmp > $@
build-oink/% : %
mkdir -p $@
TREE : $(dir $(ifiles))
@true
mkdir -p $^
build-oink/%.i : %.c TREE
mcpp -K -DPBL_COMPAT $(STANDARD_INC) $(GCC_INC) $< -o $@
%.patch : %.i $(OINK)
$(OINK) $(OINK_ARGS) $< > $@
clean :
rm -f $(ifiles) $(patches) wrap.patch

9
README Normal file
View file

@ -0,0 +1,9 @@
Stasis is a transactional storage library.
Please see the COPYING file for licensing information, and INSTALL for
compilation instructions.
More information, including papers, a tutorial and API documentation
are available at:
http://www.cs.berkeley.edu/~sears/stasis/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

22
benchmarks/.cvsignore Normal file
View file

@ -0,0 +1,22 @@
.deps
Makefile
Makefile.in
.libs
arrayListSet
lhtableThreaded
linearHashNTA
linearHashNTAMultiReader
linearHashNTAThreaded
linearHashNTAWriteRequests
linkedListNTA
logicalHash
logicalMultThreaded
logicalMultiReaders
naiveHash
naiveMultiThreaded
pageOrientedListNTA
rawSet
readLogicalHash
sequentialThroughput
transitiveClosure
zeroCopy

View file

@ -0,0 +1,19 @@
./berkeleyDB/bdbHash 1 100000
./berkeleyDB/bdbHash 1 150000
./berkeleyDB/bdbHash 1 200000
./berkeleyDB/bdbHash 1 250000
./berkeleyDB/bdbHash 1 300000
./berkeleyDB/bdbHash 1 350000
./berkeleyDB/bdbHash 1 400000
./berkeleyDB/bdbHash 1 450000
./berkeleyDB/bdbHash 1 500000
./berkeleyDB/bdbHash 1 550000
./berkeleyDB/bdbHash 1 600000
./berkeleyDB/bdbHash 1 650000
./berkeleyDB/bdbHash 1 700000
./berkeleyDB/bdbHash 1 750000
./berkeleyDB/bdbHash 1 800000
./berkeleyDB/bdbHash 1 850000
./berkeleyDB/bdbHash 1 900000
./berkeleyDB/bdbHash 1 950000
./berkeleyDB/bdbHash 1 1000000

View file

@ -0,0 +1,19 @@
./berkeleyDB/bdbRaw 1 100000
./berkeleyDB/bdbRaw 1 150000
./berkeleyDB/bdbRaw 1 200000
./berkeleyDB/bdbRaw 1 250000
./berkeleyDB/bdbRaw 1 300000
./berkeleyDB/bdbRaw 1 350000
./berkeleyDB/bdbRaw 1 400000
./berkeleyDB/bdbRaw 1 450000
./berkeleyDB/bdbRaw 1 500000
./berkeleyDB/bdbRaw 1 550000
./berkeleyDB/bdbRaw 1 600000
./berkeleyDB/bdbRaw 1 650000
./berkeleyDB/bdbRaw 1 700000
./berkeleyDB/bdbRaw 1 750000
./berkeleyDB/bdbRaw 1 800000
./berkeleyDB/bdbRaw 1 850000
./berkeleyDB/bdbRaw 1 900000
./berkeleyDB/bdbRaw 1 950000
./berkeleyDB/bdbRaw 1 1000000

50
benchmarks/CMakeLists.txt Normal file
View file

@ -0,0 +1,50 @@
SUBDIRS(multicore)
IF(HAVE_GETLINE)
ADD_EXECUTABLE(rose rose.cpp)
TARGET_LINK_LIBRARIES(rose stasis_experimental ${COMMON_LIBRARIES})
ADD_EXECUTABLE(roseTable roseTable.cpp)
TARGET_LINK_LIBRARIES(roseTable stasis_experimental ${COMMON_LIBRARIES})
ADD_EXECUTABLE(roseTableTpcCH-workload1 roseTableTpcCH-workload1.cpp)
TARGET_LINK_LIBRARIES(roseTableTpcCH-workload1 stasis_experimental ${COMMON_LIBRARIES})
ADD_EXECUTABLE(roseTableTpcCH-workload2 roseTableTpcCH-workload2.cpp)
TARGET_LINK_LIBRARIES(roseTableTpcCH-workload2 stasis_experimental ${COMMON_LIBRARIES})
ADD_EXECUTABLE(transitiveClosure transitiveClosure.c)
TARGET_LINK_LIBRARIES(transitiveClosure stasis_experimental ${COMMON_LIBRARIES})
ENDIF(HAVE_GETLINE)
CREATE_EXECUTABLE(lhtableThreaded)
CREATE_EXECUTABLE(naiveHash)
CREATE_EXECUTABLE(naiveMultiThreaded)
CREATE_EXECUTABLE(rawSet)
CREATE_EXECUTABLE(arrayListSet)
CREATE_EXECUTABLE(linearHashNTA)
CREATE_EXECUTABLE(linkedListNTA)
CREATE_EXECUTABLE(pageOrientedListNTA)
CREATE_EXECUTABLE(linearHashNTAThreaded)
CREATE_EXECUTABLE(linearHashNTAMultiReader)
CREATE_EXECUTABLE(linearHashNTAWriteRequests)
CREATE_EXECUTABLE(sequentialThroughput)
CREATE_EXECUTABLE(qos)
CREATE_EXECUTABLE(writeBack)
CREATE_EXECUTABLE(distributedLsnFree)
CREATE_EXECUTABLE(bufferManager)
CREATE_EXECUTABLE(redBlackMemoryOverhead)
CREATE_EXECUTABLE(hashPerformance)
CREATE_EXECUTABLE(seekMap)
CREATE_EXECUTABLE(rawIOPS)
CREATE_EXECUTABLE(turbine)
CREATE_EXECUTABLE(stride)
CREATE_EXECUTABLE(butterfly)
IF(CHECK_LIBRARY)
ADD_TEST(rose rose)
ENDIF(CHECK_LIBRARY)
CREATE_EXECUTABLE(slotted)

View file

@ -0,0 +1,19 @@
./logicalHash 1 100000
./logicalHash 1 150000
./logicalHash 1 200000
./logicalHash 1 250000
./logicalHash 1 300000
./logicalHash 1 350000
./logicalHash 1 400000
./logicalHash 1 450000
./logicalHash 1 500000
./logicalHash 1 550000
./logicalHash 1 600000
./logicalHash 1 650000
./logicalHash 1 700000
./logicalHash 1 750000
./logicalHash 1 800000
./logicalHash 1 850000
./logicalHash 1 900000
./logicalHash 1 950000
./logicalHash 1 1000000

View file

@ -0,0 +1,19 @@
./naiveHash 1 100000
./naiveHash 1 150000
./naiveHash 1 200000
./naiveHash 1 250000
./naiveHash 1 300000
./naiveHash 1 350000
./naiveHash 1 400000
./naiveHash 1 450000
./naiveHash 1 500000
./naiveHash 1 550000
./naiveHash 1 600000
./naiveHash 1 650000
./naiveHash 1 700000
./naiveHash 1 750000
./naiveHash 1 800000
./naiveHash 1 850000
./naiveHash 1 900000
./naiveHash 1 950000
./naiveHash 1 1000000

View file

@ -0,0 +1,19 @@
./arrayListSet 1 100000
./arrayListSet 1 150000
./arrayListSet 1 200000
./arrayListSet 1 250000
./arrayListSet 1 300000
./arrayListSet 1 350000
./arrayListSet 1 400000
./arrayListSet 1 450000
./arrayListSet 1 500000
./arrayListSet 1 550000
./arrayListSet 1 600000
./arrayListSet 1 650000
./arrayListSet 1 700000
./arrayListSet 1 750000
./arrayListSet 1 800000
./arrayListSet 1 850000
./arrayListSet 1 900000
./arrayListSet 1 950000
./arrayListSet 1 1000000

View file

@ -0,0 +1,19 @@
./linearHashNTAThreaded 50 2000
./linearHashNTAThreaded 50 3000
./linearHashNTAThreaded 50 4000
./linearHashNTAThreaded 50 5000
./linearHashNTAThreaded 50 6000
./linearHashNTAThreaded 50 7000
./linearHashNTAThreaded 50 8000
./linearHashNTAThreaded 50 9000
./linearHashNTAThreaded 50 10000
./linearHashNTAThreaded 50 11000
./linearHashNTAThreaded 50 12000
./linearHashNTAThreaded 50 13000
./linearHashNTAThreaded 50 14000
./linearHashNTAThreaded 50 15000
./linearHashNTAThreaded 50 16000
./linearHashNTAThreaded 50 17000
./linearHashNTAThreaded 50 18000
./linearHashNTAThreaded 50 19000
./linearHashNTAThreaded 50 20000

View file

@ -0,0 +1,34 @@
./linearHashNTAMultiReader 1 50000
./linearHashNTAMultiReader 2 25000
./linearHashNTAMultiReader 3 16666.6666666667
./linearHashNTAMultiReader 4 12500
./linearHashNTAMultiReader 5 10000
./linearHashNTAMultiReader 6 8333.33333333333
./linearHashNTAMultiReader 7 7142.85714285714
./linearHashNTAMultiReader 8 6250
./linearHashNTAMultiReader 9 5555.55555555556
./linearHashNTAMultiReader 10 5000
./linearHashNTAMultiReader 20 2500
./linearHashNTAMultiReader 30 1666.66666666667
./linearHashNTAMultiReader 40 1250
./linearHashNTAMultiReader 50 1000
./linearHashNTAMultiReader 60 833.333333333333
./linearHashNTAMultiReader 70 714.285714285714
./linearHashNTAMultiReader 80 625
./linearHashNTAMultiReader 90 555.555555555556
./linearHashNTAMultiReader 100 500
./linearHashNTAMultiReader 110 454.545454545455
./linearHashNTAMultiReader 120 416.666666666667
./linearHashNTAMultiReader 130 384.615384615385
./linearHashNTAMultiReader 140 357.142857142857
./linearHashNTAMultiReader 150 333.333333333333
./linearHashNTAMultiReader 160 312.5
./linearHashNTAMultiReader 170 294.117647058824
./linearHashNTAMultiReader 180 277.777777777778
./linearHashNTAMultiReader 190 263.157894736842
./linearHashNTAMultiReader 200 250
./linearHashNTAMultiReader 210 238.095238095238
./linearHashNTAMultiReader 220 227.272727272727
./linearHashNTAMultiReader 230 217.391304347826
./linearHashNTAMultiReader 240 208.333333333333
./linearHashNTAMultiReader 250 200

18
benchmarks/Makefile.am Normal file
View file

@ -0,0 +1,18 @@
LDADD=$(top_builddir)/src/stasis/libstasis.la
rose_SOURCES=rose.cpp
roseTable_SOURCES=roseTable.cpp
# logicalHash readLogicalHash logicalMultThreaded logicalMultiReaders
if BUILD_BENCHMARKS
noinst_PROGRAMS=lhtableThreaded naiveHash \
naiveMultiThreaded rawSet arrayListSet \
linearHashNTA linkedListNTA pageOrientedListNTA \
linearHashNTAThreaded linearHashNTAMultiReader linearHashNTAWriteRequests \
transitiveClosure zeroCopy sequentialThroughput rose roseTable qos writeBack \
distributedLsnFree
endif
AM_CFLAGS=${GLOBAL_CFLAGS}
AM_CXXFLAGS=${GLOBAL_CXXFLAGS} -I ${top_builddir}/src
SUBDIRS=berkeleyDB

View file

@ -0,0 +1,10 @@
README for red black tree memory benchmark
------------------------------------------
To run the benchmark, see redBlackMemoryOverhead.c and run_redBlackMemoryOverhead.pl.
To post-process the output into tab-delimited file suitable for further analysis:
grep -i results file*.out | tr -s ' ' '\t' > results.txt

View file

@ -0,0 +1,3 @@
Title: Bulk Load Time - Single Transaction
X-Label: Insertions
Y-Label: Seconds

View file

@ -0,0 +1,10 @@
25000 3.85466666666667
50000 7.72733333333333
75000 12.2743333333333
100000 15.39
125000 19.401
150000 24.592
175000 27.568
200000 30.9311666666667
225000 34.718
250000 39.0388333333333

View file

@ -0,0 +1,11 @@
1 0.05
25000 1.092
50000 2.24133333333333
75000 3.3285
100000 4.54566666666667
125000 5.92183333333333
150000 7.1325
175000 8.42116666666667
200000 9.70633333333333
225000 11.1855
250000 13.0535

View file

@ -0,0 +1,11 @@
1 0.0506666666666667
25000 2.9955
50000 6.08433333333333
75000 8.95916666666667
100000 11.8805
125000 14.9501666666667
150000 18.2698333333333
175000 21.8753333333333
200000 25.5806666666667
225000 29.5446666666667
250000 34.0788333333333

View file

@ -0,0 +1,3 @@
Title: Bulk Load Time - Single Transaction
X-Label: Insertions
Y-Label: Seconds

View file

@ -0,0 +1,342 @@
%PDF-1.1
%<25>â<EFBFBD>ã<EFBFBD>Ï<EFBFBD>Ó
1 0 obj
<<
/CreationDate (D:20050325040322)
/ModDate (D:20050325040322)
/Title (R Graphics Output)
/Producer (R 2.0.1)
/Creator (R)
>>
endobj
2 0 obj
<<
/Type /Catalog
/Pages 3 0 R
>>
endobj
5 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /ZapfDingbats
>>
endobj
6 0 obj
<<
/Type /Page
/Parent 3 0 R
/Contents 7 0 R
/Resources 4 0 R
>>
endobj
7 0 obj
<<
/Length 8 0 R
>>
stream
q
Q q 59.04 73.44 270.72 155.52 re W n
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
100.39 96.98 m 112.94 104.14 l S
125.18 111.71 m 138.28 120.47 l S
150.81 127.48 m 162.79 132.97 l S
175.53 139.63 m 188.20 147.10 l S
200.12 155.13 m 213.74 165.54 l S
226.06 172.80 m 237.94 178.00 l S
250.99 184.08 m 263.15 190.10 l S
275.89 196.80 m 288.38 203.76 l S
300.74 211.13 m 313.66 219.34 l S
BT
/F1 1 Tf 1 Tr 7.48 0 0 7.48 91.17 90.82 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 116.24 105.11 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 141.30 121.88 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 166.37 133.37 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 191.44 148.17 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 216.50 167.32 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 241.57 178.29 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 266.64 190.70 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 291.70 204.67 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 316.77 220.60 Tm (l) Tj 0 Tr
ET
Q q
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
69.07 73.44 m 319.73 73.44 l S
69.07 73.44 m 69.07 66.24 l S
119.20 73.44 m 119.20 66.24 l S
169.33 73.44 m 169.33 66.24 l S
219.47 73.44 m 219.47 66.24 l S
269.60 73.44 m 269.60 66.24 l S
319.73 73.44 m 319.73 66.24 l S
BT
0.000 0.000 0.000 rg
/F2 1 Tf 12.00 0.00 -0.00 12.00 65.73 47.52 Tm (0) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 102.52 47.52 Tm (50000) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 149.32 47.52 Tm (100000) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 199.45 47.52 Tm (150000) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 249.58 47.52 Tm (200000) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 299.72 47.52 Tm (250000) Tj
ET
59.04 79.20 m 59.04 226.75 l S
59.04 79.20 m 51.84 79.20 l S
59.04 116.09 m 51.84 116.09 l S
59.04 152.97 m 51.84 152.97 l S
59.04 189.86 m 51.84 189.86 l S
59.04 226.75 m 51.84 226.75 l S
BT
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 75.86 Tm (0) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 109.41 Tm (10) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 146.30 Tm (20) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 183.19 Tm (30) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 220.07 Tm (40) Tj
ET
59.04 73.44 m
329.76 73.44 l
329.76 228.96 l
59.04 228.96 l
59.04 73.44 l
S
Q q
BT
0.000 0.000 0.000 rg
/F3 1 Tf 14.00 0.00 -0.00 14.00 72.23 253.45 Tm (Bulk Load Time - Single Transaction) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 168.15 18.72 Tm (Insertions) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 12.96 127.85 Tm (Seconds) Tj
ET
Q q 59.04 73.44 270.72 155.52 re W n
1.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
76.18 80.48 m 87.02 82.14 l S
101.23 84.43 m 112.10 86.27 l S
126.31 88.60 m 137.16 90.34 l S
151.35 92.75 m 162.25 94.70 l S
176.39 97.40 m 187.34 99.61 l S
201.49 102.31 m 212.38 104.25 l S
226.54 106.85 m 237.46 108.92 l S
251.61 111.60 m 262.53 113.67 l S
276.64 116.53 m 287.63 118.93 l S
301.61 122.37 m 312.79 125.44 l S
69.07 83.58 m
72.70 77.29 l
65.43 77.29 l
69.07 83.58 l
S
94.13 87.43 m
97.77 81.13 l
90.50 81.13 l
94.13 87.43 l
S
119.20 91.67 m
122.84 85.37 l
115.56 85.37 l
119.20 91.67 l
S
144.27 95.68 m
147.90 89.38 l
140.63 89.38 l
144.27 95.68 l
S
169.33 100.17 m
172.97 93.87 l
165.70 93.87 l
169.33 100.17 l
S
194.40 105.24 m
198.04 98.94 l
190.76 98.94 l
194.40 105.24 l
S
219.47 109.71 m
223.10 103.41 l
215.83 103.41 l
219.47 109.71 l
S
244.53 114.46 m
248.17 108.16 l
240.90 108.16 l
244.53 114.46 l
S
269.60 119.20 m
273.24 112.90 l
265.96 112.90 l
269.60 119.20 l
S
294.67 124.66 m
298.30 118.36 l
291.03 118.36 l
294.67 124.66 l
S
319.73 131.55 m
323.37 125.25 l
316.10 125.25 l
319.73 131.55 l
S
0.000 0.804 0.000 RG
75.67 82.25 m 87.53 87.39 l S
100.69 93.23 m 112.65 98.66 l S
125.83 104.45 m 137.64 109.44 l S
150.88 115.09 m 162.72 120.18 l S
175.89 125.99 m 187.84 131.38 l S
200.87 137.51 m 213.00 143.43 l S
225.83 149.97 m 238.17 156.52 l S
250.85 163.34 m 263.28 170.11 l S
275.82 177.19 m 288.45 184.55 l S
300.66 192.18 m 313.74 200.91 l S
65.25 79.39 m 72.89 79.39 l S
69.07 75.57 m 69.07 83.21 l S
90.31 90.25 m 97.95 90.25 l S
94.13 86.43 m 94.13 94.07 l S
115.38 101.64 m 123.02 101.64 l S
119.20 97.82 m 119.20 105.46 l S
140.45 112.25 m 148.09 112.25 l S
144.27 108.43 m 144.27 116.07 l S
165.51 123.02 m 173.15 123.02 l S
169.33 119.20 m 169.33 126.84 l S
190.58 134.35 m 198.22 134.35 l S
194.40 130.53 m 194.40 138.16 l S
215.65 146.59 m 223.29 146.59 l S
219.47 142.77 m 219.47 150.41 l S
240.71 159.89 m 248.35 159.89 l S
244.53 156.07 m 244.53 163.71 l S
265.78 173.56 m 273.42 173.56 l S
269.60 169.74 m 269.60 177.38 l S
290.85 188.18 m 298.49 188.18 l S
294.67 184.36 m 294.67 192.00 l S
315.91 204.90 m 323.55 204.90 l S
319.73 201.09 m 319.73 208.72 l S
0.000 0.000 0.000 RG
BT
/F1 1 Tf 1 Tr 7.48 0 0 7.48 76.90 206.20 Tm (l) Tj 0 Tr
ET
1.000 0.000 0.000 RG
79.87 198.60 m
83.50 192.30 l
76.23 192.30 l
79.87 198.60 l
S
0.000 0.804 0.000 RG
76.05 180.00 m 83.69 180.00 l S
79.87 176.18 m 79.87 183.82 l S
BT
0.000 0.000 0.000 rg
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 204.49 Tm (BDB HASH) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 190.09 Tm (LLADD FAST HASH) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 175.69 Tm (LLADD NTA HASH) Tj
ET
Q
endstream
endobj
8 0 obj
5098
endobj
3 0 obj
<<
/Type /Pages
/Kids [
6 0 R
]
/Count 1
/MediaBox [0 0 360 288]
>>
endobj
4 0 obj
<<
/ProcSet [/PDF /Text]
/Font << /F1 5 0 R /F2 10 0 R /F3 11 0 R /F4 12 0 R /F5 13 0 R /F6 14 0 R >>
/ExtGState << >>
>>
endobj
9 0 obj
<<
/Type /Encoding
/BaseEncoding /PDFDocEncoding
/Differences [ 45/minus 96/quoteleft
144/dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space]
>>
endobj
10 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F2
/BaseFont /Helvetica
/Encoding 9 0 R
>>
endobj
11 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F3
/BaseFont /Helvetica-Bold
/Encoding 9 0 R
>>
endobj
12 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F4
/BaseFont /Helvetica-Oblique
/Encoding 9 0 R
>>
endobj
13 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F5
/BaseFont /Helvetica-BoldOblique
/Encoding 9 0 R
>>
endobj
14 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F6
/BaseFont /Symbol
>>
endobj
xref
0 15
0000000000 65535 f
0000000020 00000 n
0000000162 00000 n
0000005545 00000 n
0000005628 00000 n
0000000211 00000 n
0000000294 00000 n
0000000374 00000 n
0000005525 00000 n
0000005765 00000 n
0000006021 00000 n
0000006118 00000 n
0000006220 00000 n
0000006325 00000 n
0000006434 00000 n
trailer
<<
/Size 15
/Info 1 0 R
/Root 2 0 R
>>
startxref
6512
%%EOF

Binary file not shown.

View file

@ -0,0 +1,3 @@
Title: Bulk Load Time - Single Transaction
X-Label: Insertions
Y-Label: Seconds

View file

@ -0,0 +1,10 @@
200000 2.179
400000 4.20433333333333
600000 6.52183333333333
800000 8.6715
1000000 11.104
1200000 13.7615
1400000 16.6288333333333
1600000 19.9475
1800000 23.0105
2000000 26.2361666666667

View file

@ -0,0 +1,11 @@
1 0.0498333333333333
200000 2.03816666666667
400000 3.98633333333333
600000 5.9335
800000 7.90033333333333
1000000 9.84233333333333
1200000 11.842
1400000 13.8798333333333
1600000 15.7655
1800000 17.7885
2000000 19.8523333333333

View file

@ -0,0 +1,11 @@
1 0.05
200000 16.8826666666667
400000 50.3968333333333
600000 106.679833333333
800000 189.820666666667
1000000 294.200333333333
1200000 419.040833333333
1400000 564.996833333333
1600000 732.518
1800000 921.404
2000000 1129.82666666667

View file

@ -0,0 +1,11 @@
1 0.0496666666666667
200000 1.75233333333333
400000 3.43883333333333
600000 5.19616666666667
800000 6.8785
1000000 8.52466666666667
1200000 10.5406666666667
1400000 12.6645
1600000 14.6521666666667
1800000 16.7258333333333
2000000 18.7391666666667

View file

@ -0,0 +1,3 @@
Title: Bulk Load Time - Single Transaction
X-Label: Insertions
Y-Label: Seconds

View file

@ -0,0 +1,377 @@
%PDF-1.1
%<25>â<EFBFBD>ã<EFBFBD>Ï<EFBFBD>Ó
1 0 obj
<<
/CreationDate (D:20050325040322)
/ModDate (D:20050325040322)
/Title (R Graphics Output)
/Producer (R 2.0.1)
/Creator (R)
>>
endobj
2 0 obj
<<
/Type /Catalog
/Pages 3 0 R
>>
endobj
5 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /ZapfDingbats
>>
endobj
6 0 obj
<<
/Type /Page
/Parent 3 0 R
/Contents 7 0 R
/Resources 4 0 R
>>
endobj
7 0 obj
<<
/Length 8 0 R
>>
stream
q
Q q 59.04 73.44 270.72 155.52 re W n
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
101.33 79.55 m 112.00 79.66 l S
126.40 79.82 m 137.07 79.95 l S
151.47 80.11 m 162.13 80.23 l S
176.53 80.39 m 187.20 80.53 l S
201.60 80.71 m 212.27 80.86 l S
226.67 81.06 m 237.33 81.21 l S
251.73 81.44 m 262.40 81.62 l S
276.80 81.85 m 287.47 82.02 l S
301.87 82.25 m 312.53 82.43 l S
BT
/F1 1 Tf 1 Tr 7.48 0 0 7.48 91.17 76.88 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 116.24 77.14 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 141.30 77.44 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 166.37 77.71 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 191.44 78.02 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 216.50 78.36 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 241.57 78.72 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 266.64 79.15 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 291.70 79.54 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 316.77 79.95 Tm (l) Tj 0 Tr
ET
Q q
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
69.07 73.44 m 319.73 73.44 l S
69.07 73.44 m 69.07 66.24 l S
131.73 73.44 m 131.73 66.24 l S
194.40 73.44 m 194.40 66.24 l S
257.07 73.44 m 257.07 66.24 l S
319.73 73.44 m 319.73 66.24 l S
BT
0.000 0.000 0.000 rg
/F2 1 Tf 12.00 0.00 -0.00 12.00 65.73 47.52 Tm (0) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 111.72 47.52 Tm (500000) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 171.05 47.52 Tm (1000000) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 233.71 47.52 Tm (1500000) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 296.38 47.52 Tm (2000000) Tj
ET
59.04 79.20 m 59.04 206.65 l S
59.04 79.20 m 51.84 79.20 l S
59.04 104.69 m 51.84 104.69 l S
59.04 130.18 m 51.84 130.18 l S
59.04 155.67 m 51.84 155.67 l S
59.04 181.16 m 51.84 181.16 l S
59.04 206.65 m 51.84 206.65 l S
BT
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 75.86 Tm (0) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 94.68 Tm (200) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 145.66 Tm (600) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 193.31 Tm (1000) Tj
ET
59.04 73.44 m
329.76 73.44 l
329.76 228.96 l
59.04 228.96 l
59.04 73.44 l
S
Q q
BT
0.000 0.000 0.000 rg
/F3 1 Tf 14.00 0.00 -0.00 14.00 72.23 253.45 Tm (Bulk Load Time - Single Transaction) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 168.15 18.72 Tm (Insertions) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 12.96 127.85 Tm (Seconds) Tj
ET
Q q 59.04 73.44 270.72 155.52 re W n
1.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
76.27 79.28 m 86.93 79.39 l S
101.33 79.53 m 112.00 79.64 l S
126.40 79.78 m 137.07 79.88 l S
151.47 80.03 m 162.13 80.13 l S
176.53 80.28 m 187.20 80.38 l S
201.60 80.53 m 212.27 80.64 l S
226.67 80.78 m 237.33 80.89 l S
251.73 81.04 m 262.40 81.14 l S
276.80 81.28 m 287.47 81.39 l S
301.87 81.54 m 312.53 81.65 l S
69.07 83.41 m
72.70 77.11 l
65.43 77.11 l
69.07 83.41 l
S
94.13 83.66 m
97.77 77.36 l
90.50 77.36 l
94.13 83.66 l
S
119.20 83.91 m
122.84 77.61 l
115.56 77.61 l
119.20 83.91 l
S
144.27 84.16 m
147.90 77.86 l
140.63 77.86 l
144.27 84.16 l
S
169.33 84.41 m
172.97 78.11 l
165.70 78.11 l
169.33 84.41 l
S
194.40 84.65 m
198.04 78.36 l
190.76 78.36 l
194.40 84.65 l
S
219.47 84.91 m
223.10 78.61 l
215.83 78.61 l
219.47 84.91 l
S
244.53 85.17 m
248.17 78.87 l
240.90 78.87 l
244.53 85.17 l
S
269.60 85.41 m
273.24 79.11 l
265.96 79.11 l
269.60 85.41 l
S
294.67 85.67 m
298.30 79.37 l
291.03 79.37 l
294.67 85.67 l
S
319.73 85.93 m
323.37 79.63 l
316.10 79.63 l
319.73 85.93 l
S
0.000 0.804 0.000 RG
76.24 79.82 m 86.96 80.74 l S
101.23 82.56 m 112.10 84.41 l S
126.12 87.60 m 137.34 90.82 l S
150.90 95.60 m 162.70 100.59 l S
175.69 106.77 m 188.04 113.32 l S
200.48 120.56 m 213.39 128.75 l S
225.25 136.90 m 238.75 146.92 l S
250.01 155.88 m 264.12 167.89 l S
274.79 177.55 m 289.47 191.65 l S
299.61 201.87 m 314.79 217.96 l S
65.25 79.21 m 72.89 79.21 l S
69.07 75.39 m 69.07 83.02 l S
90.31 81.35 m 97.95 81.35 l S
94.13 77.53 m 94.13 85.17 l S
115.38 85.62 m 123.02 85.62 l S
119.20 81.80 m 119.20 89.44 l S
140.45 92.80 m 148.09 92.80 l S
144.27 88.98 m 144.27 96.62 l S
165.51 103.39 m 173.15 103.39 l S
169.33 99.57 m 169.33 107.21 l S
190.58 116.70 m 198.22 116.70 l S
194.40 112.88 m 194.40 120.52 l S
215.65 132.61 m 223.29 132.61 l S
219.47 128.79 m 219.47 136.43 l S
240.71 151.21 m 248.35 151.21 l S
244.53 147.39 m 244.53 155.03 l S
265.78 172.56 m 273.42 172.56 l S
269.60 168.74 m 269.60 176.38 l S
290.85 196.64 m 298.49 196.64 l S
294.67 192.82 m 294.67 200.45 l S
315.91 223.20 m 323.55 223.20 l S
319.73 219.38 m 319.73 227.02 l S
0.000 0.000 1.000 RG
76.27 79.27 m 86.93 79.36 l S
101.33 79.49 m 112.00 79.58 l S
126.40 79.70 m 137.07 79.80 l S
151.47 79.92 m 162.13 80.02 l S
176.53 80.14 m 187.20 80.23 l S
201.60 80.36 m 212.27 80.47 l S
226.67 80.62 m 237.33 80.74 l S
251.73 80.89 m 262.40 80.99 l S
276.80 81.14 m 287.47 81.26 l S
301.87 81.41 m 312.53 81.51 l S
66.37 76.51 m 71.77 81.91 l S
66.37 81.91 m 71.77 76.51 l S
91.43 76.72 m 96.83 82.12 l S
91.43 82.12 m 96.83 76.72 l S
116.50 76.94 m 121.90 82.34 l S
116.50 82.34 m 121.90 76.94 l S
141.57 77.16 m 146.97 82.56 l S
141.57 82.56 m 146.97 77.16 l S
166.63 77.38 m 172.03 82.78 l S
166.63 82.78 m 172.03 77.38 l S
191.70 77.59 m 197.10 82.99 l S
191.70 82.99 m 197.10 77.59 l S
216.77 77.84 m 222.17 83.24 l S
216.77 83.24 m 222.17 77.84 l S
241.83 78.11 m 247.23 83.51 l S
241.83 83.51 m 247.23 78.11 l S
266.90 78.37 m 272.30 83.77 l S
266.90 83.77 m 272.30 78.37 l S
291.97 78.63 m 297.37 84.03 l S
291.97 84.03 m 297.37 78.63 l S
317.03 78.89 m 322.43 84.29 l S
317.03 84.29 m 322.43 78.89 l S
0.000 0.000 0.000 RG
BT
/F1 1 Tf 1 Tr 7.48 0 0 7.48 76.90 206.20 Tm (l) Tj 0 Tr
ET
1.000 0.000 0.000 RG
79.87 198.60 m
83.50 192.30 l
76.23 192.30 l
79.87 198.60 l
S
0.000 0.804 0.000 RG
76.05 180.00 m 83.69 180.00 l S
79.87 176.18 m 79.87 183.82 l S
0.000 0.000 1.000 RG
77.17 162.90 m 82.57 168.30 l S
77.17 168.30 m 82.57 162.90 l S
BT
0.000 0.000 0.000 rg
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 204.49 Tm (BDB RAW) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 190.09 Tm (LLADD ARRAY LIST) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 175.69 Tm (LLADD LINKED LIST) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 161.29 Tm (LLADD RECORDID) Tj
ET
Q
endstream
endobj
8 0 obj
6109
endobj
3 0 obj
<<
/Type /Pages
/Kids [
6 0 R
]
/Count 1
/MediaBox [0 0 360 288]
>>
endobj
4 0 obj
<<
/ProcSet [/PDF /Text]
/Font << /F1 5 0 R /F2 10 0 R /F3 11 0 R /F4 12 0 R /F5 13 0 R /F6 14 0 R >>
/ExtGState << >>
>>
endobj
9 0 obj
<<
/Type /Encoding
/BaseEncoding /PDFDocEncoding
/Differences [ 45/minus 96/quoteleft
144/dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space]
>>
endobj
10 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F2
/BaseFont /Helvetica
/Encoding 9 0 R
>>
endobj
11 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F3
/BaseFont /Helvetica-Bold
/Encoding 9 0 R
>>
endobj
12 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F4
/BaseFont /Helvetica-Oblique
/Encoding 9 0 R
>>
endobj
13 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F5
/BaseFont /Helvetica-BoldOblique
/Encoding 9 0 R
>>
endobj
14 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F6
/BaseFont /Symbol
>>
endobj
xref
0 15
0000000000 65535 f
0000000020 00000 n
0000000162 00000 n
0000006556 00000 n
0000006639 00000 n
0000000211 00000 n
0000000294 00000 n
0000000374 00000 n
0000006536 00000 n
0000006776 00000 n
0000007032 00000 n
0000007129 00000 n
0000007231 00000 n
0000007336 00000 n
0000007445 00000 n
trailer
<<
/Size 15
/Info 1 0 R
/Root 2 0 R
>>
startxref
7523
%%EOF

View file

@ -0,0 +1,3 @@
Title: Concurrent Transactions Per Second
X-Label: Number of concurrent requests
Y-Label: TPS

View file

@ -0,0 +1,15 @@
1 140.977443609022
100 5885.81518540318
150 6326.44453816955
200 6120.57533408142
250 6761.45583803414
300 6962.71081541081
350 6785.57580457542
400 6905.28254114398
450 7541.89944134079
500 7562.00846944949
550 7384.86326813768
600 7287.74444309486
650 7344.63276836158
700 7188.08831079924
750 7270.72965811413

View file

@ -0,0 +1,3 @@
Title: Concurrent Transactions Per Second
X-Label: Number of concurrent requests
Y-Label: TPS

View file

@ -0,0 +1,234 @@
%PDF-1.1
%<25>â<EFBFBD>ã<EFBFBD>Ï<EFBFBD>Ó
1 0 obj
<<
/CreationDate (D:20050325040324)
/ModDate (D:20050325040324)
/Title (R Graphics Output)
/Producer (R 2.0.1)
/Creator (R)
>>
endobj
2 0 obj
<<
/Type /Catalog
/Pages 3 0 R
>>
endobj
5 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /ZapfDingbats
>>
endobj
6 0 obj
<<
/Type /Page
/Parent 3 0 R
/Contents 7 0 R
/Resources 4 0 R
>>
endobj
7 0 obj
<<
/Length 8 0 R
>>
stream
q
Q q 59.04 73.44 270.72 155.52 re W n
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
71.49 88.78 m 100.40 184.39 l S
108.92 194.51 m 112.77 196.44 l S
126.21 198.03 m 128.90 197.40 l S
141.73 200.00 m 146.81 203.71 l S
159.64 209.56 m 162.32 210.18 l S
176.39 210.36 m 178.99 209.84 l S
193.18 209.39 m 195.62 209.72 l S
208.58 214.92 m 213.64 218.59 l S
226.66 222.98 m 228.98 223.04 l S
243.24 221.78 m 245.83 221.25 l S
260.05 219.03 m 262.44 218.77 l S
276.78 218.44 m 279.13 218.59 l S
293.40 217.80 m 295.93 217.34 l S
310.19 216.75 m 312.57 216.98 l S
BT
/F1 1 Tf 1 Tr 7.48 0 0 7.48 66.44 79.29 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 99.53 188.69 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 116.24 197.08 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 132.95 193.16 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 149.66 205.36 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 166.37 209.19 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 183.08 205.82 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 199.79 208.10 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 216.50 220.22 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 233.22 220.60 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 249.93 217.23 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 266.64 215.38 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 283.35 216.47 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 300.06 213.48 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 316.77 215.06 Tm (l) Tj 0 Tr
ET
Q q
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
69.07 73.44 m 269.60 73.44 l S
69.07 73.44 m 69.07 66.24 l S
135.91 73.44 m 135.91 66.24 l S
202.76 73.44 m 202.76 66.24 l S
269.60 73.44 m 269.60 66.24 l S
BT
0.000 0.000 0.000 rg
/F2 1 Tf 12.00 0.00 -0.00 12.00 65.73 47.52 Tm (0) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 125.90 47.52 Tm (200) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 192.75 47.52 Tm (400) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 259.59 47.52 Tm (600) Tj
ET
59.04 79.20 m 59.04 193.46 l S
59.04 79.20 m 51.84 79.20 l S
59.04 117.29 m 51.84 117.29 l S
59.04 155.37 m 51.84 155.37 l S
59.04 193.46 m 51.84 193.46 l S
BT
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 75.86 Tm (0) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 103.94 Tm (2000) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 142.03 Tm (4000) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 180.11 Tm (6000) Tj
ET
59.04 73.44 m
329.76 73.44 l
329.76 228.96 l
59.04 228.96 l
59.04 73.44 l
S
Q q
BT
0.000 0.000 0.000 rg
/F3 1 Tf 14.00 0.00 -0.00 14.00 71.47 253.45 Tm (Concurrent Transactions Per Second) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 111.70 18.72 Tm (Number of concurrent requests) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 12.96 139.53 Tm (TPS) Tj
ET
Q q 59.04 73.44 270.72 155.52 re W n
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
BT
/F1 1 Tf 1 Tr 7.48 0 0 7.48 76.90 206.20 Tm (l) Tj 0 Tr
0.000 0.000 0.000 rg
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 204.49 Tm (LLADD HASH TPS) Tj
ET
Q
endstream
endobj
8 0 obj
2853
endobj
3 0 obj
<<
/Type /Pages
/Kids [
6 0 R
]
/Count 1
/MediaBox [0 0 360 288]
>>
endobj
4 0 obj
<<
/ProcSet [/PDF /Text]
/Font << /F1 5 0 R /F2 10 0 R /F3 11 0 R /F4 12 0 R /F5 13 0 R /F6 14 0 R >>
/ExtGState << >>
>>
endobj
9 0 obj
<<
/Type /Encoding
/BaseEncoding /PDFDocEncoding
/Differences [ 45/minus 96/quoteleft
144/dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space]
>>
endobj
10 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F2
/BaseFont /Helvetica
/Encoding 9 0 R
>>
endobj
11 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F3
/BaseFont /Helvetica-Bold
/Encoding 9 0 R
>>
endobj
12 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F4
/BaseFont /Helvetica-Oblique
/Encoding 9 0 R
>>
endobj
13 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F5
/BaseFont /Helvetica-BoldOblique
/Encoding 9 0 R
>>
endobj
14 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F6
/BaseFont /Symbol
>>
endobj
xref
0 15
0000000000 65535 f
0000000020 00000 n
0000000162 00000 n
0000003300 00000 n
0000003383 00000 n
0000000211 00000 n
0000000294 00000 n
0000000374 00000 n
0000003280 00000 n
0000003520 00000 n
0000003776 00000 n
0000003873 00000 n
0000003975 00000 n
0000004080 00000 n
0000004189 00000 n
trailer
<<
/Size 15
/Info 1 0 R
/Root 2 0 R
>>
startxref
4267
%%EOF

3
benchmarks/SOSP/TPS.def Normal file
View file

@ -0,0 +1,3 @@
Title: Concurrent Transactions Per Second
X-Label: Number of concurrent requests
Y-Label: TPS

View file

@ -0,0 +1,8 @@
1 155.376009944065
5 407.287735208667
10 633.486073864476
15 809.046942701497
20 952.668265032314
25 1067.4181290295
60 1679.19846260052
70 1846.72206832872

View file

@ -0,0 +1,11 @@
1 162.162162162162
5 720.980533525595
10 1394.18161539177
15 2136.14354884648
20 2465.60481286059
25 3051.63364120926
30 3566.22782252073
45 5728.34896253236
65 4829.9606172442
75 5385.4807439144
80 5766.73554711904

View file

@ -0,0 +1,3 @@
Title: Concurrent Transactions Per Second
X-Label: Number of concurrent requests
Y-Label: TPS

297
benchmarks/SOSP/TPS/TPS.pdf Normal file
View file

@ -0,0 +1,297 @@
%PDF-1.1
%<25>â<EFBFBD>ã<EFBFBD>Ï<EFBFBD>Ó
1 0 obj
<<
/CreationDate (D:20050325040323)
/ModDate (D:20050325040323)
/Title (R Graphics Output)
/Producer (R 2.0.1)
/Creator (R)
>>
endobj
2 0 obj
<<
/Type /Catalog
/Pages 3 0 R
>>
endobj
5 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /ZapfDingbats
>>
endobj
6 0 obj
<<
/Type /Page
/Parent 3 0 R
/Contents 7 0 R
/Resources 4 0 R
>>
endobj
7 0 obj
<<
/Length 8 0 R
>>
stream
q
Q q 59.04 73.44 270.72 155.52 re W n
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
91.51 91.81 m 93.63 92.58 l S
107.33 96.96 m 109.13 97.46 l S
123.09 101.01 m 124.71 101.38 l S
138.82 104.28 m 140.32 104.56 l S
154.53 106.85 m 249.94 120.14 l S
264.20 122.08 m 281.26 124.36 l S
BT
/F1 1 Tf 1 Tr 7.48 0 0 7.48 69.24 80.48 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 81.77 86.78 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 97.44 92.42 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 113.10 96.81 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 128.77 100.39 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 144.44 103.26 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 254.10 118.54 Tm (l) Tj 0 Tr
/F1 1 Tf 1 Tr 7.48 0 0 7.48 285.44 122.72 Tm (l) Tj 0 Tr
ET
Q q
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
69.07 73.44 m 319.73 73.44 l S
69.07 73.44 m 69.07 66.24 l S
131.73 73.44 m 131.73 66.24 l S
194.40 73.44 m 194.40 66.24 l S
257.07 73.44 m 257.07 66.24 l S
319.73 73.44 m 319.73 66.24 l S
BT
0.000 0.000 0.000 rg
/F2 1 Tf 12.00 0.00 -0.00 12.00 65.73 47.52 Tm (0) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 125.06 47.52 Tm (20) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 187.73 47.52 Tm (40) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 250.39 47.52 Tm (60) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 313.06 47.52 Tm (80) Tj
ET
59.04 79.20 m 59.04 204.05 l S
59.04 79.20 m 51.84 79.20 l S
59.04 104.17 m 51.84 104.17 l S
59.04 129.14 m 51.84 129.14 l S
59.04 154.11 m 51.84 154.11 l S
59.04 179.08 m 51.84 179.08 l S
59.04 204.05 m 51.84 204.05 l S
BT
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 75.86 Tm (0) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 115.80 Tm (2000) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 165.74 Tm (4000) Tj
ET
59.04 73.44 m
329.76 73.44 l
329.76 228.96 l
59.04 228.96 l
59.04 73.44 l
S
Q q
BT
0.000 0.000 0.000 rg
/F3 1 Tf 14.00 0.00 -0.00 14.00 71.47 253.45 Tm (Concurrent Transactions Per Second) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 111.70 18.72 Tm (Number of concurrent requests) Tj
/F2 1 Tf 0.00 12.00 -12.00 0.00 12.96 139.53 Tm (TPS) Tj
ET
Q q 59.04 73.44 270.72 155.52 re W n
1.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
77.01 88.61 m 79.92 91.85 l S
89.64 102.47 m 95.49 108.75 l S
105.05 119.51 m 111.42 127.04 l S
122.44 135.89 m 125.36 137.42 l S
137.00 145.68 m 142.14 150.49 l S
152.97 159.97 m 157.50 163.69 l S
167.79 173.68 m 205.34 216.81 l S
216.85 219.81 m 265.95 202.23 l S
279.32 202.72 m 297.48 210.77 l S
310.22 217.42 m 313.58 219.46 l S
72.20 87.45 m
75.84 81.15 l
68.56 81.15 l
72.20 87.45 l
S
84.73 101.40 m
88.37 95.10 l
81.10 95.10 l
84.73 101.40 l
S
100.40 118.21 m
104.04 111.91 l
96.76 111.91 l
100.40 118.21 l
S
116.07 136.74 m
119.70 130.44 l
112.43 130.44 l
116.07 136.74 l
S
131.73 144.97 m
135.37 138.67 l
128.10 138.67 l
131.73 144.97 l
S
147.40 159.60 m
151.04 153.30 l
143.76 153.30 l
147.40 159.60 l
S
163.07 172.45 m
166.70 166.15 l
159.43 166.15 l
163.07 172.45 l
S
210.07 226.44 m
213.70 220.14 l
206.43 220.14 l
210.07 226.44 l
S
272.73 204.01 m
276.37 197.71 l
269.10 197.71 l
272.73 204.01 l
S
304.07 217.88 m
307.70 211.58 l
300.43 211.58 l
304.07 217.88 l
S
319.73 227.40 m
323.37 221.10 l
316.10 221.10 l
319.73 227.40 l
S
0.000 0.000 0.000 RG
BT
/F1 1 Tf 1 Tr 7.48 0 0 7.48 76.90 206.20 Tm (l) Tj 0 Tr
ET
1.000 0.000 0.000 RG
79.87 198.60 m
83.50 192.30 l
76.23 192.30 l
79.87 198.60 l
S
BT
0.000 0.000 0.000 rg
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 204.49 Tm (BDB HASH TPS) Tj
/F2 1 Tf 12.00 0.00 -0.00 12.00 96.07 190.09 Tm (LLADD HASH TPS) Tj
ET
Q
endstream
endobj
8 0 obj
3486
endobj
3 0 obj
<<
/Type /Pages
/Kids [
6 0 R
]
/Count 1
/MediaBox [0 0 360 288]
>>
endobj
4 0 obj
<<
/ProcSet [/PDF /Text]
/Font << /F1 5 0 R /F2 10 0 R /F3 11 0 R /F4 12 0 R /F5 13 0 R /F6 14 0 R >>
/ExtGState << >>
>>
endobj
9 0 obj
<<
/Type /Encoding
/BaseEncoding /PDFDocEncoding
/Differences [ 45/minus 96/quoteleft
144/dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space]
>>
endobj
10 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F2
/BaseFont /Helvetica
/Encoding 9 0 R
>>
endobj
11 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F3
/BaseFont /Helvetica-Bold
/Encoding 9 0 R
>>
endobj
12 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F4
/BaseFont /Helvetica-Oblique
/Encoding 9 0 R
>>
endobj
13 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F5
/BaseFont /Helvetica-BoldOblique
/Encoding 9 0 R
>>
endobj
14 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F6
/BaseFont /Symbol
>>
endobj
xref
0 15
0000000000 65535 f
0000000020 00000 n
0000000162 00000 n
0000003933 00000 n
0000004016 00000 n
0000000211 00000 n
0000000294 00000 n
0000000374 00000 n
0000003913 00000 n
0000004153 00000 n
0000004409 00000 n
0000004506 00000 n
0000004608 00000 n
0000004713 00000 n
0000004822 00000 n
trailer
<<
/Size 15
/Info 1 0 R
/Root 2 0 R
>>
startxref
4900
%%EOF

Binary file not shown.

View file

@ -0,0 +1,54 @@
../transitiveClosure 0 0 1 3 0 -1 1
../transitiveClosure 1 0 1 3 0 -1 1
../transitiveClosure 0 0 1 6 0 -1 1
../transitiveClosure 1 0 1 6 0 -1 1
../transitiveClosure 0 0 1 9 0 -1 1
../transitiveClosure 1 0 1 9 0 -1 1
../transitiveClosure 0 0 0 3 100 -1 1
../transitiveClosure 1 0 0 3 100 -1 1
../transitiveClosure 0 0 0 6 100 -1 1
../transitiveClosure 1 0 0 6 100 -1 1
../transitiveClosure 0 0 0 9 100 -1 1
../transitiveClosure 1 0 0 9 100 -1 1
../transitiveClosure 0 0 0 3 90 -1 1
../transitiveClosure 1 0 0 3 90 -1 1
../transitiveClosure 0 0 0 6 90 -1 1
../transitiveClosure 1 0 0 6 90 -1 1
../transitiveClosure 0 0 0 9 90 -1 1
../transitiveClosure 1 0 0 9 90 -1 1
../transitiveClosure 0 0 0 3 10 -1 1
../transitiveClosure 1 0 0 3 10 -1 1
../transitiveClosure 0 0 0 6 10 -1 1
../transitiveClosure 1 0 0 6 10 -1 1
../transitiveClosure 0 0 0 9 10 -1 1
../transitiveClosure 1 0 0 9 10 -1 1
../transitiveClosure 0 0 0 3 1 -1 1
../transitiveClosure 1 0 0 3 1 -1 1
../transitiveClosure 0 0 0 6 1 -1 1
../transitiveClosure 1 0 0 6 1 -1 1
../transitiveClosure 0 0 0 9 1 -1 1
../transitiveClosure 1 0 0 9 1 -1 1
../transitiveClosure 0 0 0 3 40 -1 1
../transitiveClosure 1 0 0 3 40 -1 1
../transitiveClosure 0 0 0 6 40 -1 1
../transitiveClosure 1 0 0 6 40 -1 1
../transitiveClosure 0 0 0 9 40 -1 1
../transitiveClosure 1 0 0 9 40 -1 1
../transitiveClosure 0 0 0 3 60 -1 1
../transitiveClosure 1 0 0 3 60 -1 1
../transitiveClosure 0 0 0 6 60 -1 1
../transitiveClosure 1 0 0 6 60 -1 1
../transitiveClosure 0 0 0 9 60 -1 1
../transitiveClosure 1 0 0 9 60 -1 1
../transitiveClosure 0 0 0 3 20 -1 1
../transitiveClosure 1 0 0 3 20 -1 1
../transitiveClosure 0 0 0 6 20 -1 1
../transitiveClosure 1 0 0 6 20 -1 1
../transitiveClosure 0 0 0 9 20 -1 1
../transitiveClosure 1 0 0 9 20 -1 1
../transitiveClosure 0 0 0 3 80 -1 1
../transitiveClosure 1 0 0 3 80 -1 1
../transitiveClosure 0 0 0 6 80 -1 1
../transitiveClosure 1 0 0 6 80 -1 1
../transitiveClosure 0 0 0 9 80 -1 1
../transitiveClosure 1 0 0 9 80 -1 1

View file

@ -0,0 +1,267 @@
#!/usr/bin/perl -w
use strict;
my $num_threads = 50;
#
# Script to generate benchmarking scripts for the SOSP submission.
#
# This supports the following graphs:
#
# * Comparison with Berkeley DB:
#
# - Single-threaded raw throughput for LLADD's opeartions and
# Berkeley DB's storage methods.
#
# - Multithreaded hash-based transactions per second.
#
# - Multithreaded response time distributions
#
# * Object serialization benchmarks:
#
# - OASYS memory footprint (@todo: How to limit berkeley db's
# memory footprint?)
# o Three graphs (fixed memory pool size)
#
# 100% object changed / update
# 50%
# 10%
#
# o Three lines per Graph: LLADD diff, LLADD naive, Berkeley DB
#
# * Validation of flexibilty / ability to perform optimizations
#
# - Load burst absorption (LLADD w/ async vs LLADD w/out async)
#
# - Transitive closure (oo7 subset) (LLADD naive vs LLADD
# optimized: async + TsetRange())
#
# - CHT: Throughput vs number of replica groups: Disk Force vs
# Two sites in RAM.
#
#
## This perl script generates the input to timer.pl, which in turn
## generates the input to plotting.pl, which generates performance
## graphs. :)
## Single threaded raw-throughput graph:
open(LLADD_NTA_HASH, ">LLADD_NTA_HASH.script");
open(LLADD_FAST_HASH, ">LLADD_FAST_HASH.script");
open(LLADD_ARRAY_LIST, ">LLADD_ARRAY_LIST.script");
open(LLADD_LINKED_LIST, ">LLADD_LINKED_LIST.script");
open(LLADD_RECORDID, ">LLADD_RECORDID.script");
open(BDB_HASH, ">BDB_HASH.script");
open(BDB_RAW, ">BDB_RAW.script");
open(BULK_LOAD, ">BULK_LOAD.script");
open(BULK_LOAD_RAW, ">BULK_LOAD_RAW.script");
warn "cp ../berkeleyDB/bdbHashThreaded ../berkeleyDB/bdbRawThreaded";
#print BULK_LOAD "cp ../berkeleyDB/bdbHashThreaded ../berkeleyDB/bdbRawThreaded";
#print BULK_LOAD_RAW "cp ../berkeleyDB/bdbHashThreaded ../berkeleyDB/bdbRawThreaded";
for(my $i = 0; $i <= 2.5; $i +=0.25) {
my $insert_count = $i * 100000;
if($insert_count == 0) { $insert_count = 1; }
my $thread_count = 200;
my $threaded_insert_count = $insert_count / 200;
print LLADD_NTA_HASH "../linearHashNTAThreaded 1 $insert_count\n";
print LLADD_FAST_HASH "../logicalHash 1 $insert_count\n"; # could do ./naiveHash instead...
print BDB_HASH "../berkeleyDB/bdbHashThreaded 1 $insert_count 0 1\n";
print BULK_LOAD "../linearHashNTAThreaded 1 $insert_count\n";
print BULK_LOAD "../logicalHash 1 $insert_count\n"; # could do ./naiveHash instead...
print BULK_LOAD "../berkeleyDB/bdbHashThreaded 1 $insert_count 0 1\n";
}
for(my $i = 0; $i <= 10; $i++) {
my $insert_count = $i * 200000;
if($insert_count == 0) { $insert_count = 1; }
print LLADD_ARRAY_LIST "../arrayListSet 1 $insert_count\n";
print LLADD_LINKED_LIST "../pageOrientedListNTA 1 $insert_count\n"; # could do ./linkedList instead...
print LLADD_RECORDID "../rawSet 1 $insert_count\n";
print BDB_RAW "../berkeleyDB/bdbRawThreaded 1 $insert_count 0 0\n";
print BULK_LOAD_RAW "../arrayListSet 1 $insert_count\n";
if($i <= 1000000) {
print BULK_LOAD_RAW "../pageOrientedListNTA 1 $insert_count\n";
}
print BULK_LOAD_RAW "../linkedListNTA 1 $insert_count\n";
print BULK_LOAD_RAW "../rawSet 1 $insert_count\n";
print BULK_LOAD_RAW "../berkeleyDB/bdbHashThreaded 1 $insert_count 0 0\n";
}
close(LLADD_NTA_HASH);
close(LLADD_FAST_HASH);
close(LLADD_ARRAY_LIST);
close(LLADD_LINKED_LIST);
close(LLADD_RECORDID);
close(BDB_HASH);
close(BDB_RAW);
close(BULK_LOAD);
close(BULK_LOAD_RAW);
## Throughput vs. number of transactions
open(LLADD_HASH_TPS, ">LLADD_HASH_TPS.script");
open(BDB_HASH_TPS, ">BDB_HASH_TPS.script");
open(LLADD_RECNO_TPS, ">LLADD_RECNO_TPS.script");
open(BDB_RECNO_TPS, ">BDB_RECNO_TPS.script");
open(TPS, ">TPS.script");
for(my $i = 0; $i <= 80; $i +=5 ) {
my $insert_threads = $i ;
if($insert_threads == 0) {
$insert_threads = 1;
}
my $insert_per_thread = 500; # / $insert_threads;
# print LLADD_HASH_TPS "../linearHashNTAThreaded $insert_threads $insert_per_thread 1\n";
print BDB_HASH_TPS "../berkeleyDB/bdbHashThreaded $insert_threads $insert_per_thread 1 1\n";
print TPS "../linearHashNTAThreaded $insert_threads $insert_per_thread 1\n";
print TPS "../berkeleyDB/bdbHashThreaded $insert_threads $insert_per_thread 1 1\n";
}
for(my $i = 0; $i <= 800; $i += 50 ) {
my $insert_threads = $i;
if($insert_threads == 0) {
$insert_threads = 1;
}
my $insert_per_thread = 50; # / $insert_threads;
print LLADD_HASH_TPS "../linearHashNTAThreaded $insert_threads $insert_per_thread 1\n";
# print BDB_HASH_TPS "../berkeleyDB/bdbHashThreaded $insert_threads $insert_per_thread 1 1\n";
# print TPS "../linearHashNTAThreaded $insert_threads $insert_per_thread 1\n";
# print TPS "../berkeleyDB/bdbHashThreaded $insert_threads $insert_per_thread 1 1\n";
}
close(TPS);
## Response time degradation
open(LLADD_SEDA, ">LLADD_SEDA.script");
open(BDB_SEDA, ">BDB_SEDA.script");
open(SEDA, ">SEDA.script");
for(my $i = 1; $i <= 20; $i ++) {
# my $insert_count = $i * 100000;
my $num_threads = $i * 20;
my $tps_per_thread = 10;
print LLADD_SEDA "../linearHashNTAWriteRequests $num_threads $tps_per_thread 1\n";
print BDB_SEDA "../berkeleyDB/bdbHashWriteRequests $num_threads $tps_per_thread 1\n";
print SEDA "../linearHashNTAWriteRequests $num_threads $tps_per_thread 1\n";
print SEDA "../berkeleyDB/bdbHashWriteRequests $num_threads $tps_per_thread 1\n";
}
close LLADD_SEDA;
close BDB_SEDA;
close SEDA;
exit;
## ---------------- OASYS STUFF ---------------------------
# blah blah blah
## ---------------- ASYNC STUFF --------------------------
# load bursts
# trans closure
## ---------------- CHT STUFF -----------------------------
#cht vs # hosts.
#open(LLADD_THREADED, ">LLADD_THREADED.script" );
#open(LLADD_LOGICAL, ">LLADD_LOGICAL.script" );
#open(LLADD_PHYSICAL, ">LLADD_PHYSICAL.script" );
#open(LLADD_RAW_PHYSICAL, ">LLADD_RAW_PHYSICAL.script");
#open(BDB_RAW_INSERT, ">BDB_RAW_INSERT.script" );
#open(BDB_HASH_INSERT, ">BDB_HASH_INSERT.script" );
# New tests
#open(LLADD_NTA, ">LLADD_NTA.script");
#open(LLADD_LINKED_LIST, ">LLADD_LINKED_LIST.script");
#open(LLADD_PAGED_LIST, ">LLADD_PAGED_LIST.script");
#open(BDB_HASH_THREADED, ">BDB_HASH_THREADED.script");
#open(EVERYTHING, ">EVERYTHING.script" );
for(my $i = 1; $i <= 10; $i += .5) {
my $insert_count = $i * 100000;
my $threaded_insert_count = $insert_count / $num_threads;
print LLADD_THREADED "./linearHashNTAThreaded $num_threads $threaded_insert_count\n";
print LLADD_LOGICAL "./logicalHash 1 $insert_count\n";
print LLADD_PHYSICAL "./naiveHash 1 $insert_count\n";
print LLADD_RAW_PHYSICAL "./arrayListSet 1 $insert_count\n";
print BDB_RAW_INSERT "./berkeleyDB/bdbRaw 1 $insert_count\n";
print BDB_HASH_INSERT "./berkeleyDB/bdbHash 1 $insert_count\n";
print LLADD_NTA "./linearHashNTA 1 $insert_count\n";
print LLADD_LINKED_LIST "./linkedListNTA 1 $insert_count\n";
print LLADD_PAGED_LIST "./pageOrientedListNTA 1 $insert_count\n";
print BDB_HASH_THREADED "./berkeleyDB/bdbHashThreaded $num_threads $threaded_insert_count\n";
print EVERYTHING "./linearHashNTAThreaded $num_threads $threaded_insert_count\n";
print EVERYTHING "./logicalHash 1 $insert_count\n";
print EVERYTHING "./naiveHash 1 $insert_count\n";
print EVERYTHING "./arrayListSet 1 $insert_count\n";
print EVERYTHING "./berkeleyDB/bdbRaw 1 $insert_count\n";
print EVERYTHING "./linearHashNTA 1 $insert_count\n";
print EVERYTHING "./linkedListNTA 1 $insert_count\n";
print EVERYTHING "./pageOrientedListNTA 1 $insert_count\n";
if($i < 4) {
print EVERYTHING "./berkeleyDB/bdbHashThreaded $num_threads $threaded_insert_count\n";
print EVERYTHING "./berkeleyDB/bdbHash 1 $insert_count\n";
}
}
close(LLADD_THREADED);
close(LLADD_LOGICAL);
close(LLADD_PHYSICAL);
close(LLADD_RAW_PHYSICAL);
close(BDB_RAW_INSERT);
close(BDB_HASH_INSERT);
close(EVERYTHING);
close(LLADD_NTA);
close(LLADD_LINKED_LIST);
close(LLADD_PAGED_LIST);
close(BDB_HASH_THREADED);

57
benchmarks/SOSP/parseOutput.pl Executable file
View file

@ -0,0 +1,57 @@
#! /usr/bin/perl -w
use strict;
sub jfdi {
my $bn_ref = shift;
my $exe_ref = shift;
my $complete_output = shift;
my $eval_x = shift;
my $eval_y = shift;
# if(-e $complete_output) {
# warn "$complete_output exists--skipping\n";
# return;
# }
my @baseNames = @{$bn_ref};
my @exeNames = @{$exe_ref};
my $exec = "mkdir $complete_output\n";
print $exec;
`$exec`;
$exec = "ln -s ../$complete_output.def $complete_output/\n";
print $exec;
`$exec`;
for(my $i =0 ; $i < @baseNames; $i++) {
$exec = "grep CI $complete_output.out | grep $exeNames[$i] | ci-parser.pl --force '$eval_x' '$eval_y' > $complete_output/$complete_output-$baseNames[$i].dat\n";
print $exec;
`$exec`;
}
`cd $complete_output ; plotting.pl $complete_output | R --no-save ; cd ..`
}
# parse the output generated by timer.pl when is it run using generateScripts.pl's output
my @baseNames = qw(LLADD_NTA_HASH LLADD_FAST_HASH BDB_HASH );
my @exeNames = qw(linearHashNTAThreaded logicalHash bdbHashThreaded);
my $complete_output = "BULK_LOAD";
jfdi(\@baseNames, \@exeNames, $complete_output, '$arg[1]', '$time');
@baseNames = qw(LLADD_ARRAY_LIST LLADD_LINKED_LIST LLADD_RECORDID BDB_RAW);
@exeNames = qw(arrayListSet pageOrientedList rawSet bdbHashThreaded);
$complete_output = "BULK_LOAD_RAW";
jfdi(\@baseNames, \@exeNames, $complete_output, '$arg[1]', '$time');
@baseNames = qw(LLADD_HASH_TPS BDB_HASH_TPS);
@exeNames = qw(linearHashNTAThreaded bdbHashThreaded);
$complete_output = "TPS";
jfdi(\@baseNames, \@exeNames, $complete_output, '$arg[0]', '($arg[0]*$arg[1])/$time');
@baseNames = qw(LLADD_HASH_TPS);
@exeNames = qw(linearHashNTAThreaded);
$complete_output = "LLADD_HASH_TPS";
jfdi(\@baseNames, \@exeNames, $complete_output, '$arg[0]', '($arg[0]*$arg[1])/$time');

6
benchmarks/SOSP/runit.sh Executable file
View file

@ -0,0 +1,6 @@
cat BULK_LOAD.script | timer.pl > BULK_LOAD.out
cat BULK_LOAD_RAW.script | timer.pl > BULK_LOAD_RAW.out
cat LLADD_HASH_TPS.script| timer.pl > LLADD_HASH_TPS.out
cat TPS.script | timer.pl > TPS.out
cat SEDA.script | timer.pl > SEDA.out

44
benchmarks/arrayListSet.c Normal file
View file

@ -0,0 +1,44 @@
#include <stasis/transactional.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char** argv) {
assert(argc == 3);
int xact_count = atoi(argv[1]);
int count = atoi(argv[2]);
/* unlink("storefile.txt");
unlink("logfile.txt");
unlink("blob0_file.txt");
unlink("blob1_file.txt");*/
Tinit();
int xid = Tbegin();
Tcommit(xid);
recordid arrayList = TarrayListAlloc(xid, 512, 2, sizeof(int));
recordid rid = arrayList;
rid.slot = 0;
int i = 0;
int k;
for(k = 0; k < xact_count; k++) {
xid = Tbegin();
for(; i < (count*(k+1)) ; i++) {
TarrayListExtend(xid, arrayList, 1);
Tset(xid, rid, &i);
rid.slot++;
}
Tcommit(xid);
}
Tdeinit();
}

View file

@ -0,0 +1,9 @@
.deps
Makefile
Makefile.in
.libs
bdbHash
bdbHashThreaded
bdbHashWriteRequests
bdbRaw
transapp

View file

@ -0,0 +1,6 @@
if BUILD_BENCHMARKS
if DB_ENABLED
LDADD=@DB_LIBS@
noinst_PROGRAMS=transapp bdbRaw bdbHash bdbHashThreaded bdbHashWriteRequests
endif
endif

View file

@ -0,0 +1,595 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <db.h>
#define ENV_DIRECTORY "TXNAPP"
void add_cat(DB_ENV *, DB *, char *, ...);
void run_xact(DB_ENV *, DB *, int, int);
/*void add_color(DB_ENV *, DB *, char *, int);
void add_fruit(DB_ENV *, DB *, char *, char *); */
void *checkpoint_thread(void *);
void log_archlist(DB_ENV *);
void *logfile_thread(void *);
void db_open(DB_ENV *, DB **, char *, int);
void env_dir_create(void);
void env_open(DB_ENV **);
void usage(void);
int
main(int argc, char *argv[])
{
extern int optind;
DB *db_cats; /*, *db_color, *db_fruit; */
DB_ENV *dbenv;
pthread_t ptid;
int ch, ret;
/* while ((ch = getopt(argc, argv, "")) != EOF)
switch (ch) {
case '?':
default:
usage();
}
argc -= optind;
argv += optind; */
assert(argc == 3);
env_dir_create();
env_open(&dbenv);
/* Start a checkpoint thread. */
if ((ret = pthread_create(
&ptid, NULL, checkpoint_thread, (void *)dbenv)) != 0) {
fprintf(stderr,
"txnapp: failed spawning checkpoint thread: %s\n",
strerror(ret));
exit (1);
}
/* Start a logfile removal thread. */
if ((ret = pthread_create(
&ptid, NULL, logfile_thread, (void *)dbenv)) != 0) {
fprintf(stderr,
"txnapp: failed spawning log file removal thread: %s\n",
strerror(ret));
exit (1);
}
/* Open database: Key is fruit class; Data is specific type. */
/* db_open(dbenv, &db_fruit, "fruit", 0); */
/* Open database: Key is a color; Data is an integer. */
/*db_open(dbenv, &db_color, "color", 0); */
/*
* Open database:
* Key is a name; Data is: company name, address, cat breeds.
*/
db_open(dbenv, &db_cats, "cats", 1);
/* add_fruit(dbenv, db_fruit, "apple", "yellow delicious");
add_color(dbenv, db_color, "blue", 0);
add_color(dbenv, db_color, "blue", 3); */
/* add_cat(dbenv, db_cats,
"Amy Adams",
"Sleepycat Software",
"394 E. Riding Dr., Carlisle, MA 01741, USA",
"abyssinian",
"bengal",
"chartreaux",
NULL);*/
int r;
int num_xact = atoi(argv[1]); //100;
int insert_per_xact = atoi(argv[2]); //1000;
for(r = 0; r < num_xact; r ++) {
run_xact(dbenv, db_cats, 1+r*insert_per_xact, insert_per_xact);
}
return (0);
}
void
env_dir_create(void)
{
struct stat sb;
/*
* If the directory exists, we're done. We do not further check
* the type of the file, DB will fail appropriately if it's the
* wrong type.
*/
if (stat(ENV_DIRECTORY, &sb) == 0)
return;
/* Create the directory, read/write/access owner only. */
if (mkdir(ENV_DIRECTORY, S_IRWXU) != 0) {
fprintf(stderr,
"txnapp: mkdir: %s: %s\n", ENV_DIRECTORY, strerror(errno));
exit (1);
}
}
void
env_open(DB_ENV **dbenvp)
{
DB_ENV *dbenv;
int ret;
/* Create the environment handle. */
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"txnapp: db_env_create: %s\n", db_strerror(ret));
exit (1);
}
/* Set up error handling. */
dbenv->set_errpfx(dbenv, "txnapp");
dbenv->set_errfile(dbenv, stderr);
/* Do deadlock detection internally. */
if ((ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) {
dbenv->err(dbenv, ret, "set_lk_detect: DB_LOCK_DEFAULT");
exit (1);
}
/*
* Open a transactional environment:
* create if it doesn't exist
* free-threaded handle
* run recovery
* read/write owner only
*/
if ((ret = dbenv->open(dbenv, ENV_DIRECTORY,
DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG |
DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER | DB_THREAD,
S_IRUSR | S_IWUSR)) != 0) {
dbenv->err(dbenv, ret, "dbenv->open: %s", ENV_DIRECTORY);
exit (1);
}
*dbenvp = dbenv;
}
void *
checkpoint_thread(void *arg)
{
DB_ENV *dbenv;
int ret;
dbenv = arg;
dbenv->errx(dbenv, "Checkpoint thread: %lu", (u_long)pthread_self());
/* Checkpoint once a minute. */
for (;; sleep(60))
if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0)) != 0) {
dbenv->err(dbenv, ret, "checkpoint thread");
exit (1);
}
/* NOTREACHED */
}
void *
logfile_thread(void *arg)
{
DB_ENV *dbenv;
int ret;
char **begin, **list;
dbenv = arg;
dbenv->errx(dbenv,
"Log file removal thread: %lu", (u_long)pthread_self());
/* Check once every 5 minutes. */
for (;; sleep(300)) {
/* Get the list of log files. */
if ((ret =
dbenv->log_archive(dbenv, &list, DB_ARCH_ABS)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive");
exit (1);
}
/* Remove the log files. */
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
if ((ret = remove(*list)) != 0) {
dbenv->err(dbenv,
ret, "remove %s", *list);
exit (1);
}
free (begin);
}
}
/* NOTREACHED */
}
void
log_archlist(DB_ENV *dbenv)
{
int ret;
char **begin, **list;
/* Get the list of database files. */
if ((ret = dbenv->log_archive(dbenv,
&list, DB_ARCH_ABS | DB_ARCH_DATA)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive: DB_ARCH_DATA");
exit (1);
}
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
printf("database file: %s\n", *list);
free (begin);
}
/* Get the list of log files. */
if ((ret = dbenv->log_archive(dbenv,
&list, DB_ARCH_ABS | DB_ARCH_LOG)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive: DB_ARCH_LOG");
exit (1);
}
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
printf("log file: %s\n", *list);
free (begin);
}
}
void
db_open(DB_ENV *dbenv, DB **dbp, char *name, int dups)
{
DB *db;
int ret;
/* Create the database handle. */
if ((ret = db_create(&db, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_create");
exit (1);
}
/* Optionally, turn on duplicate data items. */
/* if (dups && (ret = db->set_flags(db, DB_DUP)) != 0) {
dbenv->err(dbenv, ret, "db->set_flags: DB_DUP");
exit (1);
} */
/*
* Open a database in the environment:
* create if it doesn't exist
* free-threaded handle
* read/write owner only
*/
if ((ret = db->open(db, NULL, name, NULL, /*DB_BTREE*//* DB_RECNO */DB_HASH,
DB_AUTO_COMMIT | DB_CREATE | DB_THREAD, S_IRUSR | S_IWUSR)) != 0) {
(void)db->close(db, 0);
dbenv->err(dbenv, ret, "db->open: %s", name);
exit (1);
}
*dbp = db;
}
void
add_fruit(DB_ENV *dbenv, DB *db, char *fruit, char *name)
{
DBT key, data;
DB_TXN *tid;
int ret;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = fruit;
key.size = strlen(fruit);
data.data = name;
data.size = strlen(name);
for (;;) {
/* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Store the value. */
switch (ret = db->put(db, tid, &key, &data, 0)) {
case 0:
/* Success: commit the change. */
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
return;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
break;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %s/%s", fruit, name);
exit (1);
}
}
}
void
add_color(DB_ENV *dbenv, DB *dbp, char *color, int increment)
{
DBT key, data;
DB_TXN *tid;
int original, ret;
char buf[64];
/* Initialization. */
memset(&key, 0, sizeof(key));
key.data = color;
key.size = strlen(color);
memset(&data, 0, sizeof(data));
data.flags = DB_DBT_MALLOC;
for (;;) {
/* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/*
* Get the key. If it exists, we increment the value. If it
* doesn't exist, we create it.
*/
switch (ret = dbp->get(dbp, tid, &key, &data, 0)) {
case 0:
original = atoi(data.data);
break;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
continue;
case DB_NOTFOUND:
original = 0;
break;
default:
/* Error: run recovery. */
dbenv->err(
dbenv, ret, "dbc->get: %s/%d", color, increment);
exit (1);
}
if (data.data != NULL)
free(data.data);
/* Create the new data item. */
(void)snprintf(buf, sizeof(buf), "%d", original + increment);
data.data = buf;
data.size = strlen(buf) + 1;
/* Store the new value. */
switch (ret = dbp->put(dbp, tid, &key, &data, 0)) {
case 0:
/* Success: commit the change. */
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
return;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
break;
default:
/* Error: run recovery. */
dbenv->err(
dbenv, ret, "dbc->put: %s/%d", color, increment);
exit (1);
}
}
}
void
add_cat(DB_ENV *dbenv, DB *db, char *name, ...)
{
va_list ap;
DBC *dbc;
DBT key, data;
DB_TXN *tid;
int ret;
char *s;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = name;
key.size = strlen(name);
retry: /* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Delete any previously existing item. */
switch (ret = db->del(db, tid, &key, 0)) {
case 0:
case DB_NOTFOUND:
break;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
dbenv->err(dbenv, ret, "db->del: %s", name);
exit (1);
}
/* Create a cursor. */
if ((ret = db->cursor(db, tid, &dbc, 0)) != 0) {
dbenv->err(dbenv, ret, "db->cursor");
exit (1);
}
/* Append the items, in order. */
va_start(ap, name);
while ((s = va_arg(ap, char *)) != NULL) {
data.data = s;
data.size = strlen(s);
switch (ret = dbc->c_put(dbc, &key, &data, DB_KEYLAST)) {
case 0:
break;
case DB_LOCK_DEADLOCK:
va_end(ap);
/* Deadlock: retry the operation. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(
dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %s/%s", name, s);
exit (1);
}
}
va_end(ap);
/* Success: commit the change. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
}
void
run_xact(DB_ENV *dbenv, DB *db, int offset, int count)
{
va_list ap;
DBC *dbc;
DBT key, data;
DB_TXN *tid;
int ret;
char *s;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
int keyPtr;
int valPtr;
key.data = &keyPtr;
key.size = sizeof(int);/*strlen(name);*/
data.data = &valPtr;
data.size = sizeof(int);
retry: /* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Delete any previously existing item. */
/* switch (ret = db->del(db, tid, &key, 0)) {
case 0:
case DB_NOTFOUND:
break;
case DB_LOCK_DEADLOCK:
/ * Deadlock: retry the operation. * /
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
dbenv->err(dbenv, ret, "db->del: %s", name);
exit (1);
} */
/* Create a cursor. */
if ((ret = db->cursor(db, tid, &dbc, 0)) != 0) {
dbenv->err(dbenv, ret, "db->cursor");
exit (1);
}
/* Append the items, in order. */
// va_start(ap, name);
// while ((s = va_arg(ap, char *)) != NULL) {
int q;
for(q = offset; q < offset + count; q++) {
keyPtr = q;
valPtr = q;
/* data.data = s;
data.size = strlen(s); */
// printf("A"); fflush(NULL);
switch (ret = dbc->c_put(dbc, &key, &data, DB_KEYLAST)) {
case 0:
// printf("B"); fflush(NULL);
break;
case DB_LOCK_DEADLOCK:
va_end(ap);
/* Deadlock: retry the operation. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(
dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %d/%d", q, q);
exit (1);
}
}
va_end(ap);
/* Success: commit the change. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
}
void
usage(void)
{
(void)fprintf(stderr, "usage: txnapp\n");
exit(1);
}

View file

@ -0,0 +1,138 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <pthread.h>
// if we're using linux's crazy version of the pthread header,
// it probably forgot to include PTHREAD_STACK_MIN
#ifndef PTHREAD_STACK_MIN
#include <limits.h>
#endif
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <db.h>
#define ENV_DIRECTORY "TXNAPP"
//#define DEBUG_BDB 1
#include "genericBerkeleyDBCode.c"
int activeThreads = 0;
int max_active = 0;
pthread_mutex_t mutex;
//int alwaysCommit;
int num_xact;
int insert_per_xact;
void * runThread(void * arg);
int
main(int argc, char *argv[])
{
extern int optind;
int ch, ret;
// assert(argc == 3 || argc == 4);
assert(argc == 5);
int alwaysCommit = atoi(argv[3]); // 1; // (argc >= 4);
int type = atoi(argv[4]) == 1 ? DB_HASH : DB_RECNO;
printf("type: %d always commit: %d\n", type, alwaysCommit);
/* threads have static thread sizes. Ughh. */
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setstacksize (&attr, 4 * PTHREAD_STACK_MIN);
pthread_mutex_init(&mutex, NULL);
pthread_mutex_lock(&mutex);
initDB(&attr, type);
int r;
int num_threads = atoi(argv[1]);
if(alwaysCommit) {
num_xact = atoi(argv[2]);
insert_per_xact = 1;
} else {
num_xact = 1;
insert_per_xact = atoi(argv[2]);
}
// @todo the test has been crashing for multi-threaded long transactions.
assert(num_threads == 1 || alwaysCommit == 1);
#ifdef DEBUG_BDB
printf("num_xact = %d\n insert_per_xact=%d\n", num_xact, insert_per_xact);
#endif
pthread_t * threads = malloc(num_threads * sizeof(pthread_t));
long i ;
for(i = 0; i < num_threads; i++) {
if ((ret = pthread_create(&(threads[i]), &attr, runThread, (void *)i)) != 0){
fprintf(stderr,
"txnapp: failed spawning worker thread: %s\n",
strerror(ret));
exit (1);
}
}
pthread_mutex_unlock(&mutex);
for(i = 0; i < num_threads; i++) {
pthread_join(threads[i], NULL);
}
free(threads);
db->close(db, 0);
dbenv->close(dbenv, 0);
printf("committed %d times, put %d times\n", commitCount, putCount);
return (0);
}
void * runThread(void * arg) {
long offset = (long) arg;
pthread_mutex_lock(&mutex);
activeThreads++;
if(activeThreads > max_active) {
max_active = activeThreads;
}
pthread_mutex_unlock(&mutex);
int r;
for(r = 0; r < num_xact; r ++) {
// run_xact(dbenv, db_cats, offset*(1+r)*insert_per_xact, insert_per_xact);
run_xact(dbenv, db_cats, (offset * num_xact * insert_per_xact) + (r * insert_per_xact), insert_per_xact);
}
pthread_mutex_lock(&mutex);
activeThreads--;
pthread_mutex_unlock(&mutex);
}

View file

@ -0,0 +1,210 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <pthread.h>
#include <math.h>
// if we're using linux's crazy version of the pthread header,
// it probably forgot to include PTHREAD_STACK_MIN
#ifndef PTHREAD_STACK_MIN
#include <limits.h>
#endif
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <db.h>
#include "genericBerkeleyDBCode.c"
#define MAX_SECONDS 100
#define COUNTER_RESOLUTION 240
int buckets[COUNTER_RESOLUTION];
int activeThreads = 0;
int max_active = 0;
pthread_cond_t never;
pthread_mutex_t mutex;
void addTimespec(struct timespec * ts, long nsec) {
ts->tv_nsec += nsec;
// 0123456789
if(ts->tv_nsec > 1000000000) {
ts->tv_nsec -= 1000000000;
ts->tv_sec ++;
}
}
double thread_requests_per_sec = 10.0;
int alwaysCommit;
int num_xact;
int insert_per_xact;
void * runThread(void * arg);
int
main(int argc, char *argv[])
{
extern int optind;
int ch, ret;
assert(argc == 3 || argc == 4);
alwaysCommit = (argc == 4);
/* threads have static thread sizes. Ughh. */
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setstacksize (&attr, 4 * PTHREAD_STACK_MIN);
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&never, NULL);
pthread_mutex_lock(&mutex);
initDB(&attr, DB_HASH);
int l;
for(l = 0; l < COUNTER_RESOLUTION; l++) {
buckets[l] = 0;
}
int r;
int num_threads = atoi(argv[1]);
thread_requests_per_sec = (double) atoi(argv[2]);
printf("%d %f\n", num_threads, thread_requests_per_sec);
if(alwaysCommit) {
num_xact = 10.0 * thread_requests_per_sec;//atoi(argv[2]);
insert_per_xact = 1;
} else {
abort();
num_xact = 1;
insert_per_xact = atoi(argv[2]);
}
pthread_t * threads = malloc(num_threads * sizeof(pthread_t));
long i;
for(i = 0; i < num_threads; i++) {
if ((ret = pthread_create(&(threads[i]), &attr, runThread, (void *)i)) != 0){
fprintf(stderr,
"txnapp: failed spawning worker thread: %s\n",
strerror(ret));
exit (1);
}
}
pthread_mutex_unlock(&mutex);
for(i = 0; i < num_threads; i++) {
pthread_join(threads[i], NULL);
}
free(threads);
int k;
double log_multiplier = (COUNTER_RESOLUTION / log(MAX_SECONDS * 1000000000.0));
int total = 0;
for(k = 0; k < COUNTER_RESOLUTION; k++) {
printf("%3.4f\t%d\n", exp(((double)k)/log_multiplier)/1000000000.0, buckets[k]);
total += buckets[k];
}
printf("Total requests: %d\n", total);
db->close(db, 0);
dbenv->close(dbenv, 0);
return (0);
}
void * runThread(void * arg) {
long offset = (long)arg;
pthread_mutex_lock(&mutex);
activeThreads++;
if(activeThreads > max_active) {
max_active = activeThreads;
}
pthread_mutex_unlock(&mutex);
int r;
// double sum_x_squared = 0;
// double sum = 0;
double log_multiplier = COUNTER_RESOLUTION / log(MAX_SECONDS * 1000000000.0);
struct timeval timeout_tv;
struct timespec timeout;
gettimeofday(&timeout_tv, NULL);
timeout.tv_sec = timeout_tv.tv_sec;
timeout.tv_nsec = 1000 * timeout_tv.tv_usec;
timeout.tv_nsec = (int)(1000000000.0 * ((double)random() / (double)RAND_MAX));
timeout.tv_sec++;
// struct timeval start;
pthread_mutex_lock(&mutex);
pthread_cond_timedwait(&never, &mutex, &timeout);
pthread_mutex_unlock(&mutex);
for(r = 0; r < num_xact; r ++) {
struct timeval endtime_tv;
struct timespec endtime;
// run_xact(dbenv, db_cats, offset*(1+r)*insert_per_xact, insert_per_xact);
run_xact(dbenv, db_cats, (offset * num_xact * insert_per_xact) + (r * insert_per_xact), insert_per_xact);
gettimeofday(&endtime_tv, NULL);
endtime.tv_sec = endtime_tv.tv_sec;
endtime.tv_nsec = 1000 * endtime_tv.tv_usec;
double microSecondsPassed = 1000000000.0 * (double)(endtime.tv_sec - timeout.tv_sec);
microSecondsPassed = (microSecondsPassed + (double)endtime.tv_nsec) - (double)timeout.tv_nsec;
assert(microSecondsPassed > 0.0);
// sum += microSecondsPassed;
// sum_x_squared += (microSecondsPassed * microSecondsPassed) ;
int bucket = (log_multiplier * log(microSecondsPassed));
if(bucket >= COUNTER_RESOLUTION) { bucket = COUNTER_RESOLUTION - 1; }
addTimespec(&timeout, 1000000000.0 / thread_requests_per_sec);
pthread_mutex_lock(&mutex);
// timeout.tv_sec++;
buckets[bucket]++;
pthread_cond_timedwait(&never, &mutex, &timeout);
pthread_mutex_unlock(&mutex);
}
pthread_mutex_lock(&mutex);
activeThreads--;
pthread_mutex_unlock(&mutex);
// printf("%d done\n", offset);
}

View file

@ -0,0 +1,595 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <db.h>
#define ENV_DIRECTORY "TXNAPP"
void add_cat(DB_ENV *, DB *, char *, ...);
void run_xact(DB_ENV *, DB *, int, int);
/*void add_color(DB_ENV *, DB *, char *, int);
void add_fruit(DB_ENV *, DB *, char *, char *); */
void *checkpoint_thread(void *);
void log_archlist(DB_ENV *);
void *logfile_thread(void *);
void db_open(DB_ENV *, DB **, char *, int);
void env_dir_create(void);
void env_open(DB_ENV **);
void usage(void);
int
main(int argc, char *argv[])
{
extern int optind;
DB *db_cats; /*, *db_color, *db_fruit; */
DB_ENV *dbenv;
pthread_t ptid;
int ch, ret;
/* while ((ch = getopt(argc, argv, "")) != EOF)
switch (ch) {
case '?':
default:
usage();
}
argc -= optind;
argv += optind; */
assert(argc == 3);
env_dir_create();
env_open(&dbenv);
/* Start a checkpoint thread. */
if ((ret = pthread_create(
&ptid, NULL, checkpoint_thread, (void *)dbenv)) != 0) {
fprintf(stderr,
"txnapp: failed spawning checkpoint thread: %s\n",
strerror(ret));
exit (1);
}
/* Start a logfile removal thread. */
if ((ret = pthread_create(
&ptid, NULL, logfile_thread, (void *)dbenv)) != 0) {
fprintf(stderr,
"txnapp: failed spawning log file removal thread: %s\n",
strerror(ret));
exit (1);
}
/* Open database: Key is fruit class; Data is specific type. */
/* db_open(dbenv, &db_fruit, "fruit", 0); */
/* Open database: Key is a color; Data is an integer. */
/*db_open(dbenv, &db_color, "color", 0); */
/*
* Open database:
* Key is a name; Data is: company name, address, cat breeds.
*/
db_open(dbenv, &db_cats, "cats", 1);
/* add_fruit(dbenv, db_fruit, "apple", "yellow delicious");
add_color(dbenv, db_color, "blue", 0);
add_color(dbenv, db_color, "blue", 3); */
/* add_cat(dbenv, db_cats,
"Amy Adams",
"Sleepycat Software",
"394 E. Riding Dr., Carlisle, MA 01741, USA",
"abyssinian",
"bengal",
"chartreaux",
NULL);*/
int r;
int num_xact = atoi(argv[1]); //100;
int insert_per_xact = atoi(argv[2]); //1000;
for(r = 0; r < num_xact; r ++) {
run_xact(dbenv, db_cats, 1+r*insert_per_xact, insert_per_xact);
}
return (0);
}
void
env_dir_create(void)
{
struct stat sb;
/*
* If the directory exists, we're done. We do not further check
* the type of the file, DB will fail appropriately if it's the
* wrong type.
*/
if (stat(ENV_DIRECTORY, &sb) == 0)
return;
/* Create the directory, read/write/access owner only. */
if (mkdir(ENV_DIRECTORY, S_IRWXU) != 0) {
fprintf(stderr,
"txnapp: mkdir: %s: %s\n", ENV_DIRECTORY, strerror(errno));
exit (1);
}
}
void
env_open(DB_ENV **dbenvp)
{
DB_ENV *dbenv;
int ret;
/* Create the environment handle. */
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"txnapp: db_env_create: %s\n", db_strerror(ret));
exit (1);
}
/* Set up error handling. */
dbenv->set_errpfx(dbenv, "txnapp");
dbenv->set_errfile(dbenv, stderr);
/* Do deadlock detection internally. */
if ((ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) {
dbenv->err(dbenv, ret, "set_lk_detect: DB_LOCK_DEFAULT");
exit (1);
}
/*
* Open a transactional environment:
* create if it doesn't exist
* free-threaded handle
* run recovery
* read/write owner only
*/
if ((ret = dbenv->open(dbenv, ENV_DIRECTORY,
DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG |
DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER | DB_THREAD,
S_IRUSR | S_IWUSR)) != 0) {
dbenv->err(dbenv, ret, "dbenv->open: %s", ENV_DIRECTORY);
exit (1);
}
*dbenvp = dbenv;
}
void *
checkpoint_thread(void *arg)
{
DB_ENV *dbenv;
int ret;
dbenv = arg;
dbenv->errx(dbenv, "Checkpoint thread: %lu", (u_long)pthread_self());
/* Checkpoint once a minute. */
for (;; sleep(60))
if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0)) != 0) {
dbenv->err(dbenv, ret, "checkpoint thread");
exit (1);
}
/* NOTREACHED */
}
void *
logfile_thread(void *arg)
{
DB_ENV *dbenv;
int ret;
char **begin, **list;
dbenv = arg;
dbenv->errx(dbenv,
"Log file removal thread: %lu", (u_long)pthread_self());
/* Check once every 5 minutes. */
for (;; sleep(300)) {
/* Get the list of log files. */
if ((ret =
dbenv->log_archive(dbenv, &list, DB_ARCH_ABS)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive");
exit (1);
}
/* Remove the log files. */
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
if ((ret = remove(*list)) != 0) {
dbenv->err(dbenv,
ret, "remove %s", *list);
exit (1);
}
free (begin);
}
}
/* NOTREACHED */
}
void
log_archlist(DB_ENV *dbenv)
{
int ret;
char **begin, **list;
/* Get the list of database files. */
if ((ret = dbenv->log_archive(dbenv,
&list, DB_ARCH_ABS | DB_ARCH_DATA)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive: DB_ARCH_DATA");
exit (1);
}
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
printf("database file: %s\n", *list);
free (begin);
}
/* Get the list of log files. */
if ((ret = dbenv->log_archive(dbenv,
&list, DB_ARCH_ABS | DB_ARCH_LOG)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive: DB_ARCH_LOG");
exit (1);
}
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
printf("log file: %s\n", *list);
free (begin);
}
}
void
db_open(DB_ENV *dbenv, DB **dbp, char *name, int dups)
{
DB *db;
int ret;
/* Create the database handle. */
if ((ret = db_create(&db, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_create");
exit (1);
}
/* Optionally, turn on duplicate data items. */
/* if (dups && (ret = db->set_flags(db, DB_DUP)) != 0) {
dbenv->err(dbenv, ret, "db->set_flags: DB_DUP");
exit (1);
} */
/*
* Open a database in the environment:
* create if it doesn't exist
* free-threaded handle
* read/write owner only
*/
if ((ret = db->open(db, NULL, name, NULL, /*DB_BTREE*/ DB_RECNO /*DB_HASH*/,
DB_AUTO_COMMIT | DB_CREATE | DB_THREAD, S_IRUSR | S_IWUSR)) != 0) {
(void)db->close(db, 0);
dbenv->err(dbenv, ret, "db->open: %s", name);
exit (1);
}
*dbp = db;
}
void
add_fruit(DB_ENV *dbenv, DB *db, char *fruit, char *name)
{
DBT key, data;
DB_TXN *tid;
int ret;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = fruit;
key.size = strlen(fruit);
data.data = name;
data.size = strlen(name);
for (;;) {
/* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Store the value. */
switch (ret = db->put(db, tid, &key, &data, 0)) {
case 0:
/* Success: commit the change. */
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
return;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
break;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %s/%s", fruit, name);
exit (1);
}
}
}
void
add_color(DB_ENV *dbenv, DB *dbp, char *color, int increment)
{
DBT key, data;
DB_TXN *tid;
int original, ret;
char buf[64];
/* Initialization. */
memset(&key, 0, sizeof(key));
key.data = color;
key.size = strlen(color);
memset(&data, 0, sizeof(data));
data.flags = DB_DBT_MALLOC;
for (;;) {
/* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/*
* Get the key. If it exists, we increment the value. If it
* doesn't exist, we create it.
*/
switch (ret = dbp->get(dbp, tid, &key, &data, 0)) {
case 0:
original = atoi(data.data);
break;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
continue;
case DB_NOTFOUND:
original = 0;
break;
default:
/* Error: run recovery. */
dbenv->err(
dbenv, ret, "dbc->get: %s/%d", color, increment);
exit (1);
}
if (data.data != NULL)
free(data.data);
/* Create the new data item. */
(void)snprintf(buf, sizeof(buf), "%d", original + increment);
data.data = buf;
data.size = strlen(buf) + 1;
/* Store the new value. */
switch (ret = dbp->put(dbp, tid, &key, &data, 0)) {
case 0:
/* Success: commit the change. */
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
return;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
break;
default:
/* Error: run recovery. */
dbenv->err(
dbenv, ret, "dbc->put: %s/%d", color, increment);
exit (1);
}
}
}
void
add_cat(DB_ENV *dbenv, DB *db, char *name, ...)
{
va_list ap;
DBC *dbc;
DBT key, data;
DB_TXN *tid;
int ret;
char *s;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = name;
key.size = strlen(name);
retry: /* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Delete any previously existing item. */
switch (ret = db->del(db, tid, &key, 0)) {
case 0:
case DB_NOTFOUND:
break;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
dbenv->err(dbenv, ret, "db->del: %s", name);
exit (1);
}
/* Create a cursor. */
if ((ret = db->cursor(db, tid, &dbc, 0)) != 0) {
dbenv->err(dbenv, ret, "db->cursor");
exit (1);
}
/* Append the items, in order. */
va_start(ap, name);
while ((s = va_arg(ap, char *)) != NULL) {
data.data = s;
data.size = strlen(s);
switch (ret = dbc->c_put(dbc, &key, &data, DB_KEYLAST)) {
case 0:
break;
case DB_LOCK_DEADLOCK:
va_end(ap);
/* Deadlock: retry the operation. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(
dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %s/%s", name, s);
exit (1);
}
}
va_end(ap);
/* Success: commit the change. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
}
void
run_xact(DB_ENV *dbenv, DB *db, int offset, int count)
{
va_list ap;
DBC *dbc;
DBT key, data;
DB_TXN *tid;
int ret;
char *s;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
int keyPtr;
int valPtr;
key.data = &keyPtr;
key.size = sizeof(int);/*strlen(name);*/
data.data = &valPtr;
data.size = sizeof(int);
retry: /* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Delete any previously existing item. */
/* switch (ret = db->del(db, tid, &key, 0)) {
case 0:
case DB_NOTFOUND:
break;
case DB_LOCK_DEADLOCK:
/ * Deadlock: retry the operation. * /
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
dbenv->err(dbenv, ret, "db->del: %s", name);
exit (1);
} */
/* Create a cursor. */
if ((ret = db->cursor(db, tid, &dbc, 0)) != 0) {
dbenv->err(dbenv, ret, "db->cursor");
exit (1);
}
/* Append the items, in order. */
// va_start(ap, name);
// while ((s = va_arg(ap, char *)) != NULL) {
int q;
for(q = offset; q < offset + count; q++) {
keyPtr = q;
valPtr = q;
/* data.data = s;
data.size = strlen(s); */
// printf("A"); fflush(NULL);
switch (ret = dbc->c_put(dbc, &key, &data, DB_KEYLAST)) {
case 0:
// printf("B"); fflush(NULL);
break;
case DB_LOCK_DEADLOCK:
va_end(ap);
/* Deadlock: retry the operation. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(
dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %d/%d", q, q);
exit (1);
}
}
va_end(ap);
/* Success: commit the change. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
}
void
usage(void)
{
(void)fprintf(stderr, "usage: txnapp\n");
exit(1);
}

View file

@ -0,0 +1,358 @@
#include "genericBerkeleyDBCode.h"
DB_ENV *dbenv;
DB *db_cats;
int commitCount = 0;
int putCount = 0;
void
env_dir_create(void)
{
struct stat sb;
/*
* If the directory exists, we're done. We do not further check
* the type of the file, DB will fail appropriately if it's the
* wrong type.
*/
if (stat(ENV_DIRECTORY, &sb) == 0) {
printf("Error! Directory already exists!\n");
fflush(stdout);
abort(); // This is a benchmark!!!
return;
}
/* Create the directory, read/write/access owner only. */
if (mkdir(ENV_DIRECTORY, S_IRWXU) != 0) {
fprintf(stderr,
"txnapp: mkdir: %s: %s\n", ENV_DIRECTORY, strerror(errno));
exit (1);
}
}
void
env_open(DB_ENV **dbenvp)
{
DB_ENV *dbenv;
int ret;
/* Create the environment handle. */
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"txnapp: db_env_create: %s\n", db_strerror(ret));
exit (1);
}
/* Set up error handling. */
dbenv->set_errpfx(dbenv, "txnapp");
dbenv->set_errfile(dbenv, stderr);
// match lladd's defaults...
dbenv->set_lg_bsize(dbenv, 1024*1024);
// match lladd's defaults...
dbenv->set_cachesize(dbenv, 0, 8204288, 0);
/* Do deadlock detection internally. */
/* if ((ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) {
dbenv->err(dbenv, ret, "set_lk_detect: DB_LOCK_DEFAULT");
exit (1);
}*/
dbenv->set_tx_max(dbenv, 32000);
unsigned int max;
dbenv->get_tx_max(dbenv, &max);
printf("Max xact count: %d\n", max);
/*
* Open a transactional environment:
* create if it doesn't exist
* free-threaded handle
* run recovery
* read/write owner only
*/
if ((ret = dbenv->open(dbenv, ENV_DIRECTORY,
DB_CREATE |/* DB_INIT_LOCK |*/ DB_INIT_LOG | DB_PRIVATE |
DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER | DB_THREAD,
S_IRUSR | S_IWUSR)) != 0) {
dbenv->err(dbenv, ret, "dbenv->open: %s", ENV_DIRECTORY);
exit (1);
}
*dbenvp = dbenv;
}
void *
checkpoint_thread(void *arg)
{
DB_ENV *dbenv;
int ret;
dbenv = arg;
dbenv->errx(dbenv, "Checkpoint thread: %lu", (u_long)pthread_self());
/* Checkpoint once a minute. */
for (;; sleep(60))
if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0)) != 0) {
dbenv->err(dbenv, ret, "checkpoint thread");
exit (1);
}
/* NOTREACHED */
}
void *
logfile_thread(void *arg)
{
DB_ENV *dbenv;
int ret;
char **begin, **list;
dbenv = arg;
dbenv->errx(dbenv,
"Log file removal thread: %lu", (u_long)pthread_self());
/* Check once every 5 minutes. */
for (;; sleep(300)) {
/* Get the list of log files. */
if ((ret =
dbenv->log_archive(dbenv, &list, DB_ARCH_ABS)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive");
exit (1);
}
/* Remove the log files. */
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
if ((ret = remove(*list)) != 0) {
dbenv->err(dbenv,
ret, "remove %s", *list);
exit (1);
}
free (begin);
}
}
/* NOTREACHED */
}
void
log_archlist(DB_ENV *dbenv)
{
int ret;
char **begin, **list;
/* Get the list of database files. */
if ((ret = dbenv->log_archive(dbenv,
&list, DB_ARCH_ABS | DB_ARCH_DATA)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive: DB_ARCH_DATA");
exit (1);
}
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
printf("database file: %s\n", *list);
free (begin);
}
/* Get the list of log files. */
if ((ret = dbenv->log_archive(dbenv,
&list, DB_ARCH_ABS | DB_ARCH_LOG)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive: DB_ARCH_LOG");
exit (1);
}
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
printf("log file: %s\n", *list);
free (begin);
}
}
DB *db;
void
db_open(DB_ENV *dbenv, DB **dbp, char *name, int type)
{
int ret;
/* Create the database handle. */
if ((ret = db_create(&db, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_create");
exit (1);
}
/* Optionally, turn on duplicate data items. */
/* if (dups && (ret = db->set_flags(db, DB_DUP)) != 0) {
dbenv->err(dbenv, ret, "db->set_flags: DB_DUP");
exit (1);
} */
/*
* Open a database in the environment:
* create if it doesn't exist
* free-threaded handle
* read/write owner only
*/
if ((ret = db->open(db, NULL, name, NULL, type, /*DB_DIRECT_LOG | DB_DIRECT_DB | */
DB_AUTO_COMMIT | DB_DIRTY_READ | DB_TXN_SYNC | DB_CREATE | DB_THREAD, S_IRUSR | S_IWUSR)) != 0) {
(void)db->close(db, 0);
dbenv->err(dbenv, ret, "db->open: %s", name);
exit (1);
}
*dbp = db;
}
void
run_xact(DB_ENV *dbenv, DB *db, int offset, int count)
{
// va_list ap;
DBC *dbc;
DBT key, data;
DB_TXN *tid;
int ret;
char *s;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
int keyPtr;
int valPtr;
key.data = &keyPtr;
key.size = sizeof(int);/*strlen(name);*/
data.data = &valPtr;
data.size = sizeof(int);
retry: /* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Delete any previously existing item. */
/* switch (ret = db->del(db, tid, &key, 0)) {
case 0:
case DB_NOTFOUND:
break;
case DB_LOCK_DEADLOCK:
abort();
/ * Deadlock: retry the operation. * /
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
// dbenv->err(dbenv, ret, "db->del: %s", name);
abort();
exit (1);
} */
/* Create a cursor. */
/* if ((ret = db->cursor(db, tid, &dbc, 0)) != 0) {
dbenv->err(dbenv, ret, "db->cursor");
exit (1);
} */
int q;
/* Count is one for this test */
// assert(count == 1);
for(q = offset; q < offset + count; q++) {
keyPtr = q+1;
valPtr = q;
/* switch (ret = db->del(db, tid, &key, 0)) {
case 0:
case DB_NOTFOUND:
break;
case DB_LOCK_DEADLOCK:
abort();
// Deadlock: retry the operation.
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
// dbenv->err(dbenv, ret, "db->del: %s", name);
abort();
exit (1);
} */
// pthread_mutex_lock(&hack);
switch (ret = db->put(db, tid, &key, &data, 0)) {
case 0:
break;
case DB_LOCK_DEADLOCK:
// va_end(ap);
abort(); // Locking should be disabled!
/* Deadlock: retry the operation. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(
dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %d/%d", q, q);
abort(); // Error invalidates benchmark!
exit (1);
}
// pthread_mutex_unlock(&hack);
putCount++;
}
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
commitCount++;
#ifdef DEBUG_BDB
printf("Called commit\n");
#endif
}
void
usage(void)
{
(void)fprintf(stderr, "usage: txnapp\n");
exit(1);
}
void
initDB(/*DB_ENV ** dbenv, */pthread_attr_t * attr, int type)
{
pthread_t ptid;
env_dir_create();
env_open(&dbenv);
int ret;
/*
///Start a checkpoint thread.
if ((ret = pthread_create(
&ptid, attr, checkpoint_thread, (void *)dbenv)) != 0) {
fprintf(stderr,
"txnapp: failed spawning checkpoint thread: %s\n",
strerror(ret));
exit (1);
}
/// Start a logfile removal thread.
if ((ret = pthread_create(
&ptid, attr, logfile_thread, (void *)dbenv)) != 0) {
fprintf(stderr,
"txnapp: failed spawning log file removal thread: %s\n",
strerror(ret));
exit (1);
}
*/
db_open(dbenv, &db_cats, "cats", type);
}

View file

@ -0,0 +1,17 @@
void run_xact(DB_ENV *, DB *, int, int);
void *checkpoint_thread(void *);
void log_archlist(DB_ENV *);
void *logfile_thread(void *);
/**
@param type DB_RECNO, DB_HASH or DB_BTREE
*/
void db_open(DB_ENV *, DB **, char *, int type);
void env_dir_create(void);
void env_open(DB_ENV **);
void usage(void);
extern DB_ENV *dbenv;
extern DB *db_cats;
#define ENV_DIRECTORY "TXNAPP"

View file

@ -0,0 +1,595 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <db.h>
#define ENV_DIRECTORY "TXNAPP"
void add_cat(DB_ENV *, DB *, char *, ...);
void run_xact(DB_ENV *, DB *, int, int);
/*void add_color(DB_ENV *, DB *, char *, int);
void add_fruit(DB_ENV *, DB *, char *, char *); */
void *checkpoint_thread(void *);
void log_archlist(DB_ENV *);
void *logfile_thread(void *);
void db_open(DB_ENV *, DB **, char *, int);
void env_dir_create(void);
void env_open(DB_ENV **);
void usage(void);
int
main(int argc, char *argv[])
{
extern int optind;
DB *db_cats; /*, *db_color, *db_fruit; */
DB_ENV *dbenv;
pthread_t ptid;
int ch, ret;
/* while ((ch = getopt(argc, argv, "")) != EOF)
switch (ch) {
case '?':
default:
usage();
}
argc -= optind;
argv += optind; */
assert(argc == 3);
env_dir_create();
env_open(&dbenv);
/* Start a checkpoint thread. */
if ((ret = pthread_create(
&ptid, NULL, checkpoint_thread, (void *)dbenv)) != 0) {
fprintf(stderr,
"txnapp: failed spawning checkpoint thread: %s\n",
strerror(ret));
exit (1);
}
/* Start a logfile removal thread. */
if ((ret = pthread_create(
&ptid, NULL, logfile_thread, (void *)dbenv)) != 0) {
fprintf(stderr,
"txnapp: failed spawning log file removal thread: %s\n",
strerror(ret));
exit (1);
}
/* Open database: Key is fruit class; Data is specific type. */
/* db_open(dbenv, &db_fruit, "fruit", 0); */
/* Open database: Key is a color; Data is an integer. */
/*db_open(dbenv, &db_color, "color", 0); */
/*
* Open database:
* Key is a name; Data is: company name, address, cat breeds.
*/
db_open(dbenv, &db_cats, "cats", 1);
/* add_fruit(dbenv, db_fruit, "apple", "yellow delicious");
add_color(dbenv, db_color, "blue", 0);
add_color(dbenv, db_color, "blue", 3); */
/* add_cat(dbenv, db_cats,
"Amy Adams",
"Sleepycat Software",
"394 E. Riding Dr., Carlisle, MA 01741, USA",
"abyssinian",
"bengal",
"chartreaux",
NULL);*/
int r;
int num_xact = atoi(argv[1]); //100;
int insert_per_xact = atoi(argv[2]); //1000;
for(r = 0; r < num_xact; r ++) {
run_xact(dbenv, db_cats, 1+r*insert_per_xact, insert_per_xact);
}
return (0);
}
void
env_dir_create(void)
{
struct stat sb;
/*
* If the directory exists, we're done. We do not further check
* the type of the file, DB will fail appropriately if it's the
* wrong type.
*/
if (stat(ENV_DIRECTORY, &sb) == 0)
return;
/* Create the directory, read/write/access owner only. */
if (mkdir(ENV_DIRECTORY, S_IRWXU) != 0) {
fprintf(stderr,
"txnapp: mkdir: %s: %s\n", ENV_DIRECTORY, strerror(errno));
exit (1);
}
}
void
env_open(DB_ENV **dbenvp)
{
DB_ENV *dbenv;
int ret;
/* Create the environment handle. */
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"txnapp: db_env_create: %s\n", db_strerror(ret));
exit (1);
}
/* Set up error handling. */
dbenv->set_errpfx(dbenv, "txnapp");
dbenv->set_errfile(dbenv, stderr);
/* Do deadlock detection internally. */
if ((ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) {
dbenv->err(dbenv, ret, "set_lk_detect: DB_LOCK_DEFAULT");
exit (1);
}
/*
* Open a transactional environment:
* create if it doesn't exist
* free-threaded handle
* run recovery
* read/write owner only
*/
if ((ret = dbenv->open(dbenv, ENV_DIRECTORY,
DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG |
DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER | DB_THREAD,
S_IRUSR | S_IWUSR)) != 0) {
dbenv->err(dbenv, ret, "dbenv->open: %s", ENV_DIRECTORY);
exit (1);
}
*dbenvp = dbenv;
}
void *
checkpoint_thread(void *arg)
{
DB_ENV *dbenv;
int ret;
dbenv = arg;
dbenv->errx(dbenv, "Checkpoint thread: %lu", (u_long)pthread_self());
/* Checkpoint once a minute. */
for (;; sleep(60))
if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0)) != 0) {
dbenv->err(dbenv, ret, "checkpoint thread");
exit (1);
}
/* NOTREACHED */
}
void *
logfile_thread(void *arg)
{
DB_ENV *dbenv;
int ret;
char **begin, **list;
dbenv = arg;
dbenv->errx(dbenv,
"Log file removal thread: %lu", (u_long)pthread_self());
/* Check once every 5 minutes. */
for (;; sleep(300)) {
/* Get the list of log files. */
if ((ret =
dbenv->log_archive(dbenv, &list, DB_ARCH_ABS)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive");
exit (1);
}
/* Remove the log files. */
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
if ((ret = remove(*list)) != 0) {
dbenv->err(dbenv,
ret, "remove %s", *list);
exit (1);
}
free (begin);
}
}
/* NOTREACHED */
}
void
log_archlist(DB_ENV *dbenv)
{
int ret;
char **begin, **list;
/* Get the list of database files. */
if ((ret = dbenv->log_archive(dbenv,
&list, DB_ARCH_ABS | DB_ARCH_DATA)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive: DB_ARCH_DATA");
exit (1);
}
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
printf("database file: %s\n", *list);
free (begin);
}
/* Get the list of log files. */
if ((ret = dbenv->log_archive(dbenv,
&list, DB_ARCH_ABS | DB_ARCH_LOG)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive: DB_ARCH_LOG");
exit (1);
}
if (list != NULL) {
for (begin = list; *list != NULL; ++list)
printf("log file: %s\n", *list);
free (begin);
}
}
void
db_open(DB_ENV *dbenv, DB **dbp, char *name, int dups)
{
DB *db;
int ret;
/* Create the database handle. */
if ((ret = db_create(&db, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_create");
exit (1);
}
/* Optionally, turn on duplicate data items. */
/* if (dups && (ret = db->set_flags(db, DB_DUP)) != 0) {
dbenv->err(dbenv, ret, "db->set_flags: DB_DUP");
exit (1);
} */
/*
* Open a database in the environment:
* create if it doesn't exist
* free-threaded handle
* read/write owner only
*/
if ((ret = db->open(db, NULL, name, NULL, /*DB_BTREE*/ DB_RECNO /*DB_HASH*/,
DB_AUTO_COMMIT | DB_CREATE | DB_THREAD, S_IRUSR | S_IWUSR)) != 0) {
(void)db->close(db, 0);
dbenv->err(dbenv, ret, "db->open: %s", name);
exit (1);
}
*dbp = db;
}
void
add_fruit(DB_ENV *dbenv, DB *db, char *fruit, char *name)
{
DBT key, data;
DB_TXN *tid;
int ret;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = fruit;
key.size = strlen(fruit);
data.data = name;
data.size = strlen(name);
for (;;) {
/* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Store the value. */
switch (ret = db->put(db, tid, &key, &data, 0)) {
case 0:
/* Success: commit the change. */
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
return;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
break;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %s/%s", fruit, name);
exit (1);
}
}
}
void
add_color(DB_ENV *dbenv, DB *dbp, char *color, int increment)
{
DBT key, data;
DB_TXN *tid;
int original, ret;
char buf[64];
/* Initialization. */
memset(&key, 0, sizeof(key));
key.data = color;
key.size = strlen(color);
memset(&data, 0, sizeof(data));
data.flags = DB_DBT_MALLOC;
for (;;) {
/* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/*
* Get the key. If it exists, we increment the value. If it
* doesn't exist, we create it.
*/
switch (ret = dbp->get(dbp, tid, &key, &data, 0)) {
case 0:
original = atoi(data.data);
break;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
continue;
case DB_NOTFOUND:
original = 0;
break;
default:
/* Error: run recovery. */
dbenv->err(
dbenv, ret, "dbc->get: %s/%d", color, increment);
exit (1);
}
if (data.data != NULL)
free(data.data);
/* Create the new data item. */
(void)snprintf(buf, sizeof(buf), "%d", original + increment);
data.data = buf;
data.size = strlen(buf) + 1;
/* Store the new value. */
switch (ret = dbp->put(dbp, tid, &key, &data, 0)) {
case 0:
/* Success: commit the change. */
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
return;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
break;
default:
/* Error: run recovery. */
dbenv->err(
dbenv, ret, "dbc->put: %s/%d", color, increment);
exit (1);
}
}
}
void
add_cat(DB_ENV *dbenv, DB *db, char *name, ...)
{
va_list ap;
DBC *dbc;
DBT key, data;
DB_TXN *tid;
int ret;
char *s;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = name;
key.size = strlen(name);
retry: /* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Delete any previously existing item. */
switch (ret = db->del(db, tid, &key, 0)) {
case 0:
case DB_NOTFOUND:
break;
case DB_LOCK_DEADLOCK:
/* Deadlock: retry the operation. */
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
dbenv->err(dbenv, ret, "db->del: %s", name);
exit (1);
}
/* Create a cursor. */
if ((ret = db->cursor(db, tid, &dbc, 0)) != 0) {
dbenv->err(dbenv, ret, "db->cursor");
exit (1);
}
/* Append the items, in order. */
va_start(ap, name);
while ((s = va_arg(ap, char *)) != NULL) {
data.data = s;
data.size = strlen(s);
switch (ret = dbc->c_put(dbc, &key, &data, DB_KEYLAST)) {
case 0:
break;
case DB_LOCK_DEADLOCK:
va_end(ap);
/* Deadlock: retry the operation. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(
dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %s/%s", name, s);
exit (1);
}
}
va_end(ap);
/* Success: commit the change. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
}
void
run_xact(DB_ENV *dbenv, DB *db, int offset, int count)
{
va_list ap;
DBC *dbc;
DBT key, data;
DB_TXN *tid;
int ret;
char *s;
/* Initialization. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
int keyPtr;
int valPtr;
key.data = &keyPtr;
key.size = sizeof(int);/*strlen(name);*/
data.data = &valPtr;
data.size = sizeof(int);
retry: /* Begin the transaction. */
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
exit (1);
}
/* Delete any previously existing item. */
/* switch (ret = db->del(db, tid, &key, 0)) {
case 0:
case DB_NOTFOUND:
break;
case DB_LOCK_DEADLOCK:
/ * Deadlock: retry the operation. * /
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
dbenv->err(dbenv, ret, "db->del: %s", name);
exit (1);
} */
/* Create a cursor. */
if ((ret = db->cursor(db, tid, &dbc, 0)) != 0) {
dbenv->err(dbenv, ret, "db->cursor");
exit (1);
}
/* Append the items, in order. */
// va_start(ap, name);
// while ((s = va_arg(ap, char *)) != NULL) {
int q;
for(q = offset; q < offset + count; q++) {
keyPtr = q;
valPtr = q;
/* data.data = s;
data.size = strlen(s); */
// printf("A"); fflush(NULL);
switch (ret = dbc->c_put(dbc, &key, &data, DB_KEYLAST)) {
case 0:
// printf("B"); fflush(NULL);
break;
case DB_LOCK_DEADLOCK:
va_end(ap);
/* Deadlock: retry the operation. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(
dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->abort(tid)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->abort");
exit (1);
}
goto retry;
default:
/* Error: run recovery. */
dbenv->err(dbenv, ret, "dbc->put: %d/%d", q, q);
exit (1);
}
}
va_end(ap);
/* Success: commit the change. */
if ((ret = dbc->c_close(dbc)) != 0) {
dbenv->err(dbenv, ret, "dbc->c_close");
exit (1);
}
if ((ret = tid->commit(tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_TXN->commit");
exit (1);
}
}
void
usage(void)
{
(void)fprintf(stderr, "usage: txnapp\n");
exit(1);
}

184
benchmarks/bufferManager.c Normal file
View file

@ -0,0 +1,184 @@
/*
* bufferManager.c
*
* Created on: Sep 23, 2010
* Author: sears
*/
#include <stasis/flags.h>
#include <stasis/io/handle.h>
#include <stasis/transactional.h>
#include <stasis/util/histogram.h>
#include <stasis/page/fixed.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#include <math.h>
#include <stdlib.h>
DECLARE_HISTOGRAM_64(load_hist)
DECLARE_HISTOGRAM_64(release_hist)
struct thread_arg {
unsigned int seed;
unsigned long long num_ops;
double write_frac;
stasis_histogram_64_t * load_hist;
stasis_histogram_64_t * release_hist;
pageid_t page_count;
unsigned long long target_ops;
};
int do_load(pageid_t page_count) {
for(int i = 1; i < page_count; i++) {
Page * p = loadUninitializedPage(-1, i);
stasis_page_fixed_initialize_page(p, sizeof(i), 1);
recordid rid = {i, 0, sizeof(i)};
stasis_record_write(-1, p, rid,(byte*) &i);
stasis_page_lsn_write(-1, p, p->LSN + 1);
releasePage(p);
}
return 0;
}
int do_scan(pageid_t page_count) {
for(int i = 1; i < page_count; i++) {
Page * p = loadPage(-1, i);
recordid rid = {i, 0, sizeof(i)};
stasis_record_write(-1, p, rid,(byte*) &i);
assert(i == rid.page);
releasePage(p);
}
return 0;
}
void * random_op_thread(void * argp) {
struct thread_arg * a = argp;
struct timeval start_time;
gettimeofday(&start_time,0);
int xid = Tbegin();
stasis_log_t * l = stasis_log();
lsn_t lsn = l->next_available_lsn(l);
for(int i = 0; i < a->num_ops; i++) {
pageid_t pid = rand_r(&a->seed) % a->page_count;
int op = (rand_r(&a->seed) < (int)(a->write_frac * (double)RAND_MAX));
struct timeval start;
gettimeofday(&start,0);
double elapsed = stasis_timeval_to_double(stasis_subtract_timeval(start, start_time));
while(a->target_ops &&
elapsed < ((double)i) / (double)a->target_ops) {
struct timespec ts = stasis_double_to_timespec(0.001);
nanosleep(&ts, 0);
gettimeofday(&start,0);
elapsed = stasis_timeval_to_double(stasis_subtract_timeval(start, start_time));
}
stasis_histogram_tick(a->load_hist);
Page * p = loadPage(xid, pid);
stasis_histogram_tock(a->load_hist);
if(op) { // Do write
stasis_page_lsn_write(xid, p, lsn);
}
stasis_histogram_tick(a->release_hist);
releasePage(p);
stasis_histogram_tock(a->release_hist);
}
Tcommit(xid);
free(argp);
return 0;
}
int do_operations(pageid_t page_count, int num_threads, unsigned long long num_ops, double write_frac, int target_ops) {
unsigned long long ops_per_thread = ceil(((double)num_ops) / (double)num_threads);
unsigned long long ops_remaining = num_ops;
pthread_t * threads = stasis_malloc(num_threads, pthread_t);
struct timeval tv;
gettimeofday(&tv,0);
uint64_t base_seed = tv.tv_usec;
for(int i = 0; i < num_threads ; i++) {
if(ops_remaining <= 0) { num_threads = i; break; }
struct thread_arg *a = stasis_alloc(struct thread_arg);
a->seed = base_seed + i;
a->num_ops = ops_remaining < ops_per_thread ? ops_remaining : ops_per_thread;
a->write_frac = write_frac;
a->load_hist = &load_hist;
a->release_hist = &release_hist;
a->page_count = page_count;
a->target_ops = target_ops / num_threads;
if(i == num_threads - 1) {
a->target_ops = target_ops - (a->target_ops * (num_threads-1));
}
pthread_create(&threads[i], 0, random_op_thread, a);
ops_remaining -= ops_per_thread;
}
for(int i = 0 ; i < num_threads; i++) {
pthread_join(threads[i], 0);
}
return 0;
}
int main(int argc, char * argv[]) {
pageid_t file_size = 1024 * 128;
int load = 0;
int scan = 0;
int threads = 1;
unsigned long long num_ops = 0;
int target_ops = 0;
double write_frac = 0.5;
stasis_buffer_manager_hint_writes_are_sequential = 1;
for(int i = 1; i < argc; i++) {
if(!strcmp(argv[i], "--mem-size")) {
i++;
stasis_buffer_manager_size = atoll(argv[i]) * 1024 * 1024 / PAGE_SIZE;
} else if(!strcmp(argv[i], "--file-size")) {
i++;
file_size = (atoll(argv[i]) * 1024 * 1024) / PAGE_SIZE;
} else if(!strcmp(argv[i], "--load")) {
load = 1;
} else if(!strcmp(argv[i], "--threads")) {
i++;
threads = atoi(argv[i]);
} else if(!strcmp(argv[i], "--scan")) {
scan = 1;
} else if(!strcmp(argv[i], "--numops")) {
i++;
num_ops = atoll(argv[i]);
} else if(!strcmp(argv[i], "--write-frac")) {
i++;
write_frac = atof(argv[i]);
} else if(!strcmp(argv[i], "--target-ops")) {
i++;
target_ops = atoi(argv[i]);
} else if(!strcmp(argv[i], "--raid1")) {
stasis_handle_factory = stasis_handle_raid1_factory;
} else if(!strcmp(argv[i], "--raid0")) {
stasis_handle_factory = stasis_handle_raid0_factory;
} else {
fprintf(stderr, "unknown argument: %s\n", argv[i]);
abort();
}
}
printf("Calling Tinit().\n");
Tinit();
printf("Tinit() done.\n");
if(load) {
printf("Loading %lld pages (%lld megabytes)\n", file_size, (file_size * PAGE_SIZE)/(1024*1024));
do_load(file_size);
}
if(scan) {
printf("Scanning %lld pages (%lld megabytes)\n", file_size, (file_size * PAGE_SIZE)/(1024*1024));
do_scan(file_size);
}
if(num_ops) {
printf("Performing %lld uniform random operations\n", num_ops);
do_operations(file_size, threads, num_ops, write_frac, target_ops);
}
printf("Calling Tdeinit().\n");
Tdeinit();
printf("Tdeinit() done\n");
stasis_histograms_auto_dump();
return 0;
}

63
benchmarks/butterfly.c Normal file
View file

@ -0,0 +1,63 @@
/*
* butterfly.c
*
* Created on: Sep 9, 2011
* Author: sears
*/
#include <config.h>
#include <stasis/common.h>
#include <stasis/util/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main(int argc, char * argv[]) {
if(argc != 4) {
printf("usage: %s filename file_size sector_size\n", argv[0]); fflush(stdout); abort();
}
const char * filename = argv[1];
uint64_t file_size = atoll(argv[2]);
int sector_size = atoi(argv[3]);
int fd = -1;
#ifdef HAVE_O_DSYNC
fd = open(filename, O_WRONLY|O_DSYNC); //|O_DIRECT);
#else
fd = open(filename, O_WRONLY|O_SYNC);
#endif
struct timeval start, stop;
void * buf;
#ifdef HAVE_POSIX_MEMALIGN
posix_memalign(&buf, sector_size, sector_size);
#else
buf = malloc(2 * sector_size);
((intptr_t)buf) &= ~(sector_size-1);
#endif
memset(buf, 0, sector_size);
gettimeofday(&stop,0);
for(uint64_t i = 0; i < file_size/sector_size; i++) {
int err = pwrite(fd, buf, sector_size, 0);
if(err == -1) {
perror("Couldn't write");
abort();
}
assert(err && err == sector_size);
gettimeofday(&start, 0);
double reset_elapsed = stasis_timeval_to_double(stasis_subtract_timeval(start,stop));
err = pwrite(fd, buf, sector_size, i * sector_size);
if(err == -1) {
perror("Couldn't write");
abort();
}
assert(err && err == sector_size);
gettimeofday(&stop, 0);
double elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop,start));
printf("%lld\t%0.5f\t%0.5f\n", (long long) i, elapsed, reset_elapsed);
}
close(fd);
}

View file

@ -0,0 +1,134 @@
#include "lsn_bench_common.h"
int main(int argc, char ** argv) {
unlink("storefile.txt");
unlink("logfile.txt");
char * mode = argv[1];
long long num_rids = atoll(argv[2]);
long long num_xacts = atoll(argv[3]);
long long writes_per_xact = atoll(argv[4]);
recordid * rids;
recordid * fast;
cached_addr * cache;
int writeback = !(strcmp(mode, "writeback")&&strcmp(mode,"writeback-net")&&strcmp(mode,"writeback-pipeline"));
// stasis_truncation_automatic = 0;
/*if(!(strcmp(mode, "writeback-pipeline"))) {
// pipelining likes big queues
// stasis_log_file_write_buffer_size = 50 * 1024 * 1024;
} else {
}*/
stasis_log_file_write_buffer_size = 50 * 1024 * 1024;
Tinit();
alloc_rids(num_rids,&rids,&fast);
int net = 0;
if(writeback) {
build_cache(rids,&cache,num_rids);
}
// XXX move above build_cache!
if(!(strcmp(mode, "normal-net")&&strcmp(mode,"writeback-net"))) {
net = 1;
emulate_remote_pages();
emulate_remote_log();
}
int num_workers = 100;
if(!strcmp(mode, "writeback-pipeline")) {
emulate_remote_pages();
net = 1;
num_workers = 10;
stasis_log_reordering_usleep_after_flush = net_latency * 1000;
}
// stasis_log_reordering_handle_t* handles[num_workers];
lsn_t last_lsn = 0;
for(long long x = 0; x < num_xacts; x++) {
int xid = Tbegin();
if(net && writeback) {
writeback_unit_of_work_arg a[num_workers];
pthread_t workers[num_workers];
for(int i =0 ; i < num_workers; i++) {
a[i].num_rids = num_rids;
a[i].rid_per_xact = writes_per_xact;
a[i].cache = cache;
a[i].done = 0;
a[i].xid = xid;
a[i].workerid = i;
a[i].iterationid = x;
a[i].divisor = num_workers;
pthread_mutex_init(&a[i].mut,0);
pthread_create(&workers[i], 0, writeback_unit_of_work, &a[i]);
}
for(int i =0; i < num_workers; i++) {
pthread_mutex_lock(&a[i].mut);
a[i].done = 1;
pthread_mutex_unlock(&a[i].mut);
}
for(int i =0 ; i < num_workers; i++) {
pthread_join(workers[i],0);
}
} else {
/* if(writeback && net) {
for(int i = 0; i < num_workers; i++) {
handles[i] = stasis_log_reordering_handle_open(
&stasis_transaction_table[xid%MAX_TRANSACTIONS],
stasis_log_file,
(0.9*stasis_log_file_write_buffer_size)/num_workers,
//512*1024/ua->divisor, // 0.5 mb in log tail at once
1000000/num_workers, // max num outstanding requests
(50 * 1024 * 1024)/num_workers // max backlog in bytes
);
}
} */
for(long long j = 0; j < writes_per_xact; j++) {
// long long idx = ((x*writes_per_xact)+j)%num_rids;
long long idx = j % num_rids;
// if(!(j % 100)) { printf("."); fflush(stdout); }
if(!(strcmp(mode, "normal")&&strcmp(mode, "normal-net"))) {
TsetLsnFree(xid, rids[idx], &j);
} else {
assert(writeback);
int old = cache[idx].val;
cache[idx].val = j;
if(net) {
/* TsetReorderableWriteBack(xid, handles[j%num_workers], cache[idx].pid,
cache[idx].off, cache[idx].len,&j,&old);
*/
} else {
last_lsn = TsetWriteBack(xid, cache[idx].pid,cache[idx].off,
cache[idx].len,&j,&old);
assert(last_lsn);
}
}
}
/* if(writeback && net) {
for(int j = 0; j < num_workers; j++) {
stasis_log_reordering_handle_close(handles[j]);
}
} */
}
if(net) {
last_lsn = stasis_transaction_table_get(stasis_runtime_transaction_table(), xid)->prevLSN;
}
Tcommit(xid);
}
// XXX hack; really, want to register upcall in buffermanager...
if(writeback) {
printf("starting writeback"); fflush(stdout);
assert(last_lsn);
for(long long i = 0; i < num_rids; i++) {
Page *p = loadPage(-1, rids[i].page);
writelock(p->rwlatch,0);
stasis_record_write(-1, p, rids[i], (byte*)&cache[i].val);
stasis_page_lsn_write(-1, p, last_lsn);
unlock(p->rwlatch);
releasePage(p);
releasePage(p);
}
}
Tdeinit();
}

View file

@ -0,0 +1,23 @@
echo sw
time ./distributedLsnFree writeback 1000 10 1000
echo sn
time ./distributedLsnFree normal 1000 10 1000
echo swn
time ./distributedLsnFree writeback-net 1000 10 1000
echo swp
time ./distributedLsnFree writeback-pipeline 1000 10 1000
echo snn
time ./distributedLsnFree normal-net 1000 10 1000
echo w
time ./distributedLsnFree writeback 1000 10 100000
echo n
time ./distributedLsnFree normal 1000 10 100000
echo wn
time ./distributedLsnFree writeback-net 1000 10 100000
echo wp
time ./distributedLsnFree writeback-pipeline 1000 10 100000
date
echo nn
time ./distributedLsnFree normal-net 1000 10 100000

73
benchmarks/generateScripts.pl Executable file
View file

@ -0,0 +1,73 @@
#!/usr/bin/perl -w
use strict;
my $num_threads = 50;
## This perl script generates the input to timer.pl, which in turn
## generates the input to plotting.pl, which generates performance
## graphs. :)
open(LLADD_THREADED, ">LLADD_THREADED.script" );
open(LLADD_LOGICAL, ">LLADD_LOGICAL.script" );
open(LLADD_PHYSICAL, ">LLADD_PHYSICAL.script" );
open(LLADD_RAW_PHYSICAL, ">LLADD_RAW_PHYSICAL.script");
open(BDB_RAW_INSERT, ">BDB_RAW_INSERT.script" );
open(BDB_HASH_INSERT, ">BDB_HASH_INSERT.script" );
# New tests
open(LLADD_NTA, ">LLADD_NTA.script");
open(LLADD_LINKED_LIST, ">LLADD_LINKED_LIST.script");
open(LLADD_PAGED_LIST, ">LLADD_PAGED_LIST.script");
open(BDB_HASH_THREADED, ">BDB_HASH_THREADED.script");
open(EVERYTHING, ">EVERYTHING.script" );
for(my $i = 1; $i <= 10; $i += .5) {
my $insert_count = $i * 100000;
my $threaded_insert_count = $insert_count / $num_threads;
print LLADD_THREADED "./linearHashNTAThreaded $num_threads $threaded_insert_count\n";
print LLADD_LOGICAL "./logicalHash 1 $insert_count\n";
print LLADD_PHYSICAL "./naiveHash 1 $insert_count\n";
print LLADD_RAW_PHYSICAL "./arrayListSet 1 $insert_count\n";
print BDB_RAW_INSERT "./berkeleyDB/bdbRaw 1 $insert_count\n";
print BDB_HASH_INSERT "./berkeleyDB/bdbHash 1 $insert_count\n";
print LLADD_NTA "./linearHashNTA 1 $insert_count\n";
print LLADD_LINKED_LIST "./linkedListNTA 1 $insert_count\n";
print LLADD_PAGED_LIST "./pageOrientedListNTA 1 $insert_count\n";
print BDB_HASH_THREADED "./berkeleyDB/bdbHashThreaded $num_threads $threaded_insert_count\n";
print EVERYTHING "./linearHashNTAThreaded $num_threads $threaded_insert_count\n";
print EVERYTHING "./logicalHash 1 $insert_count\n";
print EVERYTHING "./naiveHash 1 $insert_count\n";
print EVERYTHING "./arrayListSet 1 $insert_count\n";
print EVERYTHING "./berkeleyDB/bdbRaw 1 $insert_count\n";
print EVERYTHING "./linearHashNTA 1 $insert_count\n";
print EVERYTHING "./linkedListNTA 1 $insert_count\n";
print EVERYTHING "./pageOrientedListNTA 1 $insert_count\n";
if($i < 4) {
print EVERYTHING "./berkeleyDB/bdbHashThreaded $num_threads $threaded_insert_count\n";
print EVERYTHING "./berkeleyDB/bdbHash 1 $insert_count\n";
}
}
close(LLADD_THREADED);
close(LLADD_LOGICAL);
close(LLADD_PHYSICAL);
close(LLADD_RAW_PHYSICAL);
close(BDB_RAW_INSERT);
close(BDB_HASH_INSERT);
close(EVERYTHING);
close(LLADD_NTA);
close(LLADD_LINKED_LIST);
close(LLADD_PAGED_LIST);
close(BDB_HASH_THREADED);

View file

@ -0,0 +1,37 @@
#!/usr/bin/perl -w
use strict;
## This perl script generates the input to timer.pl, which in turn
## generates the input to plotting.pl, which generates performance
## graphs. :)
open(LOGICAL_THREADS, ">LOGICAL_THREADS.script" );
for(my $i = 1; $i < 10; $i ++) {
# my $total = 500000;
my $total = 50000;
my $thread_count = $i;
my $insert_count = $total / $i;
# print LOGICAL_THREADS "./logicalMultThreaded $thread_count $insert_count\n";
print LOGICAL_THREADS "./linearHashNTAMultiReader $thread_count $insert_count\n";
}
for(my $i = 10; $i <= 254; $i += 10) {
# my $total = 500000;
my $total = 50000;
my $thread_count = $i;
my $insert_count = $total / $i;
# print LOGICAL_THREADS "./logicalMultThreaded $thread_count $insert_count\n";
print LOGICAL_THREADS "./linearHashNTAMultiReader $thread_count $insert_count\n";
}
close(LOGICAL_THREADS);

View file

@ -0,0 +1,34 @@
/*
* hashPerformance.c
*
* Created on: Aug 24, 2011
* Author: sears
*/
#include <stasis/common.h>
#include <stasis/util/hash.h>
#include <stasis/util/time.h>
#include <stdio.h>
int main(int argc, char * argv[]) {
char * foo = stasis_calloc(1024*1024*1024,char);
struct timeval start, stop;
gettimeofday(&start, 0);
for(long i = 0; i < (1024*1024*1024/sizeof(long)); i++) {
((long*)foo)[i] = i;
}
gettimeofday(&stop, 0);
double elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop, start));
printf("Took %f seconds to write to 1GB (%f mb/sec)\n", elapsed, (1024.0)/elapsed);
long len = 1;
for(long i = 0; i < 31; i++) {
gettimeofday(&start, 0);
stasis_crc32(foo, len, 0);
gettimeofday(&stop, 0);
elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop, start));
printf("Took %f seconds to checksum %ld bytes (%f mb/sec)\n", elapsed, len, ((double)len)/((1024.0*1024.0)*elapsed));
len *=2;
}
}

View file

@ -0,0 +1,102 @@
#include <config.h>
#include <stasis/common.h>
#include <stdio.h>
#include <stasis/util/lhtable.h>
#include <assert.h>
int entries;
int thread_count;
int waiting = 0;
pthread_mutex_t startAtOnce = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t threadWoke = PTHREAD_COND_INITIALIZER;
pthread_cond_t startAtOnceCond = PTHREAD_COND_INITIALIZER;
struct LH_ENTRY(table) * t;
char * itoa(int i) {
char * ret;
int err = asprintf(&ret, "%d", i);
assert(err != -1);
return ret;
}
static void * worker (void * arg) {
int thread_num = *(int*)arg;
int entries_s = entries;
pthread_mutex_lock(&startAtOnce);
waiting++;
if(thread_count == waiting) {
pthread_cond_signal(&threadWoke);
}
pthread_cond_wait(&startAtOnceCond, &startAtOnce);
pthread_mutex_unlock(&startAtOnce);
for(int i = 0; i < entries_s; i++) {
long val = (thread_num * entries_s) + i;
char * key = itoa(val);
LH_ENTRY(insert)(t, key, strlen(key), (void*)val);
free(key);
}
return 0;
}
int main(int argc, char ** argv) {
const char * usage = "Usage: %s <thread_count> <entries>\n%s\n";
if(argc != 3) {
printf(usage, argv[0], "Wrong number of arguments");
return -1;
}
errno = 0;
char *endptr;
thread_count = strtol(argv[1], &endptr, 10);
if(errno || *endptr) {
printf(usage, argv[0] ,"Could not parse # threads");
return -1;
}
entries = strtol(argv[2], &endptr, 10);
if(errno || *endptr) {
printf(usage, argv[0],"Could not parse # entries");
return -1;
}
printf("thread_count = %d, #entries = %d\n", thread_count, entries);
pthread_t * threads = stasis_malloc(thread_count, pthread_t);
int* thread_args = stasis_malloc(thread_count, int);
for(int i = 0; i < thread_count; i++) {
thread_args[i] = i + 1;
pthread_create(&(threads[i]), 0, worker, &(thread_args[i]));
}
t = LH_ENTRY(create)(100);
pthread_mutex_lock(&startAtOnce);
while(waiting != thread_count) {
pthread_cond_wait(&threadWoke, &startAtOnce);
}
pthread_cond_broadcast(&startAtOnceCond);
pthread_mutex_unlock(&startAtOnce);
printf("Start now\n"); fflush(0);
for(int i = 0; i < thread_count; i++) {
void *j;
pthread_join(threads[i], &j);
}
printf("End now\n"); fflush(0);
LH_ENTRY(destroy)(t);
free(threads);
free(thread_args);
return 0;
}

View file

@ -0,0 +1,46 @@
#include <stasis/transactional.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char** argv) {
assert(argc == 3 || argc == 4);
int xact_count = atoi(argv[1]);
int count = atoi(argv[2]);
int fixed_len = (argc == 4);
Tinit();
int xid = Tbegin();
recordid hash;
if(fixed_len) {
hash = ThashCreate(xid, sizeof(int), sizeof(int));
} else {
hash = ThashCreate(xid, VARIABLE_LENGTH, VARIABLE_LENGTH);
}
Tcommit(xid);
int i = 0;
for(int k = 0; k < xact_count; k++) {
xid = Tbegin();
for(;i < count *(k+1) ; i++) {
ThashInsert(xid, hash, (byte*)&i, sizeof(int), (byte*)&i, sizeof(int));
}
Tcommit(xid);
}
Tdeinit();
}

View file

@ -0,0 +1,121 @@
#include <config.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stasis/transactional.h>
#include <unistd.h>
#include <pthread.h>
int i = 0;
int max_active = 0;
pthread_mutex_t mutex;
//static pthread_mutex_t hash_mutex = PTHREAD_MUTEX_INITIALIZER;
static int count;
static recordid hash;
static void * go (void * arg_ptr) {
pthread_mutex_lock(&mutex);
i++;
if(i > max_active) {
max_active = i;
}
pthread_mutex_unlock(&mutex);
// pthread_mutex_lock(&hash_mutex);
int k = *(int*)arg_ptr;
int j;
int xid = Tbegin();
unsigned int seed = k;
for(j = 0; j < count ; j++) {
unsigned int r = rand_r(&seed) % 10000;
byte * tmp = NULL;
ThashLookup(xid, hash, (byte*)&r, sizeof(int), &tmp);
assert(r == *(unsigned int*)tmp);
}
// for(j = k * count; j < (k+1) *(count) ; j++) {
// TlogicalHashInsert(xid, hash, &j, sizeof(int), &j, sizeof(int));
// printf("(%d)", k);
//}
Tcommit(xid);
/*
for(j = k * count; j < (k+1) *(count) ; j++) {
int tmp = -100;
TlogicalHashLookup(xid, hash, &j, sizeof(int), &tmp, sizeof(int));
assert(j == tmp);
} */
// pthread_mutex_unlock(&hash_mutex);
pthread_mutex_lock(&mutex);
i--;
pthread_mutex_unlock(&mutex);
return NULL;
}
int main(int argc, char** argv) {
assert(argc == 3);
int thread_count = atoi(argv[1]);
count = atoi(argv[2]);
/* unlink("storefile.txt");
unlink("logfile.txt");
unlink("blob0_file.txt");
unlink("blob1_file.txt");*/
pthread_t * workers = stasis_malloc(thread_count, pthread_t);
Tinit();
int xid = Tbegin();
// hash = ThashCreate(xid, sizeof(int), sizeof(int));
hash = ThashCreate(xid, VARIABLE_LENGTH, VARIABLE_LENGTH);
int k;
for(k = 0; k < 20000; k++) {
ThashInsert(xid, hash, (byte*)&k, sizeof(int), (byte*)&k, sizeof(int));
}
Tcommit(xid);
/* threads have static thread sizes. Ughh. */
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_mutex_init(&mutex, NULL);
pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
pthread_mutex_lock(&mutex);
for(k = 0; k < thread_count; k++) {
int * k_copy = stasis_alloc(int);
*k_copy = k ;
pthread_create(&workers[k], &attr, go, k_copy);
}
pthread_mutex_unlock(&mutex);
for(k = 0; k < thread_count; k++) {
pthread_join(workers[k],NULL);
}
Tdeinit();
printf("Max active at once: %d\n", max_active);
}

View file

@ -0,0 +1,172 @@
#include <config.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stasis/transactional.h>
#include <unistd.h>
#include <pthread.h>
#include <math.h>
#include <sys/time.h>
#include <time.h>
// if we're using linux's crazy version of the pthread header,
// it probably forgot to include PTHREAD_STACK_MIN
#ifndef PTHREAD_STACK_MIN
#include <limits.h>
#endif
int activeThreads = 0;
int max_active = 0;
int alwaysCommit;
int commitCount = 0;
int putCount = 0;
/*
double avg_var = 0;
double max_var = 0;
double avg_mean = 0;
double max_mean = 0;*/
pthread_mutex_t mutex;
//static pthread_mutex_t hash_mutex = PTHREAD_MUTEX_INITIALIZER;
static int count;
static recordid hash;
static void * go (void * arg_ptr) {
// pthread_mutex_lock(&hash_mutex);
pthread_mutex_lock(&mutex);
activeThreads++;
if(activeThreads > max_active) {
max_active = activeThreads;
}
pthread_mutex_unlock(&mutex);
int k = *(int*)arg_ptr;
int j;
int xid = Tbegin();
// double sum_x_squared = 0;
// double sum = 0;
for(j = k * count; j < (k+1) *(count) ; j++) {
// struct timeval start, endtime;
// gettimeofday(&start, NULL);
ThashInsert(xid, hash, (byte*)&j, sizeof(int), (byte*)&j, sizeof(int));
putCount++;
/* gettimeofday(&endtime, NULL);
double microSecondsPassed = 1000000 * (endtime.tv_sec - start.tv_sec);
microSecondsPassed = (microSecondsPassed + endtime.tv_usec) - start.tv_usec;
sum += microSecondsPassed;
sum_x_squared += (microSecondsPassed * microSecondsPassed) ;
*/
// printf("(%d)", k);
if(alwaysCommit) {
// printf("Commit");
commitCount++;
Tcommit(xid);
xid = Tbegin();
}
}
Tcommit(xid);
commitCount++;
/*
for(j = k * count; j < (k+1) *(count) ; j++) {
int tmp = -100;
TlogicalHashLookup(xid, hash, &j, sizeof(int), &tmp, sizeof(int));
assert(j == tmp);
} */
// double count_d = count;
// double mean = sum / count_d;
// double variance = sqrt((sum_x_squared / count_d) - (mean * mean));
// pthread_mutex_unlock(&hash_mutex);
pthread_mutex_lock(&mutex);
activeThreads--;
/* avg_mean += mean;
avg_var += variance;
if(mean > max_mean ) { max_mean = mean; }
if(variance > max_var) { max_var = variance; } */
pthread_mutex_unlock(&mutex);
return NULL;
}
int main(int argc, char** argv) {
assert(argc == 3 || argc == 4);
int thread_count = atoi(argv[1]);
count = atoi(argv[2]);
alwaysCommit = (argc==4);
unlink("storefile.txt");
unlink("logfile.txt");
unlink("blob0_file.txt");
unlink("blob1_file.txt");
pthread_t * workers = stasis_malloc(thread_count, pthread_t);
Tinit();
int xid = Tbegin();
// hash = ThashCreate(xid, sizeof(int), sizeof(int));
hash = ThashCreate(xid, VARIABLE_LENGTH, VARIABLE_LENGTH);
Tcommit(xid);
int k;
/* threads have static thread sizes. Ughh. */
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_mutex_init(&mutex, NULL);
pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
// pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
pthread_mutex_lock(&mutex);
for(k = 0; k < thread_count; k++) {
int * k_copy = stasis_alloc(int);
*k_copy = k ;
pthread_create(&workers[k], &attr, go, k_copy);
}
pthread_mutex_unlock(&mutex);
for(k = 0; k < thread_count; k++) {
pthread_join(workers[k],NULL);
}
Tdeinit();
printf("Committed %d times, put %d times.\n", commitCount, putCount);
}

View file

@ -0,0 +1,264 @@
#include <config.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stasis/transactional.h>
#include <unistd.h>
#include <pthread.h>
#include <math.h>
#include <sys/time.h>
#include <time.h>
pthread_cond_t never;
pthread_mutex_t mutex;
double thread_requests_per_sec = 10.0;
int alwaysCommit;
#define MAX_SECONDS 100
#define COUNTER_RESOLUTION 240
int buckets[COUNTER_RESOLUTION];
// if we're using linux's crazy version of the pthread header,
// it probably forgot to include PTHREAD_STACK_MIN
#ifndef PTHREAD_STACK_MIN
#include <limits.h>
#endif
void addTimespec(struct timespec * ts, long nsec) {
ts->tv_nsec += nsec;
// 0123456789
if(ts->tv_nsec > 1000000000) {
ts->tv_nsec -= 1000000000;
ts->tv_sec ++;
}
}
int activeThreads = 0;
int max_active = 0;
/*double avg_var = 0;
double max_var = 0;
double avg_mean = 0;
double max_mean = 0;*/
//static pthread_mutex_t hash_mutex = PTHREAD_MUTEX_INITIALIZER;
static int count;
static recordid hash;
static void * go (void * arg_ptr) {
// pthread_mutex_lock(&hash_mutex);
pthread_mutex_lock(&mutex);
activeThreads++;
if(activeThreads > max_active) {
max_active = activeThreads;
}
pthread_mutex_unlock(&mutex);
int k = *(int*)arg_ptr;
int j;
int xid = 0;
if(!alwaysCommit) {
xid = Tbegin();
}
double sum_x_squared = 0;
double sum = 0;
double log_multiplier = COUNTER_RESOLUTION / log(MAX_SECONDS * 1000000000.0);
struct timeval timeout_tv;
struct timespec timeout;
gettimeofday(&timeout_tv, NULL);
timeout.tv_sec = timeout_tv.tv_sec;
timeout.tv_nsec = 1000 * timeout_tv.tv_usec;
timeout.tv_nsec = (int)(1000000000.0 * ((double)random() / (double)RAND_MAX));
timeout.tv_sec++;
// struct timeval start;
pthread_mutex_lock(&mutex);
pthread_cond_timedwait(&never, &mutex, &timeout);
pthread_mutex_unlock(&mutex);
/* gettimeofday(&start, NULL);
assert(timeout.tv_sec <= start.tv_sec);
assert(timeout.tv_nsec <= start.tv_nsec || timeout.tv_sec < start.tv_sec);*/
for(j = k * count; j < (k+1) *(count) ; j++) {
// struct timeval start,
struct timeval endtime_tv;
struct timespec endtime;
// gettimeofday(&start, NULL);
// start = timeout;
/* gettimeofday(&start, NULL);
assert(timeout.tv_sec <= start.tv_sec);
assert(timeout.tv_nsec <= start.tv_nsec || timeout.tv_sec < start.tv_sec);
*/
if(alwaysCommit) {
xid = Tbegin();
}
ThashInsert(xid, hash, (byte*)&j, sizeof(int), (byte*)&j, sizeof(int));
if(alwaysCommit) {
Tcommit(xid);
}
gettimeofday(&endtime_tv, NULL);
endtime.tv_sec = endtime_tv.tv_sec;
endtime.tv_nsec = 1000 * endtime_tv.tv_usec;
double microSecondsPassed = 1000000000.0 * (double)(endtime.tv_sec - timeout.tv_sec);
microSecondsPassed = (microSecondsPassed + (double)endtime.tv_nsec) - (double)timeout.tv_nsec;
assert(microSecondsPassed > 0.0);
sum += microSecondsPassed;
sum_x_squared += (microSecondsPassed * microSecondsPassed) ;
int bucket = (log_multiplier * log(microSecondsPassed));
if(bucket >= COUNTER_RESOLUTION) { bucket = COUNTER_RESOLUTION - 1; }
// timeout.tv_sec++;
// 0123456789
addTimespec(&timeout, 1000000000.0 / thread_requests_per_sec);
pthread_mutex_lock(&mutex);
buckets[bucket]++;
pthread_cond_timedwait(&never, &mutex, &timeout);
pthread_mutex_unlock(&mutex);
// printf("(%d)", k);
}
/*
for(j = k * count; j < (k+1) *(count) ; j++) {
int tmp = -100;
TlogicalHashLookup(xid, hash, &j, sizeof(int), &tmp, sizeof(int));
assert(j == tmp);
} */
// double count_d = count;
// double mean = sum / count_d;
// double variance = sqrt((sum_x_squared / count_d) - (mean * mean));
// pthread_mutex_unlock(&hash_mutex);
pthread_mutex_lock(&mutex);
activeThreads--;
/* avg_mean += mean;
avg_var += variance;
if(mean > max_mean ) { max_mean = mean; }
if(variance > max_var) { max_var = variance; } */
pthread_mutex_unlock(&mutex);
if(!alwaysCommit) {
Tcommit(xid);
}
return NULL;
}
int main(int argc, char** argv) {
assert(argc == 4);
int thread_count = atoi(argv[1]) ;
// count = atoi(argv[2]);
thread_requests_per_sec = (double)(atoi(argv[2]));
count = 10.0 * thread_requests_per_sec;
alwaysCommit = atoi(argv[3]);
printf("%d %f\n", thread_count, thread_requests_per_sec);
/* unlink("storefile.txt");
unlink("logfile.txt");
unlink("blob0_file.txt");
unlink("blob1_file.txt"); */
int l;
for(l = 0; l < COUNTER_RESOLUTION; l++) {
buckets[l] = 0;
}
pthread_t * workers = stasis_malloc(thread_count, pthread_t);
Tinit();
int xid = Tbegin();
hash = ThashCreate(xid, sizeof(int), sizeof(int));
Tcommit(xid);
int k;
/* threads have static thread sizes. Ughh. */
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&never, NULL);
pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
// pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
pthread_mutex_lock(&mutex);
for(k = 0; k < thread_count; k++) {
int * k_copy = stasis_alloc(int);
*k_copy = k ;
pthread_create(&workers[k], &attr, go, k_copy);
}
pthread_mutex_unlock(&mutex);
for(k = 0; k < thread_count; k++) {
pthread_join(workers[k],NULL);
}
double log_multiplier = (COUNTER_RESOLUTION / log(MAX_SECONDS * 1000000000.0));
int total = 0;
for(k = 0; k < COUNTER_RESOLUTION; k++) {
printf("%3.4f\t%d\n", exp(((double)k)/log_multiplier)/1000000000.0, buckets[k]);
total += buckets[k];
}
printf("Total requests %d\n", total);
/* printf("mean: (max, avg) %f, %f\n", max_mean, avg_mean / (double)thread_count);
printf("variance: (max, avg) %f, %f\n", max_var, avg_var / (double)thread_count); */
Tdeinit();
}

View file

@ -0,0 +1,46 @@
#include <stasis/transactional.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char** argv) {
assert(argc == 3);
int xact_count = atoi(argv[1]);
int count = atoi(argv[2]);
int k;
/* unlink("storefile.txt");
unlink("logfile.txt");
unlink("blob0_file.txt");
unlink("blob1_file.txt"); */
Tinit();
int xid = Tbegin();
recordid hash = TlinkedListCreate(xid, sizeof(int), sizeof(int));
Tcommit(xid);
int i = 0;
for(k = 0; k < xact_count; k++) {
xid = Tbegin();
for(;i < count *(k+1) ; i++) {
TlinkedListInsert(xid, hash, (byte*)&i, sizeof(int), (byte*)&i, sizeof(int));
}
Tcommit(xid);
}
Tdeinit();
}

View file

@ -0,0 +1,266 @@
#include <stasis/transactional.h>
#include <stasis/bufferManager.h>
#include <stdio.h>
void alloc_rids(long long num_rids, recordid ** slow, recordid ** fast) {
*slow = stasis_malloc(num_rids, recordid);
*fast = stasis_malloc(num_rids / 10, recordid);
int xid = Tbegin();
byte * old_page = stasis_malloc(PAGE_SIZE, byte);
byte * new_page = stasis_malloc(PAGE_SIZE, byte);
for(long long i = 0; i < num_rids; ) {
pageid_t pid = TpageAlloc(xid);
Page * p = loadPage(xid, pid);
writelock(p->rwlatch,0);
memcpy(old_page, p->memAddr, PAGE_SIZE);
stasis_page_slotted_lsn_free_initialize_page(p);
while(i < num_rids &&
(
((*slow)[i] = stasis_record_alloc_begin(xid, p, sizeof(int))).size
== sizeof(int)
)
) {
stasis_record_alloc_done(xid, p, (*slow)[i]);
if(!(i%10)) {
(*fast)[i/10] = stasis_record_alloc_begin(xid, p, sizeof(int));
if((*fast)[i/10].size!=sizeof(int)) {
break; // don't increment i
}
stasis_record_alloc_done(xid, p, (*fast)[i/10]);
}
assert((*slow)[i].size != -1);
i++;
}
memcpy(new_page, p->memAddr, PAGE_SIZE);
memcpy(p->memAddr, old_page, PAGE_SIZE);
unlock(p->rwlatch);
releasePage(p);
TpageSet(xid, pid, new_page);
}
free(old_page);
free(new_page);
Tcommit(xid);
}
typedef struct {
pageid_t pid;
pageoff_t off;
pageoff_t len;
int val;
} cached_addr;
void build_cache(recordid * rids, cached_addr** cache, long long count) {
*cache = stasis_malloc(count, cached_addr);
lsn_t log_trunc = ((stasis_log_t*)stasis_log())->truncation_point(stasis_log());
for(long long i = 0; i < count; i++) {
(*cache)[i].pid = rids[i].page;
Page * p = loadPage(-1, (*cache)[i].pid);
readlock(p->rwlatch,0);
byte * b = stasis_record_write_begin(-1, p, rids[i]);
(*cache)[i].off = b - p->memAddr;
stasis_record_write_done(-1, p, rids[i], b);
stasis_page_lsn_write(-1, p, log_trunc);
(*cache)[i].len = stasis_record_type_to_size(rids[i].size);
(*cache)[i].val = 0;
unlock(p->rwlatch);
// releasePage(p);
}
}
static int net_latency = 2;
static byte * (*origWrite)(int xid, Page *p, recordid rid);
byte * slowWrite(int xid, Page *p, recordid rid) {
usleep(net_latency * 1000);
return origWrite(xid,p,rid);
}
static const byte * (*origRead)(int xid, Page *p, recordid rid);
const byte * slowRead(int xid, Page *p, recordid rid) {
usleep(net_latency * 1000);
return origRead(xid,p,rid);
}
static int (*original_write_entry) (struct stasis_log_t* log, LogEntry * e);
int my_write_entry(struct stasis_log_t* log, LogEntry *e) {
usleep(net_latency * 1000);
return original_write_entry(log,e);
}
void emulate_remote_log(void) {
original_write_entry = ((stasis_log_t*)stasis_log())->write_entry;
((stasis_log_t*)stasis_log())->write_entry = my_write_entry;
}
void emulate_remote_pages(void) {
origWrite = stasis_page_impl_get(SLOTTED_LSN_FREE_PAGE)->recordWrite;
origRead = stasis_page_impl_get(SLOTTED_LSN_FREE_PAGE)->recordRead;
// xxx a bit of cheating; don't pay latency for lsn write
// (could amortize w/ recordWrite)
stasis_page_impl_get(SLOTTED_LSN_FREE_PAGE)->recordWrite = slowWrite;
stasis_page_impl_get(SLOTTED_LSN_FREE_PAGE)->recordRead = slowRead;
}
/////////// Background workers for parallelizing enqueues to slow logs
typedef struct {
long long num_rids;
long long rid_per_xact;
recordid * rids;
int done;
pthread_mutex_t mut;
} bulk_worker_args;
void* normal_worker(void * ap) {
bulk_worker_args * a = ap;
pthread_mutex_lock(&a->mut);
for(int i = 0; !a->done; i++) {
pthread_mutex_unlock(&a->mut);
struct timeval tv;
gettimeofday(&tv, 0);
long long start = tv.tv_usec + tv.tv_sec * 1000000;
int xid = Tbegin();
for(int j = 0; j < a->rid_per_xact; j++) {
int val = i * a->rid_per_xact + j;
Tset(xid, a->rids[j%a->num_rids], &val);
}
Tcommit(xid);
gettimeofday(&tv, 0);
long long stop = tv.tv_usec + tv.tv_sec * 1000000;
printf("low(ms),%lld\n", stop-start);
fflush(stdout);
pthread_mutex_lock(&a->mut);
}
pthread_mutex_unlock(&a->mut);
return 0;
}
typedef struct {
long long num_rids;
long long rid_per_xact;
cached_addr * cache;
int done;
int xid;
int workerid;
int iterationid;
int divisor;
pthread_mutex_t mut;
} writeback_unit_of_work_arg;
void * writeback_unit_of_work(void * ap) {
writeback_unit_of_work_arg * ua = ap;
stasis_log_reordering_handle_t * rh
= stasis_log_reordering_handle_open(
stasis_transaction_table_get(stasis_runtime_transaction_table(), ua->xid),
stasis_log(),
(0.9*stasis_log_file_write_buffer_size)/ua->divisor,
//512*1024/ua->divisor, // 0.5 mb in log tail at once
1000000/ua->divisor, // max num outstanding requests
(50 * 1024 * 1024)/ua->divisor // max backlog in bytes
);
/*
stasis_log_reordering_handle_open(&stasis_transaction_table[ua->xid%MAX_TRANSACTIONS],
stasis_log_file,
(stasis_log_file_write_buffer_size * 0.25)/ua->divisor,
//512*1024/ua->divisor, // 0.5 mb in log tail at once
1000000/ua->divisor, // max num outstanding requests
(50 * 1024 * 1024)/ua->divisor // max backlog in bytes
);*/
for(int j = 0; j < ua->rid_per_xact/ua->divisor; j++) {
long long idx = (ua->workerid+(ua->divisor*j)) % ua->num_rids;
int old = ua->cache[idx].val;
ua->cache[idx].val = (ua->workerid+(ua->divisor*j));
TsetReorderableWriteBack(ua->xid, rh, ua->cache[idx].pid,
ua->cache[idx].off, ua->cache[idx].len,&ua->cache[idx].val,&old);
// TsetReorderable(ua->xid, rh, a->rids[(j*ua->divisor+ua->n)%a->num_rids], &val);
}
stasis_log_reordering_handle_close(rh);
return 0;
}
typedef struct {
int xid;
int n; // which worker am i?
int i; // which iteration is this?
int divisor;
bulk_worker_args * a;
} unit_of_work_arg;
void * bg_unit_of_work(void * ap) {
unit_of_work_arg * ua = ap;
bulk_worker_args * a = ua->a;
stasis_log_reordering_handle_t * rh
= stasis_log_reordering_handle_open(stasis_transaction_table_get(stasis_runtime_transaction_table(), ua->xid),
stasis_log(),
(stasis_log_file_write_buffer_size * 0.25)/ua->divisor,
//512*1024/ua->divisor, // 0.5 mb in log tail at once
1000000/ua->divisor, // max num outstanding requests
(50 * 1024 * 1024)/ua->divisor // max backlog in bytes
);
for(int j = 0; j < a->rid_per_xact/ua->divisor; j++) {
int val = ua->i * (a->rid_per_xact/ua->divisor) + j;
TsetReorderable(ua->xid, rh, a->rids[(j*ua->divisor+ua->n)%a->num_rids], &val);
}
stasis_log_reordering_handle_close(rh);
return 0;
}
void* bg_worker(void * ap) {
bulk_worker_args * a = ap;
pthread_mutex_lock(&a->mut);
for(int i = 0; !a->done; i++) {
pthread_mutex_unlock(&a->mut);
struct timeval tv;
gettimeofday(&tv, 0);
long long start = tv.tv_usec + tv.tv_sec * 1000000;
int xid = Tbegin();
if(((stasis_log_t*)stasis_log())->write_entry == my_write_entry) {
// based on tweaking; also, normal-net is ~ 100x slower than nromal
int num_worker = 100;
pthread_t workers[num_worker];
unit_of_work_arg args[num_worker];
for(int w = 0; w < num_worker; w++) {
args[i].xid = xid;
args[i].n = w;
args[i].i = i;
args[i].divisor = num_worker;
args[i].a = a;
pthread_create(&workers[w], 0, bg_unit_of_work, &(args[i]));
}
for(int w = 0; w < num_worker; w++) {
pthread_join(workers[w], 0);
}
} else {
unit_of_work_arg unit_arg = {
xid,
0,
i,
1,
ap
};
bg_unit_of_work(&unit_arg);
}
Tcommit(xid);
gettimeofday(&tv, 0);
long long stop = tv.tv_usec + tv.tv_sec * 1000000;
printf("low(ms),%lld\n", stop-start);
fflush(stdout);
pthread_mutex_lock(&a->mut);
}
pthread_mutex_unlock(&a->mut);
return 0;
}

View file

@ -0,0 +1,12 @@
CREATE_EXECUTABLE(dirtyPages)
CREATE_EXECUTABLE(dirtyPage)
CREATE_EXECUTABLE(smallLogEntry)
CREATE_EXECUTABLE(noopTransactions)
CREATE_EXECUTABLE(pinSamePage)
CREATE_EXECUTABLE(pinDifferentPages)
CREATE_EXECUTABLE(hashtableDifferentPages)
CREATE_EXECUTABLE(readLatch)
CREATE_EXECUTABLE(readLatches)
CREATE_EXECUTABLE(writeLatch)
CREATE_EXECUTABLE(writeLatches)
CREATE_EXECUTABLE(arrayList)

View file

@ -0,0 +1,64 @@
#include <stasis/transactional.h>
#include <stasis/bufferManager/pageArray.h>
unsigned long long recsize;
unsigned long long threadcount;
unsigned long long threadops;
recordid arrayList;
void* worker (void* arg) {
intptr_t tid = (intptr_t)arg;
recordid rid = arrayList;
byte val[recsize];
for(int j = 0; j < 10; j++) {
for(unsigned long long i = 0; i < threadops; i++) {
int opcode = i % 10;
if(opcode < 0) {
// insert (nop for now)
} else if (opcode < 10) {
// move
int xid = Tbegin();
for(int i = 0; i < recsize; i++) {
val[i] = ((byte*)&tid)[i&(sizeof(intptr_t)-1)];
}
rid.slot = (tid * threadops) + ((i * 97)%threadops); // bogus...
Tset(xid, rid, val);
Tcommit(xid);
}
}
}
return 0;
}
int main(int argc, char* argv[]) {
char * e;
recsize = strtoull(argv[1],&e,10);
assert(recsize);
assert(!*e);
threadcount = strtoull(argv[2],&e,10);
assert(threadcount);
assert(!*e);
threadops = strtoull(argv[3],&e,10)/(10*threadcount);
assert(threadops);
assert(!*e);
stasis_log_type = LOG_TO_MEMORY;
stasis_buffer_manager_factory = stasis_buffer_manager_mem_array_factory;
pthread_t thread[threadcount];
Tinit();
int xid = Tbegin();
arrayList = TarrayListAlloc(xid, 100, 10, recsize);
TarrayListExtend(xid, arrayList, threadcount * threadops);
Tcommit(xid);
for(intptr_t i = 0; i < threadcount; i++) {
pthread_create(&thread[i],0,worker,(void*)i);
}
for(intptr_t i = 0; i < threadcount; i++) {
pthread_join(thread[i],0);
}
Tdeinit();
}

View file

@ -0,0 +1,57 @@
/*
* dirtyPage.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/transactional.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
stasis_dirty_page_table_t * dpt;
unsigned long numops;
unsigned long numthreads;
Page ** p;
static void* worker(void* arg) {
Page * p = arg;
for(unsigned long i = 0; i < numops; i++) {
writelock(p->rwlatch,0);
stasis_dirty_page_table_set_dirty(dpt, p);
unlock(p->rwlatch);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
Page * p;
Tinit();
dpt = stasis_runtime_dirty_page_table();
p = loadPage(-1,0);
for(int i = 0; i < numthreads; i++) {
pthread_create(&workers[i], 0, worker, p);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
releasePage(p);
Tdeinit();
}

View file

@ -0,0 +1,63 @@
/*
* dirtyPages.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/transactional.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
stasis_dirty_page_table_t * dpt;
unsigned long numops;
unsigned long numthreads;
Page ** p;
static void* worker(void* arg) {
Page * p = arg;
for(unsigned long i = 0; i < numops; i++) {
writelock(p->rwlatch,0);
stasis_dirty_page_table_set_dirty(dpt, p);
unlock(p->rwlatch);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
p = stasis_malloc(numthreads, Page*);
Tinit();
dpt = stasis_runtime_dirty_page_table();
for(int i = 0; i < numthreads; i++) {
p[i] = loadPage(-1, i);
}
for(int i = 0; i < numthreads; i++) {
pthread_create(&workers[i], 0, worker, p[i]);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
for(int i = 0; i < numthreads; i++) {
releasePage(p[i]);
}
Tdeinit();
}

View file

@ -0,0 +1,54 @@
/*
* hashtableDifferentPages.c
*
* Created on: Oct 19, 2009
* Author: sears
*/
#include <stasis/util/concurrentHash.h>
#include <stasis/transactional.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
unsigned long numops;
hashtable_t * ht;
static void* worker(void* arg) {
pageid_t pid = *(pageid_t*)arg;
hashtable_insert(ht, pid, &pid);
for(unsigned long i = 0; i < numops; i++) {
void * ptr = hashtable_lookup(ht, pid);
assert(ptr == &pid);
// Page * p = loadPage(-1, pid);
// releasePage(p);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
pageid_t pids[numthreads];
ht = hashtable_init(numthreads * 10);
for(int i = 0; i < numthreads; i++) {
pids[i] = i*2 ;
pthread_create(&workers[i], 0, worker, &pids[i]);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
hashtable_deinit(ht);
}

View file

@ -0,0 +1,22 @@
#!/usr/bin/perl -w
use strict;
my @in = `cd $ARGV[0]; ls *.c`;
my $out = $ARGV[1];
my $N = $ARGV[2];
chomp $out;
foreach my $line (@in) {
chomp $line;
$line =~ s/\..+//g;
open OUT, "> $out/$line.script";
print OUT "#!/usr/bin/env timer.pl\n";
for my $i (qw(1 2 4 8 16)) {
print OUT "./$line $i $N\n";
`chmod +x $out/$line.script`;
}
close OUT;
}

View file

@ -0,0 +1,43 @@
/*
* noopTransactions.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/transactional.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
static void* noopWorker(void* arg) {
unsigned long numops = *(unsigned long*) arg;
for(unsigned long i = 0; i < numops; i++) {
int xid = Tbegin();
TsoftCommit(xid);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
Tinit();
for(int i = 0; i < numthreads; i++) {
pthread_create(&workers[i], 0, noopWorker, &numops);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
Tdeinit();
}

View file

@ -0,0 +1,51 @@
/*
* pinDifferentPages.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/transactional.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
unsigned long numops;
static void* worker(void* arg) {
pageid_t pid = *(pageid_t*)arg;
for(unsigned long i = 0; i < numops; i++) {
Page * p = loadPage(-1, pid+i);
releasePage(p);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
pageid_t pids[numthreads];
Tinit();
for(int i = 0; i < numthreads; i++) {
pids[i] = i * numops;
pthread_create(&workers[i], 0, worker, &pids[i]);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
Tdeinit();
}

View file

@ -0,0 +1,49 @@
/*
* pinSamePage.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/transactional.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
stasis_log_t * l;
static void* worker(void* arg) {
unsigned long numops = *(unsigned long*) arg;
for(unsigned long i = 0; i < numops; i++) {
Page * p = loadPage(-1, 0);
releasePage(p);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
Tinit();
for(int i = 0; i < numthreads; i++) {
pthread_create(&workers[i], 0, worker, &numops);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
Tdeinit();
}

View file

@ -0,0 +1,38 @@
#include <stasis/util/rw.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
rwl * l;
static void* worker(void* arg) {
unsigned long numops = *(unsigned long*) arg;
for(unsigned long i = 0; i < numops; i++) {
readlock(l, 0);
unlock(l);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
l = initlock();
for(int i = 0; i < numthreads; i++) {
pthread_create(&workers[i], 0, worker, &numops);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
}

View file

@ -0,0 +1,44 @@
/*
* uncontestedReadLatches.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/util/rw.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
unsigned long numops;
static void* worker(void* arg) {
rwl * l = arg;
for(unsigned long i = 0; i < numops; i++) {
readlock(l, 0);
unlock(l);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
rwl * l[numthreads];
for(int i = 0; i < numthreads; i++) {
l[i] = initlock();
pthread_create(&workers[i], 0, worker, l[i]);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
}

View file

@ -0,0 +1,60 @@
/*
* smallLogEntry.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/logger/logger2.h>
#include <stasis/logger/safeWrites.h>
#include <stasis/logger/filePool.h>
#include <stasis/logger/inMemoryLog.h>
#include <stasis/flags.h>
#include <stasis/constants.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
stasis_log_t * l;
static void* worker(void* arg) {
unsigned long numops = *(unsigned long*) arg;
for(unsigned long i = 0; i < numops; i++) {
LogEntry * e = allocUpdateLogEntry(l, -1, -1, OPERATION_NOOP, 0, 0);
l->write_entry(l, e);
l->write_entry_done(l, e);
l->force_tail(l, LOG_FORCE_COMMIT);
// if(! (i & 1023)) { l->force_tail(l, 0);}
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
if(stasis_log_type == LOG_TO_FILE) {
l = stasis_log_safe_writes_open(stasis_log_file_name, stasis_log_file_mode, stasis_log_file_permissions, 0);
} else if(stasis_log_type == LOG_TO_DIR) {
l = stasis_log_file_pool_open(stasis_log_dir_name, stasis_log_file_mode, stasis_log_file_permissions);
} else {
l = stasis_log_impl_in_memory_open();
}
for(int i = 0; i < numthreads; i++) {
int err = pthread_create(&workers[i], 0, worker, &numops);
assert(!err);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
l->close(l);
}

View file

@ -0,0 +1,44 @@
/*
* writeLatch.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/util/rw.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
rwl * l;
static void* worker(void* arg) {
unsigned long numops = *(unsigned long*) arg;
for(unsigned long i = 0; i < numops; i++) {
writelock(l, 0);
unlock(l);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
l = initlock();
for(int i = 0; i < numthreads; i++) {
pthread_create(&workers[i], 0, worker, &numops);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
}

View file

@ -0,0 +1,44 @@
/*
* writeLatches.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/util/rw.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
unsigned long numops;
static void* worker(void* arg) {
rwl * l = arg;
for(unsigned long i = 0; i < numops; i++) {
writelock(l, 0);
unlock(l);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
rwl * l[numthreads];
for(int i = 0; i < numthreads; i++) {
l[i] = initlock();
pthread_create(&workers[i], 0, worker, l[i]);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
}

41
benchmarks/naiveHash.c Normal file
View file

@ -0,0 +1,41 @@
#include <stasis/transactional.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char** argv) {
assert(argc == 3);
int xact_count = atoi(argv[1]);
int count = atoi(argv[2]);
/* unlink("storefile.txt");
unlink("logfile.txt");
unlink("blob0_file.txt");
unlink("blob1_file.txt");*/
Tinit();
int xid = Tbegin();
recordid hash = TnaiveHashCreate(xid, sizeof(int), sizeof(int));
Tcommit(xid);
int i = 0;
int k;
for(k = 0; k < xact_count; k++) {
xid = Tbegin();
for(; i < (count*(k+1)) ; i++) {
TnaiveHashInsert(xid, hash, &i, sizeof(int), &i, sizeof(int));
}
Tcommit(xid);
}
Tdeinit();
}

Some files were not shown because too many files have changed in this diff Show more