How to simulate high CPU spike by an existing process How to simulate high CPU spike by an existing process unix unix

How to simulate high CPU spike by an existing process


Rather than try to spike the cpu usage, you could try to starve it of cpu time, thus preventing it from responding to the other process.

Since you know the process id, you can reduce its access to cpu time by using cpulimit.

Example: The following command should allow process 1234 only 1% of the cpu.

cpulimit --pid=1234 --limit=1

If this doesn't slow it down enough, you could also try bogging down the cpu by running other cpu-intensive applications in conjunction with using cpulimit.

[EDIT]

Since you don't have cpulimit on your system, you could use SIGSTOP and SIGCONT instead (which is what cpulimit uses anyway I believe):

kill -SIGSTOP [pid]kill -SIGCONT [pid]

If your system doesn't recognize the -SIGSTOP and -SIGCONT, you could use their IDs directly:

kill -19 [pid]kill -18 [pid]