how to write a script to let cpu busy?


 
Thread Tools Search this Thread
Operating Systems AIX how to write a script to let cpu busy?
# 1  
Old 10-06-2009
how to write a script to let cpu busy?

how to write a script to let cpu busy?
and how to write a script to let memory/disk busy?
# 2  
Old 10-06-2009
This gets close :-)

dd if=/dev/urandom of=/dev/null &
dd if=/dev/urandom of=/dev/null &
dd if=/dev/urandom of=/dev/null &
(repeat for as many CPUs as you have)

nmon output:

Code:
x CPU-Utilisation-Small-View x
x                           0----------25-----------50----------75----------100                                                                             x
xCPU User%  Sys% Wait% Idle%|           |            |           |            |                                                                             x
x  0   2.5  76.5   0.0  21.0|Ussssssssssssssssssssssssssssssssssssss>         |                                                                             x
x  1   1.0  80.5   0.0  18.5|ssssssssssssssssssssssssssssssssssssssss         >                                                                             x
x  2   1.0  82.5   0.0  16.5|sssssssssssssssssssssssssssssssssssssssss  >     |                                                                             x
x  3   0.0  87.5   0.0  12.5|sssssssssssssssssssssssssssssssssssssssssss  >   |                                                                             x
xPhysical Averages          +-----------|------------|-----------|------------+                                                                             x
xAll   5.5  74.2   0.0  20.2|>Usssssssssssssssssssssssssssssssssssss          |                                                                             x
x                           +-----------|------------|-----------|------------+

# 3  
Old 10-06-2009
Thank you! Very helpful.

How to do it on memory and disk I/O?
# 4  
Old 10-06-2009
Well, I suppose you could try some of the "SPEC" tests, some of which are designed to measure maximum throughputs. (Others are designed to emulate typical business workloads.)

See: SPEC - Standard Performance Evaluation Corporation
# 5  
Old 10-06-2009
Hi,

try if nstress is doing what you like to do ?

IBM developerWorks: Wikis - AIX - nstress

Kind regards
zxmaus
# 6  
Old 10-07-2009
you could use something like that:
spawns 2 bc processes per processor
Code:
#!/usr/bin/ksh
CPUCOUNT=$(($(lsdev -C | grep "[P]rocessor"| wc -l)*2))


while true
        do
                if [ $(ps -ef | grep -w "[d]c" | wc -l ) -lt $CPUCOUNT ]
                      then
                                ps -ef | grep -w "[d]c" | wc -l
                                echo 9999^9999 | bc >/dev/null 2>&1 &
                      fi
        done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with speeding up my working script to take less time - how to use more CPU usage for a script

Hello experts, we have input files with 700K lines each (one generated for every hour). and we need to convert them as below and move them to another directory once. Sample INPUT:- # cat test1 1559205600000,8474,NormalizedPortInfo,PctDiscards,0.0,Interface,BG-CTA-AX1.test.com,Vl111... (7 Replies)
Discussion started by: prvnrk
7 Replies

2. UNIX for Dummies Questions & Answers

Is it possible to combine multiple CPU to act as a single CPU on the same server?

We have a single threaded application which is restricted by CPU usage even though there are multiple CPUs on the server, hence leading to significant performance issues. Is it possible to merge / combine multiple CPUs at OS level so it appear as a single CPU for the application? (6 Replies)
Discussion started by: Dissa
6 Replies

3. Shell Programming and Scripting

CPU usage script

Hello Friends, I am trying to create a shell script which will check the CPU utilization. I use command top to check the %CPU usage. It give s me below output Cpu states: CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS 0 0.31 9.6% 0.0% 6.1% 84.3% 0.0% 0.0%... (3 Replies)
Discussion started by: Nakul_sh
3 Replies

4. Shell Programming and Scripting

Shell script to calculate the max cpu usage from the main script

Hi All, I have a script which does report the cpu usuage, there are few output parameter/fields displayed from the script. My problem is I have monitor the output and decide which cpu number (column 2) has maximum value (column 6). Since the output is displayed/updated every seconds, it's very... (1 Reply)
Discussion started by: Optimus81
1 Replies

5. Shell Programming and Scripting

Cpu utilization script

I have a set of requirement 1)cpu utilization on a server with pid and and process name. It should display the above and also the script should have an option to record the cpu utilization for a given period of time first part i can get with below commands ps -eo pcpu,pid,user,args or... (5 Replies)
Discussion started by: NarayanaPrakash
5 Replies

6. Shell Programming and Scripting

Freeing the terminal from busy shell script?

Hi guys, I wrote a basic inotifywait shell script on my CentOS 5.6 x86_64 test server that syncs any deleted files in a directory. /usr/bin/script #!/bin/sh inotifywait -m -e delete /home/user/test | while read file; do # log event here done The script alone works fine. However, the... (4 Replies)
Discussion started by: TECK
4 Replies

7. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

8. UNIX for Advanced & Expert Users

Filesystem mystery: disks are not busy on one machine, very busy on a similar box

Hi, We have a filesystem mystery on our hands. Given: 2 machines, A and Aa. Machine Aa is the problem machine. Machine A is running Ubuntu, kernel 2.6.22.9 #1 SMP Wed Feb 20 08:46:16 CST 2008 x86_64 GNU/Linux. Machine Aa is running RHEL5.3, kernel 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38... (2 Replies)
Discussion started by: mschwage
2 Replies

9. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

10. UNIX for Dummies Questions & Answers

how to get persistant cpu utilization values per process per cpu in linux (! top,ps)

hi, i want to know cpu utilizatiion per process per cpu..for single processor also if multicore in linux ..to use these values in shell script to kill processes exceeding cpu utilization.ps (pcpu) command does not give exact values..top does not give persistant values..psstat,vmstat..does njot... (3 Replies)
Discussion started by: pankajd
3 Replies
Login or Register to Ask a Question