Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Onder Kalaci committed Jun 8, 2014
1 parent c2ab4b5 commit 0189fae
Show file tree
Hide file tree
Showing 12 changed files with 2,273 additions and 0 deletions.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,67 @@ dyndatarace
===========

Dynamic Data Race Detection

Four different pintools are under the folder "pintools". Their names are self explanatory.


===========
Inputs for httpd and pbzip2 is under "inputs" folder. We do not include the inputs for PARSEC 3.0 benchmark applications.
They are already freely avalible on the web "parsec.cs.princeton.edu/download.htm".

1) inputs/httpd:
a) index.html is the 8.3k static web page that is used in the experiments.
b) generator.py is the script that generates the clients which connect to the httpd web server, and GETs the 8.3k web page.
c) executeHTTPDTest.py is the script that executes httpd web server with insturmentation, and writes the results to a file.

2) inputs/pbzip
a) executePBZIPTest.py is the script that executes pbzip compressor with insturmentation, and writes the results to a file.
b) example.txt is the file that is used as the input to the pbzip2 compression tool.
c) generator.py is the script that is used to generate some other input files for different tests.

3) inputs/parsec
a) As already mentioned, we do not include the inputs for parsec 3.0, which are already freely avalible on the web "parsec.cs.princeton.edu/download.htm".
b) How to run parsec experiments:
i) Firstly, set the directories for parsec and pin executable from the first two lines of the script. (PARSEC_DIR and PIN_EXECUTABLE variables)
ii) Add the following lines to the for loop on the 296th line of the script:

For lockset implementataion: example.executeOurImpelemtation("purelocset", "PureLocksetImp.so",{} , "purelockset_")
For hb implementataion: example.executeOurImpelemtation("purehb", "PureHappensBeforeImp.so",{}, "purehb_")
For hybrid implementataion with no optimizations enabled: example.executeOurImpelemtation("hybrid", "SegmentBasedHybridImp.so",{} , "tsan_1_0")
iii) How to execute segment based hybird implementation with optimizations:
Add optimizations with values to the "executeOurImpelemtation" call as the 3rd input.

Optimization 1 :maxVCHistoryCount
Optimization 2: enable_signle_access
Optimization 3: segmentCountForThisExecution (this must be given relative to total segment count in the original execution. Refer to the paper.)
Optimization 4: sample_rate


example.executeOurImpelemtation("hybrid", "SegmentBasedHybridImp.so",{ "enable_signle_access" : ""}, "tsan_131072_1")
example.executeOurImpelemtation("hybrid", "SegmentBasedHybridImp.so",{"maxVCHistoryCount" :100] } , "tsan_1_0")
example.executeOurImpelemtation("hybrid", "SegmentBasedHybridImp.so",{"sample_rage" :0.1] } , "tsan_1_0")
executeOurImpelemtation("hybrid", "SegmentBasedHybridImp.so",{"max_single_segment_set_size":12000 } , "tsan_1_0")
or combinations:
example.executeOurImpelemtation("hybrid", "SegmentBasedHybridImp.so",{"max_single_segment_set_size":segmentCountForThisExecution, "enable_signle_access" : "", "sample_rate" :str(SAMPLE_RATES[counter]) } , "tsan_1_0")

c)How to get output
Fourth parameter given to "executeOurImpelemtation" is the file where the outputs are written for each application.
Moreover, in the end, a file with name format "HH:MM:SS_DD_MM_YYYY_execution_history.txt" is written, which includes all the test results executed with "executeOurImpelemtation" function call. This file is an XML file, which is easy to read and understand.
ie:
<OWN>
<RACE_COUNT>0</RACE_COUNT>
<ALGORITHM>hybrid</ALGORITHM>
<maxVCHistoryCount>10</maxVCHistoryCount>
<APP_NAME>swaptions</APP_NAME>
<segment_history_table_size>63.6363636364</segment_history_table_size>
<TIME>70.6933810711</TIME>
<INPUT_TYPE>simsmall</INPUT_TYPE>
<enable_signle_access/>
</OWN>




===========

Binary file added pintools/EmptyImp.so
Binary file not shown.
Binary file added pintools/PureHappensBeforeImp.so
Binary file not shown.
Binary file added pintools/PureLocksetImp.so
Binary file not shown.
Binary file added pintools/SegmentBasedHybridImp.so
Binary file not shown.
59 changes: 59 additions & 0 deletions pintools/inputs/httpd/executeHTTPDTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/python
import os
import sys
import time

DEBUG_MODE = False
PIN_EXECUTABLE = "/home/onder/Desktop/PIN/pin-2.12-56759-gcc.4.4.7-linux/pin -follow_execv "
KILLHTTPD = " sudo killall -SIGINT apache2"
HTTPDSTARTCOMMAND = "sudo /usr/sbin/apache2ctl -X "
CLIENT_COUNT = "20"
REQUEST_COUNT = "100"
GENERATOREXECUTER = "./generator.py -n " + CLIENT_COUNT + " -c " + REQUEST_COUNT

