Measuring Execution time

Yazan D via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 24 01:18:53 PDT 2015


On Thu, 23 Jul 2015 16:43:01 +0000, Clayton wrote:

> On Wednesday, 22 July 2015 at 09:32:15 UTC, John Colvin wrote:
>> On Wednesday, 22 July 2015 at 09:23:36 UTC, Clayton wrote:
>>> [...]
>>
>> The normal way of doing this would be using std.datetime.StopWatch:
>>
>>     StopWatch sw;
>>     sw.start();
>>     algorithm();
>>     long exec_ms = sw.peek().msecs;
> 
> Am wondering how possible is to restrict that all algorithms get run on
> a specific core( e.g. CPU 0 ) since I wanted my test run on the same
> environment.

If you are using Linux, you can use `taskset`.
Example: `taskset -c 0 ./program`. This will run your program on the 
first CPU only.


More information about the Digitalmars-d-learn mailing list