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 
  44 set $dir=/tmp
  45 set $eventrate=10
  46 set $dirwidth=20
  47 set $filesize=16k
  48 set $iosize=1m
  49 set $nfiles=1000
  50 set $nthreads=1
  51 
  52 eventgen rate=$eventrate
  53 set mode quit firstdone
  54 
  55 define fileset name=bigfileset,path=$dir,size=$filesize,entries=$nfiles,dirwidth=$dirwidth,prealloc=100
  56 define fileset name=destfiles,path=$dir,size=$filesize,entries=$nfiles,dirwidth=$dirwidth
  57 
  58 define 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 
  72 echo  "RateLimCopyFiles Version 1.1 personality successfully loaded"
  73 usage "Usage: set \$dir=<dir>         defaults to $dir"
  74 usage "       set \$eventrate=<value> defaults to $eventrate"
  75 usage "       set \$filesize=<size>   defaults to $filesize"
  76 usage "       set \$nfiles=<value>    defaults to $nfiles"
  77 usage "       set \$iosize=<size>     defaults to $iosize"
  78 usage "       set \$dirwidth=<value>  defaults to $dirwidth"
  79 usage "       set \$nthreads=<value>  defaults to $nthreads"
  80 usage " "
  81 usage "       run"