Purpose : generate CPU load on CPU cores to test server thoughput related to cpu switch.
Step: 1. Set affinity mask to include cpu and only cpu
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
2. Set priority and schedule policy to RR for a process
/usr/bin/chrt -rp prio, pid
Description:
The pthread_setaffinity_np() function sets the CPU affinity mask of the thread thread to the CPU set pointed to by cpuset. If the call is successful, and the thread is not currently running on one of the CPUs in cpuset, then it is migrated to one of those CPUs. The pthread_getaffinity_np() function returns the CPU affinity mask of the thread thread in the buffer pointed to by cpuset.
chrt sets or retrieves the real-time scheduling attributes of an existing pid, or runs command with the given attributes.