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