c++ - Benchmarking and restricting execution to a specific CPU -
how can constrain benchmarks run on single cpu (e.g. c0)? running benchmarks , want expose tests environment similar target. advice how ensure there minimal other processes running run benchmarks. import std.datetime; import std.stdio; void algorithm() { writeln("hello!"); } void main() { stopwatch stopwatch; stopwatch.start(); algorithm(); stopwatch.stop(); auto duration = stopwatch.peek(); writeln("hello duration ==> ", duration); } have tried using numactl ? useful memory , process binding here link man page . for example numactl --physcpubind=0 myapp args will bind process myapp core 0. depending on want there may different syntax. example specifying specific cores on cpu or memory binding. format of arguments application may impact numactl syntax. as reducing number of other processes there several options, specifics os dependent. if want test system in environment minimal background noise design...