High CPU Utilization of the script

There is a script which processes the incoming files from a particular directory and sleeps if it doesnt find any. Currently, i have been told that eventhough there are no files to process, the CPU utilization is very high. An independent evaluation by advisory specialist has found this script does language character set conversion(results can be seen after the message) . But there is no conversion done explicitly as such, but, there are lot of display messages in the script (echo "chinese message") , does it cause the language character set conversion as pointed by the advisor? also, currently there is a sleep of 5 secs in the script, if i increase it to 60 seconds, does it make a difference to the performance?

Profile: /usr/lib/libc.a[shr.o]

Total % For All Processes (/usr/lib/libc.a[shr.o]) = 7.94

Subroutine % Source 
========== ====== ====== 
.wctomb 2.79 ../../../../../../../src/bos/usr/ccs/lib/libc/wctomb.c
.mbtowc 2.57 ../../../../../../../src/bos/usr/ccs/lib/libc/mbtowc.c


Profile: /usr/lib/libi18n.a[shr.o]

Total % For All Processes (/usr/lib/libi18n.a[shr.o]) = 6.76

Subroutine % Source 
========== ====== ====== 
.__wcstombs_std 3.40 ../../../../../../../src/bos/usr/ccs/lib/libi18n/__wcstombs_std.c
.wctomb 1.28 glink.s 
.__mbtowc_iso1 1.06 ../../../../../../../src/bos/usr/ccs/lib/libi18n/__mbtowc_iso1.c
.__wctomb_iso1 1.01 ../../../../../../../src/bos/usr/ccs/lib/libi18n/__wctomb_iso1.c

edit by bakunin: please enclose code, quoted output and similar things into "code"-tags like i did for you now. Thanks.

To help you in this we would have to have a look at your script. Without concrete analysis of concrete code all suggestions will be vague at best and misleading at the worst.

A sleep is not all too taxing on the systems resources so probably CPU load will drop overall because the taxing parts of your script will not be executed as often as before.

As you might notice the amassed use of "might", "could", "probably" and similar words point to a lot of uncertainty on this side of the keyboard. What is really going on can only be analyzed when you show the facts instead of second-hand-impressions of some hearsay. Maybe your quoted consultant is correct, maybe he is completely wrong - its simply impossible to find out given the data presented by you.

bakunin

Attached is the code related to the script.

This script is called from another one with a single parameter(1-8).