我在自己的代码中注意到了这一点,并决定使用 Boost.timer 附带的示例代码来验证它。也许它不适用于 tdm64 编译器?
结果如下:
% g++ --version
g++.exe (tdm64-1) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
%
% g++ -Wall -ggdb3 -o auto_cpu_timer_example boost_1_49_0/libs/timer/example/auto_cpu_timer_example.cpp -lboost_timer -lboost_chrono -lboost_system
%
% g++ -Wall -ggdb3 -o timex boost_1_49_0/libs/timer/example/timex.cpp -lboost_timer -lboost_chrono -lboost_system
%
% auto_cpu_timer_example.exe
0.000000s wall, 0.000000s user + 0.000000s system = 0.000000s CPU (0.0%)
%
%
% ./timex -v auto_cpu_timer_example.exe
0.000000s wall, 0.000000s user + 0.000000s system = 0.000000s CPU (0.0%)
command: "auto_cpu_timer_example.exe"
0.000000s elapsed wall-clock time
%