1#!/bin/sh
2#
3# Copyright (C) 2010 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# This is designed to be run on the device to create I/O load.
18#
19# adb push diskload.sh /data/local/tmp
20# adb shell su root sh /data/local/tmp/diskload.sh /data/testfile
21
22dd if=/dev/zero bs=65536 of=$1.0 & pid0=$!; echo start $pid0; sleep 2
23dd if=/dev/zero bs=65536 of=$1.1 & pid1=$!; echo start $pid1; sleep 2
24dd if=/dev/zero bs=65536 of=$1.2 & pid2=$!; echo start $pid2; sleep 2
25dd if=/dev/zero bs=65536 of=$1.3 & pid3=$!; echo start $pid3; sleep 2
26dd if=/dev/zero bs=65536 of=$1.4 & pid4=$!; echo start $pid4; sleep 2
27dd if=/dev/zero bs=65536 of=$1.5 & pid5=$!; echo start $pid5; sleep 2
28dd if=/dev/zero bs=65536 of=$1.6 & pid6=$!; echo start $pid6; sleep 2
29dd if=/dev/zero bs=65536 of=$1.7 & pid7=$!; echo start $pid7; sleep 2
30dd if=/dev/zero bs=65536 of=$1.8 & pid8=$!; echo start $pid8; sleep 2
31dd if=/dev/zero bs=65536 of=$1.9 & pid9=$!; echo start $pid9; sleep 2
32
33kill $pid0; echo kill $pid0; sleep 2
34kill $pid1; echo kill $pid1; sleep 2
35kill $pid2; echo kill $pid2; sleep 2
36kill $pid3; echo kill $pid3; sleep 2
37kill $pid4; echo kill $pid4; sleep 2
38kill $pid5; echo kill $pid5; sleep 2
39kill $pid6; echo kill $pid6; sleep 2
40kill $pid7; echo kill $pid7; sleep 2
41kill $pid8; echo kill $pid8; sleep 2
42kill $pid9; echo kill $pid9; sleep 2
43
44ls -l $1.0 $1.1 $1.2 $1.3 $1.4 $1.5 $1.6 $1.7 $1.8 $1.9
45rm $1.0 $1.1 $1.2 $1.3 $1.4 $1.5 $1.6 $1.7 $1.8 $1.9
46