1*96c8483aSYuri Pankov#
2*96c8483aSYuri Pankov# CDDL HEADER START
3*96c8483aSYuri Pankov#
4*96c8483aSYuri Pankov# The contents of this file are subject to the terms of the
5*96c8483aSYuri Pankov# Common Development and Distribution License (the "License").
6*96c8483aSYuri Pankov# You may not use this file except in compliance with the License.
7*96c8483aSYuri Pankov#
8*96c8483aSYuri Pankov# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*96c8483aSYuri Pankov# or http://www.opensolaris.org/os/licensing.
10*96c8483aSYuri Pankov# See the License for the specific language governing permissions
11*96c8483aSYuri Pankov# and limitations under the License.
12*96c8483aSYuri Pankov#
13*96c8483aSYuri Pankov# When distributing Covered Code, include this CDDL HEADER in each
14*96c8483aSYuri Pankov# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*96c8483aSYuri Pankov# If applicable, add the following below this CDDL HEADER, with the
16*96c8483aSYuri Pankov# fields enclosed by brackets "[]" replaced with your own identifying
17*96c8483aSYuri Pankov# information: Portions Copyright [yyyy] [name of copyright owner]
18*96c8483aSYuri Pankov#
19*96c8483aSYuri Pankov# CDDL HEADER END
20*96c8483aSYuri Pankov#
21*96c8483aSYuri Pankov
22*96c8483aSYuri Pankov#
23*96c8483aSYuri Pankov# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*96c8483aSYuri Pankov#
25*96c8483aSYuri Pankov
26*96c8483aSYuri Pankovsub pre_run {
27*96c8483aSYuri Pankov	# Initialize filebench to appropriate personality, create files
28*96c8483aSYuri Pankov	# and processes
29*96c8483aSYuri Pankov	op_init();
30*96c8483aSYuri Pankov
31*96c8483aSYuri Pankov	# The op_load command automatically creates files
32*96c8483aSYuri Pankov	op_load(conf_reqval("personality"));
33*96c8483aSYuri Pankov
34*96c8483aSYuri Pankov	# Flush the FS cache
35*96c8483aSYuri Pankov	op_command("system \"" . get_FILEBENCH() . "/scripts/fs_flush " . conf_reqval("filesystem") . " " . conf_reqval("dir") . "\"");
36*96c8483aSYuri Pankov
37*96c8483aSYuri Pankov	# Initialise statistics and argument arrays
38*96c8483aSYuri Pankov	@ext_stats=();
39*96c8483aSYuri Pankov	@file_stats=();
40*96c8483aSYuri Pankov	@arg_stats=();
41*96c8483aSYuri Pankov}
42*96c8483aSYuri Pankov
43*96c8483aSYuri Pankovsub post_run {
44*96c8483aSYuri Pankov	my $statsbase = get_STATSBASE();
45*96c8483aSYuri Pankov	# Shutdown processes and quit filebench
46*96c8483aSYuri Pankov	op_quit();
47*96c8483aSYuri Pankov	# Create a html summary of the run
48*96c8483aSYuri Pankov	system ("cd $statsbase; " . get_FILEBENCH() . "/scripts/filebench_compare $statsbase")
49*96c8483aSYuri Pankov}
50*96c8483aSYuri Pankov
51*96c8483aSYuri Pankovsub bm_run {
52*96c8483aSYuri Pankov	my $runtime = conf_reqval("runtime");
53*96c8483aSYuri Pankov	my $fs = get_CONFNAME();
54*96c8483aSYuri Pankov
55*96c8483aSYuri Pankov	# The following array must not contain empty values ! This causes the
56*96c8483aSYuri Pankov	# statistics scripts to miss arguments !
57*96c8483aSYuri Pankov	# Clear, run the benchmark, snap statistics
58*96c8483aSYuri Pankov	# This command will also run external statistics (supplied in an array)
59*96c8483aSYuri Pankov	# if desired
60*96c8483aSYuri Pankov	# Statistics automatically dumped into directory matching stats
61*96c8483aSYuri Pankov	# profile variable
62*96c8483aSYuri Pankov	# <stats>/<hostname>-<date-time>/<personality>
63*96c8483aSYuri Pankov
64*96c8483aSYuri Pankov	# create processes and start run, then collect statistics
65*96c8483aSYuri Pankov	op_stats($runtime,"stats.$fs",@ext_stats,@file_stats,@arg_stats);
66*96c8483aSYuri Pankov}
67*96c8483aSYuri Pankov
68*96c8483aSYuri Pankov1;
69