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 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  22 # Use is subject to license terms.
  23 #
  24 # $dir - directory for datafiles
  25 # $eventrate - event generator rate (0 == free run)
  26 # $nfiles - number of data files
  27 # $nthreads - number of worker threads
  28 
  29 set $dir=/tmp
  30 set $cached=false
  31 set $eventrate=10
  32 set $meandirwidth=20
  33 set $nthreads=1
  34 set $nfiles=10000
  35 set $sync=false
  36 set $totalfiles=$nfiles * $eventrate
  37 
  38 eventgen rate=$eventrate
  39 
  40 define randvar name=$wrtiosize, type=tabular, min=1k, round=1k, randtable =
  41 {{ 0,   1k,    7k},
  42  {50,   9k,   15k},
  43  {14,  17k,   23k},
  44  {14,  33k,   39k},
  45  {12,  65k,   71k},
  46  {10, 129k,  135k}
  47 }
  48 
  49 define randvar name=$rdiosize, type=tabular, min=8k, round=1k, randtable =
  50 {{85,   8k,   8k},
  51  { 8,  17k,  23k},
  52  { 4,  33k,  39k},
  53  { 2,  65k,  71k},
  54  { 1, 129k, 135k}
  55 }
  56 
  57 define randvar name=$filesize, type=tabular, min=1k, round=1k, randtable =
  58 {{33,   1k,    1k},
  59  {21,   1k,    3k},
  60  {13,   3k,    5k},
  61  {10,   5k,   11k},
  62  {08,  11k,   21k},
  63  {05,  21k,   43k},
  64  {04,  43k,   85k},
  65  {03,  85k,  171k},
  66  {02, 171k,  341k},
  67  {01, 341k, 1707k}
  68 }
  69 
  70 define randvar name=$fileidx, type=gamma, min=0, gamma=100
  71 
  72 define fileset name=bigfileset,path=$dir,size=$filesize,entries=$totalfiles,dirwidth=$meandirwidth,prealloc=60,cached=$cached
  73 
  74 define flowop name=rmw, $filesetrmw
  75 {
  76   flowop openfile name=openfile1,filesetname=$filesetrmw,indexed=$fileidx,fd=1
  77   flowop readwholefile name=readfile1,iosize=$rdiosize,fd=1
  78   flowop createfile name=newfile2,filesetname=$filesetrmw,indexed=$fileidx,fd=2
  79   flowop writewholefile name=writefile2,fd=2,iosize=$wrtiosize,srcfd=1
  80   flowop closefile name=closefile1,fd=1
  81   flowop closefile name=closefile2,fd=2
  82   flowop deletefile name=deletefile1,fd=1
  83 }
  84 
  85 define flowop name=launch, $filesetlch
  86 {
  87   flowop openfile name=openfile3,filesetname=$filesetlch,indexed=$fileidx,fd=3
  88   flowop readwholefile name=readfile3,iosize=$rdiosize,fd=3
  89   flowop openfile name=openfile4,filesetname=$filesetlch,indexed=$fileidx,fd=4
  90   flowop readwholefile name=readfile4,iosize=$rdiosize,fd=4
  91   flowop closefile name=closefile3,fd=3
  92   flowop openfile name=openfile5,filesetname=$filesetlch,indexed=$fileidx,fd=5
  93   flowop readwholefile name=readfile5,iosize=$rdiosize,fd=5
  94   flowop closefile name=closefile4,fd=4
  95   flowop closefile name=closefile5,fd=5
  96 }
  97 
  98 define flowop name=appnd, $filesetapd
  99 {
 100   flowop openfile name=openfile6,filesetname=$filesetapd,indexed=$fileidx,fd=6
 101   flowop appendfilerand name=appendfilerand6,iosize=$wrtiosize,fd=6
 102   flowop closefile name=closefile6,fd=6
 103 }
 104 
 105 define process name=netclient,instances=1
 106 {
 107   thread name=fileuser,memsize=10m,instances=$nthreads
 108   {
 109     flowop launch name=launch1, iters=1, $filesetlch=bigfileset
 110     flowop rmw name=rmw1, iters=6, $filesetrmw=bigfileset
 111     flowop appnd name=appnd1, iters=3, $filesetapd=bigfileset
 112     flowop statfile name=statfile1,filesetname=bigfileset,indexed=$fileidx
 113     flowop eventlimit name=ratecontrol
 114   }
 115 }
 116 
 117 echo  "NetworkFileServer Version 1.0 personality successfully loaded"
 118 usage "Usage: set \$dir=<dir>            defaults to $dir"
 119 usage "       set \$cached=<bool>        defaults to $cached"
 120 usage "       set \$eventrate=<value>    defaults to $eventrate"
 121 usage "       set \$wrtiosize.type=<type>   defaults to $wrtiosize.type"
 122 usage "       set \$wrtiosize.randsrc=<src> defaults to $wrtiosize.randsrc"
 123 usage "       set \$rdiosize.type=<type>   defaults to $rdiosize.type"
 124 usage "       set \$rdiosize.randsrc=<src> defaults to $rdiosize.randsrc"
 125 usage "       set \$filesize.type=<type>   defaults to $filesize.type"
 126 usage "       set \$filesize.randsrc=<src> defaults to $filesize.randsrc"
 127 usage "       set \$nfiles=<value>       defaults to $nfiles"
 128 usage "       set \$nthreads=<value>     defaults to $nthreads"
 129 usage "       set \$sync=<bool>          defaults to $sync"
 130 usage " "
 131 usage "       run runtime (e.g. run 60)"