1#! /bin/sh 2 3############################################################################### 4# # 5# Copyright (c) 2010 FUJITSU LIMITED # 6# # 7# This program is free software; you can redistribute it and/or modify it # 8# under the terms of the GNU General Public License as published by the Free # 9# Software Foundation; either version 2 of the License, or (at your option) # 10# any later version. # 11# # 12# Author: Li Zefan <[email protected]> # 13# # 14############################################################################### 15 16LOOP=200 17 18# Use up to 10% of free memory 19free_mem=`cat /proc/meminfo | grep '^MemFree' | awk '{ print $2 }'` 20cpus=`tst_ncpus` 21 22step=$(( $free_mem / 10 / $LOOP / $cpus )) 23 24if [ $step -eq 0 ]; then 25 step=1 26 LOOP=50 27fi 28 29while true; do 30 new_size=1 31 i=0 32 while [ $i -lt $LOOP ]; do 33 echo $new_size > "$TRACING_PATH"/buffer_size_kb 34 new_size=$(( $new_size + $step )) 35 i=$((i + 1)) 36 done 37 38 i=0 39 while [ $i -lt $LOOP ]; do 40 new_size=$(( $new_size - $step )) 41 echo $new_size > "$TRACING_PATH"/buffer_size_kb 42 i=$((i + 1)) 43 done 44 sleep 1 45done 46