stress-ng --switch : Possibility to generate a specific amount of switches per second?

Asked by Claudio on 2019-01-31

Hello,

I would need to generate a specific amount of switches per second,
in order to see how my system reacts to specific context switch loads.

maybe it is already possible with stress_ng or would you suggest some other tool?

Thank you very much,

Claudio

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu stress-ng Edit question
Assignee:
No assignee Edit question
Last query:
2019-02-04
Last reply:
2019-02-21
Colin Ian King (colin-king) said : #1

This current is not possible with stress-ng but it's a good idea.

I have two solutions:

1. Add a --switch-delay option.

This specifies the delay in nanoseconds between each context switch. This is really simple to implement and I could get that into the stress-ng upstream git repo by end of today.

2. Add a --switch-rate option.

This specifies the switch rate in switches per second. This is hard to do as the stressor has to do expensive calls to get a high resolution timer to allow it to re-actively tune the rate (as this will vary depending on the system load etc).

Personally I'd prefer option 1.

Colin

Claudio (claudio-fontana) said : #3

thank you for your quick response!

I have tried out the latest master code,

which now includes a --switch-freq option.

It seems to affect the amount of context switches as shown by perf stat -a,
so it seems a great start!

One thing I would like to know is how the supplied parameter should be set to achieve a specific amount of switches per second, and what kind of relationship is there between the number of hogs and this parameter.

(-s and --switch-freq).

stress-ng -s 1 --switch-freq 10000 results in 10K switches/sec
stress-ng -s 1 --switch-freq 50000 results in 30K switches/sec
stress-ng -s 1 --switch-freq 90000 results in 46K switches/sec

stress-ng -s 2 --switch-freq 10000 results in 15K switches/sec
stress-ng -s 2 --switch-freq 50000 results in 54K switches/sec
stress-ng -s 2 --switch-freq 90000 results in 80K switches/sec

Thank you!

Claudio

Launchpad Janitor (janitor) said : #4

This question was expired because it remained in the 'Open' state without activity for the last 15 days.