1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 19:01:15 +01:00

Merge pull request #162 from chase-qi/add-blogbench-workload

workloads: add blogbench workload
This commit is contained in:
Sebastian Goscik 2016-05-24 09:55:37 +01:00
commit eaf4d02aea
4 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,15 @@
/*
* Copyright (c) 2005-2010 Frank Denis <j at pureftpd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

View File

@ -0,0 +1,75 @@
# Copyright 2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# pylint: disable=attribute-defined-outside-init
import os
from wlauto import Workload, Parameter, Executable
class Blogbench(Workload):
name = 'blogbench'
description = """
Blogbench is a portable filesystem benchmark that tries to reproduce the
load of a real-world busy file server.
Blogbench stresses the filesystem with multiple threads performing random
reads, writes and rewrites in order to get a realistic idea of the
scalability and the concurrency a system can handle.
Source code are available from:
https://download.pureftpd.org/pub/blogbench/
"""
parameters = [
Parameter('iterations', kind=int, default=30,
description='The number of iterations to run')
]
def setup(self, context):
host_binary = context.resolver.get(Executable(self, self.device.abi,
'blogbench'))
self.binary = self.device.install_if_needed(host_binary)
# Total test duration equal to iteration*frequency
# The default frequency is 10 seconds, plus 5 here as a buffer.
self.timeout = self.iterations * 15
# An empty and writable directory is needed.
self.directory = self.device.path.join(self.device.working_directory,
'blogbench')
self.device.execute('rm -rf {}'.format(self.directory), timeout=300)
self.device.execute('mkdir -p {}'.format(self.directory))
self.results = self.device.path.join(self.device.working_directory,
'blogbench.output')
self.command = ('{} --iterations {} --directory {} > {}'
.format(self.binary, self.iterations, self.directory,
self.results))
def run(self, context):
self.output = self.device.execute(self.command, timeout=self.timeout)
def update_result(self, context):
host_file = os.path.join(context.output_directory, 'blogbench.output')
self.device.pull_file(self.results, host_file)
with open(host_file, 'r') as blogbench_output:
for line in blogbench_output:
if any('Final score for ' + x in line
for x in ['writes', 'reads']):
line = line.split(':')
metric = line[0].lower().strip().replace(' ', '_')
score = int(line[1].strip())
context.result.add_metric(metric, score, 'blogs')
def finalize(self, context):
self.device.execute('rm -rf {}'.format(self.directory), timeout=300)

Binary file not shown.

Binary file not shown.