7

I'm interessted in getting the number of context switches a two processes in a KVM vm takes on a singel CPU over some time.

Earlier i have used perf, is this best practice?

And how much time is used on a context switch per CPU?

1

1 Answer 1

10

About 1.2 microseconds which is about a thousand Cycles

https://eli.thegreenplace.net/2018/measuring-context-switching-and-memory-overheads-for-linux-threads/

3
  • And most of that time is taken up by the Linux scheduler doing its work Commented Jun 12, 2020 at 6:29
  • 1000 cycles in 1.2 mics implies a processor frequency of 800mhz? This doesn't seem correct in 2019... Commented Jul 24, 2024 at 10:15
  • Wrong, the OP is asking about process context switch, not thread context switch. And even thread context switch costs about 30-300 us, if you take into account indirect costs like cache invalidation etc. Commented Mar 3 at 6:59

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.