15184Sek110237#
25184Sek110237# CDDL HEADER START
35184Sek110237#
45184Sek110237# The contents of this file are subject to the terms of the
55184Sek110237# Common Development and Distribution License (the "License").
65184Sek110237# You may not use this file except in compliance with the License.
75184Sek110237#
85184Sek110237# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95184Sek110237# or http://www.opensolaris.org/os/licensing.
105184Sek110237# See the License for the specific language governing permissions
115184Sek110237# and limitations under the License.
125184Sek110237#
135184Sek110237# When distributing Covered Code, include this CDDL HEADER in each
145184Sek110237# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155184Sek110237# If applicable, add the following below this CDDL HEADER, with the
165184Sek110237# fields enclosed by brackets "[]" replaced with your own identifying
175184Sek110237# information: Portions Copyright [yyyy] [name of copyright owner]
185184Sek110237#
195184Sek110237# CDDL HEADER END
205184Sek110237#
215184Sek110237#
226333Sek110237# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
235184Sek110237# Use is subject to license terms.
245184Sek110237#
255184Sek110237# ident	"%Z%%M%	%I%	%E% SMI"
265184Sek110237
276333Sek110237# Creates a fileset with 20,000 entries ($nfiles), but only preallocates
286333Sek110237# 50% of the files.  Each file's size is set via a gamma distribution with
296333Sek110237# a median size of 1KB ($filesize).
306333Sek110237#
316333Sek110237# The single thread then creates a new file and writes the whole file with
326333Sek110237# 1MB I/Os.  The thread stops after 5000 files ($count/num of flowops) have
33*6345Sek110237# been created and written to.
346333Sek110237
355184Sek110237set $dir=/tmp
366333Sek110237set $count=15000
375184Sek110237set $filesize=1k
385673Saw148015set $iosize=1m
396333Sek110237set $meandirwidth=100000
406333Sek110237set $nfiles=20000
415184Sek110237set $nthreads=1
425184Sek110237
435184Sek110237define fileset name=bigfileset,path=$dir,size=$filesize,entries=$nfiles,dirwidth=$meandirwidth,prealloc=50
445184Sek110237
455184Sek110237define process name=filecreate,instances=1
465184Sek110237{
475184Sek110237  thread name=filecreatethread,memsize=10m,instances=$nthreads
485184Sek110237  {
495184Sek110237    flowop createfile name=createfile1,filesetname=bigfileset,fd=1
505673Saw148015    flowop writewholefile name=writefile1,filesetname=bigfileset,fd=1,iosize=$iosize
515184Sek110237    flowop closefile name=closefile1,fd=1
525184Sek110237    flowop finishoncount name=finish,value=$count
535184Sek110237  }
545184Sek110237}
555184Sek110237
566333Sek110237echo  "FileMicro-Createfiles Version 2.2 personality successfully loaded"
575184Sek110237usage "Usage: set \$dir=<dir>"
586333Sek110237usage "       set \$count=<value>        defaults to $count"
596333Sek110237usage "       set \$filesize=<size>      defaults to $filesize"
606333Sek110237usage "       set \$iosize=<size>        defaults to $iosize"
616333Sek110237usage "       set \$meandirwidth=<value> defaults to $meandirwidth"
626333Sek110237usage "       set \$nfiles=<value>       defaults to $nfiles"
636333Sek110237usage "       set \$nthreads=<value>     defaults to $nthreads"
645184Sek110237usage " "
655184Sek110237usage "       run runtime (e.g. run 60)"
66