Skip to content

Commit

Permalink
Add method to get list of frameworks, take out list of frameworks. Ad…
Browse files Browse the repository at this point in the history
…d output of commit_count to results.json under rawData.commitCounts
  • Loading branch information
haleyyoung committed Jul 24, 2013
1 parent eb74f22 commit 22691d2
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 115 deletions.
157 changes: 51 additions & 106 deletions benchmarker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ def run_list_tests(self):

for test in all_tests:
print str(test.sort) + ": " + test.name

self.__finish()

############################################################
# End run_list_tests
############################################################
Expand Down Expand Up @@ -232,6 +229,45 @@ def __gather_tests(self):
# End __gather_tests
############################################################

############################################################
# Gathers all the frameworks
############################################################
def __gather_frameworks(self):
frameworks = []
# Loop through each directory (we assume we're being run from the benchmarking root)
for dirname, dirnames, filenames in os.walk('.'):
# Look for the benchmark_config file, this will contain our framework name
# It's format looks like this:
#
# {
# "framework": "nodejs",
# "tests": [{
# "default": {
# "setup_file": "setup",
# "json_url": "/json"
# },
# "mysql": {
# "setup_file": "setup",
# "db_url": "/mysql",
# "query_url": "/mysql?queries="
# },
# ...
# }]
# }
if 'benchmark_config' in filenames:
config = None
with open(os.path.join(dirname, 'benchmark_config'), 'r') as config_file:
# Load json file into config object
config = json.load(config_file)
if config == None:
continue
frameworks.append(str(config['framework']))

return frameworks
############################################################
# End __gather_frameworks
############################################################

############################################################
# Makes any necessary changes to the server that should be
# made before running the tests. This involves setting kernal
Expand Down Expand Up @@ -392,16 +428,14 @@ def __run_tests(self, tests):
# are needed.
############################################################
def __parse_results(self, tests):
# Run the method to get the commmit count of each framework.
self.__count_commits()

# Time to create parsed files
# Aggregate JSON file
with open(os.path.join(self.full_results_directory(), "results.json"), "w") as f:
f.write(json.dumps(self.results))

# Run the method to get the commmit count of each framework.
self.__count_commits()

with open(os.path.join(self.full_results_directory(), "commits.json"), "w") as f:
f.write(json.dumps(self.commits))

# JSON CSV
# with open(os.path.join(self.full_results_directory(), "json.csv"), 'wb') as csvfile:
Expand Down Expand Up @@ -444,108 +478,19 @@ def __parse_results(self, tests):
# __count_commits
############################################################
def __count_commits(self):
all_folders = [
"aspnet",
"aspnet-stripped",
"beego",
"bottle",
"cake",
"compojure",
"cowboy",
"cpoll_cppsp",
"dancer",
"dart",
"django",
"django-stripped",
"dropwizard",
"elli",
"express",
"finagle",
"flask",
"gemini",
"go",
"grails",
"grizzly-bm",
"grizzly-jersey",
"hapi",
"http-kit",
"HttpListener",
"jester",
"kelp",
"lapis",
"lift-stateless",
"luminus",
"mojolicious",
"nancy",
"netty",
"nodejs",
"onion",
"openresty",
"php",
"php-codeigniter",
"php-fuel",
"php-kohana",
"php-laravel",
"php-lithium",
"php-micromvc",
"php-phalcon",
"php-phalcon-micro",
"php-silex",
"php-silex-orm",
"php-silica",
"php-slim",
"php-symfony2",
"php-yaf",
"phreeze",
"plack",
"plain",
"play1",
"play1siena",
"play-java",
"play-java-jpa",
"play-scala",
"play-scala-mongodb",
"play-slick",
"rack",
"rails",
"rails-stripped",
"restexpress",
"revel",
"revel-jet",
"revel-qbs",
"ringojs",
"ringojs-convenient",
"scalatra",
"servicestack",
"servlet",
"sinatra",
"snap",
"spark",
"spray",
"spring",
"tapestry",
"tornado",
"treefrog",
"undertow",
"unfiltered",
"vertx",
"wai",
"webgo",
"web-simple",
"wicket",
"wsgi",
"yesod"
]

jsonResult = {"commitCount":{}}

for framework in all_folders:
all_frameworks = self.__gather_frameworks()

jsonResult = {}

for framework in all_frameworks:
try:
command = "echo $(git rev-list --count HEAD -- " + framework + ")"
command = "git rev-list HEAD -- " + framework + " | sort -u | wc -l"
commitCount = subprocess.check_output(command, shell=True)
jsonResult["commitCount"][framework] = int(commitCount)
jsonResult[framework] = int(commitCount)
except:
continue

self.results['rawData']['commitCounts'] = jsonResult
self.commits = jsonResult
############################################################
# End __count_commits
Expand Down
4 changes: 2 additions & 2 deletions cake/deploy/cake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<VirtualHost *:8080>
Alias /cake/ "/home/ubuntu/FrameworkBenchmarks/cake/app/webroot/"
<Directory /home/ubuntu/FrameworkBenchmarks/cake/app/webroot/>
Alias /cake/ "/home/hyoung/FrameworkBenchmarks/cake/app/webroot/"
<Directory /home/hyoung/FrameworkBenchmarks/cake/app/webroot/>
Options Indexes FollowSymLinks MultiViews
#AllowOverride None
Order allow,deny
Expand Down
2 changes: 1 addition & 1 deletion cake/deploy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ http {
# proxy_pass http://127.0.0.1;
#}

root /home/ubuntu/FrameworkBenchmarks/cake/app/webroot/;
root /home/hyoung/FrameworkBenchmarks/cake/app/webroot/;
index index.php;

location / {
Expand Down
4 changes: 2 additions & 2 deletions django/hello/hello/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'NAME': 'hello_world', # Or path to database file if using sqlite3.
'USER': 'benchmarkdbuser', # Not used with sqlite3.
'PASSWORD': 'benchmarkdbpass', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
'CONN_MAX_AGE': 30,
}
Expand Down Expand Up @@ -109,7 +109,7 @@
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"/home/ubuntu/FrameworkBenchmarks/django/hello/templates",
"/home/hyoung/FrameworkBenchmarks/django/hello/templates",
)

INSTALLED_APPS = (
Expand Down
2 changes: 1 addition & 1 deletion gemini/Docroot/WEB-INF/resin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</server>

<host>
<web-app id="/" root-directory="/home/ubuntu/FrameworkBenchmarks/gemini/Docroot" />
<web-app id="/" root-directory="/home/hyoung/FrameworkBenchmarks/gemini/Docroot" />
</host>

</cluster>
Expand Down
2 changes: 1 addition & 1 deletion php/deploy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ http {
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /home/pfalls/FrameworkBenchmarks/php;
root /home/hyoung/FrameworkBenchmarks/php;
fastcgi_pass fastcgi_backend;
# fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
Expand Down
4 changes: 2 additions & 2 deletions php/deploy/php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<VirtualHost *:8080>
Alias /php/ "/home/pfalls/FrameworkBenchmarks/php/"
<Directory /home/pfalls/FrameworkBenchmarks/php/>
Alias /php/ "/home/hyoung/FrameworkBenchmarks/php/"
<Directory /home/hyoung/FrameworkBenchmarks/php/>
Options Indexes FollowSymLinks MultiViews
#AllowOverride None
Order allow,deny
Expand Down

0 comments on commit 22691d2

Please sign in to comment.