xref: /onnv-gate/usr/src/cmd/filebench/workloads/ratelimcopyfiles.f (revision 9801:4a9784073e11)
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# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26# RateLimCopyFiles.f uses the iopslimit flowop with the target attribute
27# set to the writewholefile flowop to limit the rate to one writewholefile
28# operation per event. Without the target attribute set, the limit will
29# be one writewholefile OR readwholefile operation per event, so in effect
30# it will run at half the rate. Without the target attribute, this workload
31# is identical to copyfiles.f. Set the event generator rate by setting
32# the $eventrate variable, for instance by typing:
33#     set $eventrate=20
34# at the go_filebench prompt to get twenty events per second.
35#
36
37# $dir - directory for datafiles
38# $eventrate - event generator rate (0 == free run)
39# $filesize - size of data file
40# $iosize - size of each I/O request
41# $nfiles - number of files in the fileset
42# $nthreads - number of worker threads
43
44set $dir=/tmp
45set $eventrate=10
46set $dirwidth=20
47set $filesize=16k
48set $iosize=1m
49set $nfiles=1000
50set $nthreads=1
51
52eventgen rate=$eventrate
53set mode quit firstdone
54
55define fileset name=bigfileset,path=$dir,size=$filesize,entries=$nfiles,dirwidth=$dirwidth,prealloc=100
56define fileset name=destfiles,path=$dir,size=$filesize,entries=$nfiles,dirwidth=$dirwidth
57
58define process name=filereader,instances=1
59{
60  thread name=filereaderthread,memsize=10m,instances=$nthreads
61  {
62    flowop openfile name=openfile1,filesetname=bigfileset,fd=1
63    flowop readwholefile name=readfile1,fd=1,iosize=$iosize
64    flowop createfile name=createfile2,filesetname=destfiles,fd=2
65    flowop writewholefile name=writefile2,filesetname=destfiles,fd=2,srcfd=1,iosize=$iosize
66    flowop closefile name=closefile1,fd=1
67    flowop closefile name=closefile2,fd=2
68    flowop iopslimit name=iopslim1, target=writefile2
69  }
70}
71
72echo  "RateLimCopyFiles Version 1.1 personality successfully loaded"
73usage "Usage: set \$dir=<dir>         defaults to $dir"
74usage "       set \$eventrate=<value> defaults to $eventrate"
75usage "       set \$filesize=<size>   defaults to $filesize"
76usage "       set \$nfiles=<value>    defaults to $nfiles"
77usage "       set \$iosize=<size>     defaults to $iosize"
78usage "       set \$dirwidth=<value>  defaults to $dirwidth"
79usage "       set \$nthreads=<value>  defaults to $nthreads"
80usage " "
81usage "       run"
82