我的 .h 文件中有这段代码:
std::mt19937 rng(time(NULL)); // mersenne numbers
int random(int n) {
std::uniform_int_distribution<int> distribution(0, n);
return distribution(rng);
}
但我从不打电话random()
。
当我使用 gprof 分析代码时,我得到:
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
99.13 2.28 2.28 1 2.28 2.28 random(int)
怎么了?