sharedObjectList = ["PureLocksetImp.so", "ThreadSanitizerImp.so", "PureHappensBeforeImp.so"]



def killHTTPD():
os.system(KILLHTTPD)


def findExactTotalRace(fileName):
totalCount = 0
f = open(fileName, "r")
lines = f.readlines()
for line in lines:
if line.find("totalRaceCount:") != -1:
totalCount = totalCount + int(line.split(":")[1])

return str(totalCount)


def executePIN():


f = open("execution_history.txt", "w")
for sharedObject in sharedObjectList:
killHTTPD()
sharedObjectName = sharedObject.split(".")[0]
strToExecute = PIN_EXECUTABLE + " -t ../" + sharedObject + " -- " + HTTPDSTARTCOMMAND + " > " + sharedObjectName + "_httpd.txt 2>&1 &"


os.system(strToExecute)
os.system("sleep 20")
print "apache2 started...."
startTime = time.time()
os.system(GENERATOREXECUTER)
endTime = time.time()
totalTime = str( endTime - startTime)
killHTTPD()
print "killed apache"
os.system("sleep 3")
f.write("************************\n")
strToWrite = sharedObjectName + " time : " + totalTime + " race:" + findExactTotalRace( sharedObjectName + "_httpd.txt")
f.write(strToWrite)
f.write("\n************************\n")
f.close()
executePIN()

54 changes: 54 additions & 0 deletions pintools/inputs/httpd/generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/python

import sys,getopt,threading,time
import urllib2



threadcount = ''
connectioncount = ''

def argParser(argv):
global connectioncount, threadcount
try:
opts, args = getopt.getopt(argv,"hn:c:",["threadcount=","connectioncount="])
except getopt.GetoptError:
print 'test.py -n <threadcount> -c <connectioncount>'
sys.exit(2)
for opt, arg in opts:
print opt, arg
if opt == '-h':
print 'test.py -n <threadcount> -c <connectioncount>'
sys.exit()
elif opt in ("-n", "--threadcount"):
threadcount = arg
elif opt in ("-c", "--connectioncount"):
connectioncount = arg


class Connector(threading.Thread):
def __init__(self, connectionCount):
threading.Thread.__init__(self)
self.connectioncount = connectionCount

def run(self):
try:
for i in range(0, int(self.connectioncount)):
time.sleep(0.1)
req = urllib2.Request('http://127.0.0.1')
r = urllib2.urlopen(req)
if len(r.read()) != 8484:
print "OOOPS error"
except Exception,e:
print "%s",e
if __name__ == "__main__":
argParser(sys.argv[1:])
print 'threadcount', threadcount
print 'connectioncount', connectioncount
allConnectors = []
for i in range(0, int(threadcount)):
tmp = Connector(connectioncount)
allConnectors.append(tmp)

