Home | History | Annotate | Download | only in mongo
      1 #!/bin/sh
      2 #To exectute this you need mongo filesystem utility.
      3 #Run this inside the mongo directory.
      4 #mongo utility can be found in www.namesys.com/benchmarks/mongo-xxx.tgz
      5 #Description-this script tests the mongo utility which actulally give the time ie cpu time
      6 #Real time etc on reiserfile system and jfs filesystem.
      7 #created by prakash.banu (at] wipro.com
      8 #
      9 #   This program is free software;  you can redistribute it and/or modify
     10 #   it under the terms of the GNU General Public License as published by
     11 #   the Free Software Foundation; either version 2 of the License, or
     12 #   (at your option) any later version.
     13 #
     14 #   This program is distributed in the hope that it will be useful,
     15 #   but WITHOUT ANY WARRANTY;  without even the implied warranty of
     16 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
     17 #   the GNU General Public License for more details.
     18 #
     19 #   You should have received a copy of the GNU General Public License
     20 #   along with this program;  if not, write to the Free Software
     21 #   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
     22 #
     23 
     24 LOG_DIR=$PWD
     25 TEST_DIR=testdir
     26 
     27 
     28    		#should be root  to execute this script .
     29 	if [ $(id -ru) -ne 0 ]; then
     30 		echo "This script must be run as root"
     31 		exit
     32 	fi
     33 		#set the PATH variable if its not done .
     34 export PATH=$PATH:/sbin
     35 lsmod |grep reiserfs
     36 
     37 	if [ $? -ne 0 ]; then
     38 		echo "inserting reiserfs and its dependencies"
     39 	fi
     40 modprobe reiserfs
     41 	if [ $? -ne 0 ]; then
     42 		echo "check wheather reiserfs  is been compiled in the kernel"
     43 	fi
     44 
     45 lsmod |grep loop
     46 	if [ $? -ne 0 ]; then
     47 		echo "inserting loopback device module"
     48 	fi
     49 modprobe loop
     50 	if [ $? -ne 0 ]; then
     51 		echo "check wheather loopback device option is been compiled in the kernel"
     52 	fi
     53 
     54 	#run the mongo test on reiserfs file system type
     55 reiserfs()
     56 {
     57 cat > fs.sh <<EOF
     58 echo "performing mongo on reiserfs"
     59 dd if=/dev/zero of=reiserfs  bs=8k count=10240 > /dev/null 2>&1
     60 losetup /dev/loop0 reiserfs
     61 mkdir -p $TEST_DIR
     62 ./mongo.pl LOG=/tmp/logfile1 file_size=10000 bytes=100000 fstype=reiserfs dev=/dev/loop0 dir=$TEST_DIR RUN   log=$LOG_DIR/reiserlog > /dev/null 2>&1
     63 
     64 echo "RESULTS LOGGED IN $LOG_DIR/reiserlog"
     65 export PATH=$PATH:/sbin
     66 losetup -d /dev/loop0
     67 
     68 EOF
     69 }
     70 
     71 
     72 #To run on jfs file system type
     73 JFS()
     74 {
     75 cat >> fs.sh <<EOF
     76 echo "performing mongo on jfs file system"
     77 mkdir -p $TEST_DIR
     78 dd if=/dev/zero of=jfs  bs=8k count=10240 > /dev/null 2>&1
     79 losetup /dev/loop0 jfs
     80 ./mongo.pl LOG=/tmp/logfile1 file_size=10000 bytes=100000 fstype=jfs dev=/dev/loop0 dir=$TEST_DIR   RUN log=$LOG_DIR/jfslog
     81 
     82 echo "RESULTS LOGGED IN $LOG_DIR/jfslog"
     83 export PATH=$PATH:/sbin
     84 losetup -d /dev/loop0
     85 echo "rm -rf ./fs.sh" >> ./fs.sh 2>&1
     86 EOF
     87 }
     88 
     89 
     90 echo -ne "TEST ON REISERFS?[y/N]:"
     91 read ker
     92 
     93 case $ker in
     94 y|Y)     reiserfs
     95 esac
     96 
     97 echo -ne "TEST ON JFS[y/N]: "
     98 read ker
     99 
    100 case $ker in
    101 y|Y)     JFS
    102 esac
    103 
    104 echo "THIS MAY TAKE SOME MINUTES"
    105 sh fs.sh
    106 
    107 #performing cleanup
    108 #losetup -d /dev/loop0
    109 rm -rf $TEST_DIR
    110