for connector in allConnectors:
connector.start()
179 changes: 179 additions & 0 deletions pintools/inputs/httpd/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Learn Center</title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
<link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
<link rel="stylesheet" href="css/style.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.5.2.js" ></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/cufon-replace.js"></script>
<script type="text/javascript" src="js/Molengo_400.font.js"></script>
<script type="text/javascript" src="js/Expletus_Sans_400.font.js"></script>
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<style type="text/css">.bg, .box2{behavior:url("js/PIE.htc");}</style>
<![endif]-->
</head>
<body id="page1">
<div class="body1">
<div class="main">
<!-- header -->
<header>
<div class="wrapper">
<nav>
<ul id="menu">
<li><a href="index.html">About</a></li>
<li><a href="courses.html">Courses</a></li>
<li><a href="programs.html">Programs</a></li>
<li><a href="teachers.html">Teachers</a></li>
<li><a href="admissions.html">Admissions</a></li>
<li class="end"><a href="contacts.html">Contacts</a></li>
</ul>
</nav>
<ul id="icon">
<li><a href="#"><img src="images/icon1.jpg" alt=""></a></li>
<li><a href="#"><img src="images/icon2.jpg" alt=""></a></li>
<li><a href="#"><img src="images/icon3.jpg" alt=""></a></li>
</ul>
</div>
<div class="wrapper">
<h1><a href="index.html" id="logo">Learn Center</a></h1>
</div>
<div id="slogan"> We Will Open The World<span>of knowledge for you!</span> </div>
<ul class="banners">
<li><a href="#"><img src="images/banner1.jpg" alt=""></a></li>
<li><a href="#"><img src="images/banner2.jpg" alt=""></a></li>
<li><a href="#"><img src="images/banner3.jpg" alt=""></a></li>
</ul>
</header>
<!-- / header -->
</div>
</div>
<div class="body2">
<div class="main">
<!-- content -->
<section id="content">
<div class="wrapper">
<div class="pad1 pad_top1">
<article class="cols marg_right1">
<figure><a href="#"><img src="images/page1_img1.jpg" alt=""></a></figure>
<span class="font1">Our Mission Statement</span> </article>
<article class="cols marg_right1">
<figure><a href="#"><img src="images/page1_img2.jpg" alt=""></a></figure>
<span class="font1">Performance Report</span> </article>
<article class="cols">
<figure><a href="#"><img src="images/page1_img3.jpg" alt=""></a></figure>
<span class="font1">Prospective Parents</span> </article>
</div>
</div>
<div class="box1">
<div class="wrapper">
<article class="col1">
<div class="pad_left1">
<h2>Welcome to Our Center</h2>
<p class="font2">Learn Center is one of free website templates created by <span>TemplateMonster.com team</span></p>
<p><strong>Learn Center Template</strong> is optimized for 1024X768 screen resolution. It’s also XHTML &amp; CSS valid. This website template has several pages: <a href="courses.html">Courses</a>, <a href="programs.html">Programs</a>, <a href="teachers.html">Teachers</a>, <a href="admissions.html">Admissions</a>, <a href="contacts.html">Contacts</a> (note that contact us form – doesn’t work).</p>
</div>
<a href="#" class="button"><span><span>Read More</span></span></a>
<div class="pad_left1">
<h2>Individual Approach to Education!</h2>
</div>
<div class="wrapper">
<figure class="left marg_right1"><img src="images/page1_img4.jpg" alt=""></figure>
<p class="pad_bot1 pad_top2"><strong>Lorem ipsum dolor sit amet, consectetur adipisicing eiusmod tempor incididunt ut labore.</strong></p>
<p> Learn Center Template goes with two packages – with PSD source files and without them. PSD source files are available for free for the registered members of Templates.com. The basic package (without PSD source is available for anyone without registration).</p>
</div>
<div class="pad_top2"> <a href="#" class="button"><span><span>Read More</span></span></a> </div>
</article>
<article class="col2 pad_left2">
<div class="pad_left1">
<h2>New Programs</h2>
</div>
<ul class="list1">
<li><a href="#">International Studies</a></li>
<li><a href="#">Models &amp; Language Reaching</a></li>
<li><a href="#">Public School Facts</a></li>
<li><a href="#">State Testing Data</a></li>
<li><a href="#">Education Jobs</a></li>
</ul>
<div class="pad_left1">
<h2>Latest News</h2>
</div>
<div class="wrapper"> <span class="date">27</span>
<p class="pad_top2"><a href="#">April, 2011</a><br>
Sed utirspiciatis unde omnis iste natus error sit...</p>
</div>
<div class="wrapper"> <span class="date">25</span>
<p class="pad_top2"><a href="#">April, 2011</a><br>
Voluptatem accusan dolore mque laudantium...</p>
</div>
<div class="pad_top2"> <a href="#" class="button"><span><span>Read More</span></span></a> </div>
</article>
</div>
</div>
</section>
<!-- content -->
<!-- footer -->
<footer>
<div class="wrapper">
<div class="pad1">
<div class="pad_left1">
<div class="wrapper">
<article class="col_1">
<h3>Address:</h3>
<p class="col_address"><strong>Country:<br>
City:<br>
Address:<br>
Email:</strong></p>
<p>USA<br>
San Diego<br>
Beach st. 54<br>
<a href="#">lcenter@mail.com</a></p>
</article>
<article class="col_2 pad_left2">
<h3>Join In:</h3>
<ul class="list2">
<li><a href="#">Sign Up</a></li>
<li><a href="#">Forums</a></li>
<li><a href="#">Promotions</a></li>
<li><a href="#">Lorem</a></li>
</ul>
</article>
<article class="col_3 pad_left2">
<h3>Why Us:</h3>
<ul class="list2">
<li><a href="#">Lorem ipsum dolor </a></li>
<li><a href="#">Aonsect adipisic</a></li>
<li><a href="#">Eiusmjkod tempor </a></li>
<li><a href="#">Incididunt ut labore </a></li>
</ul>
</article>
<article class="col_4 pad_left2">
<h3>Newsletter:</h3>
<form id="newsletter" action="#" method="post">
<div class="wrapper">
<div class="bg">
<input type="text">
</div>
</div>
<a href="#" class="button"><span><span><strong>Subscribe</strong></span></span></a>
</form>
</article>
</div>
<div class="wrapper">
<article class="call"> <span class="call1">Call Us Now: </span><span class="call2">1-800-567-8934</span> </article>
<article class="col_4 pad_left2">Copyright &copy; <a href="#">Domain Name</a> All Rights Reserved<br>
Design by <a target="_blank" href="http://www.templatemonster.com/">TemplateMonster.com</a></article>
</div>
</div>
</div>
</div>
</footer>
<!-- / footer -->
</div>
</div>
<script type="text/javascript">Cufon.now();</script>
<div align=center>This template downloaded form <a href='http://all-free-download.com/free-website-templates/'>free website templates</a></div></body>
</html>
Loading

0 comments on commit 0189fae

Please sign in to comment.