Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test arguments printed with 32 bit precision #714

Closed
mknejp opened this issue Oct 22, 2018 · 2 comments
Closed

Test arguments printed with 32 bit precision #714

mknejp opened this issue Oct 22, 2018 · 2 comments

Comments

@mknejp
Copy link

mknejp commented Oct 22, 2018

The arguments passed to benchmarks are of type int64_t however when they get reported they get truncated to 32 bits. The following is output where the argument keeps increasing beyond int precision and is printed incorrectly (but the benchmark does the right thing).

baseline_push_back/std::vector<int>/67108864/manual_time              33079613 ns   32812500 ns         20
baseline_push_back/std::vector<int>/134217728/manual_time             71565844 ns   71428571 ns          7
baseline_push_back/std::vector<int>/536870912/manual_time            539197109 ns  531250000 ns          1
baseline_push_back/std::vector<int>/1073741824/manual_time           914751775 ns  890625000 ns          1
baseline_push_back/std::vector<int>/-2147483648/manual_time         1806131008 ns 1796875000 ns          1
baseline_push_back/std::vector<int>/0/manual_time                   3629563138 ns 3625000000 ns          1

I think the problem is that

instance.name += StrFormat("%d", arg);

should use the %lld format specifier instead.

@dmah42
Copy link
Member

dmah42 commented Oct 23, 2018 via email

@LebedevRI
Copy link
Collaborator

Is -Wformat not enabled? Why isn't compiler complaining about that..

@LebedevRI LebedevRI self-assigned this Nov 26, 2018
LebedevRI added a commit to LebedevRI/benchmark that referenced this issue Nov 26, 2018
LebedevRI added a commit to LebedevRI/benchmark that referenced this issue Nov 26, 2018
LebedevRI added a commit to LebedevRI/benchmark that referenced this issue Nov 26, 2018
LebedevRI added a commit to LebedevRI/benchmark that referenced this issue Nov 26, 2018
LebedevRI added a commit to LebedevRI/benchmark that referenced this issue Nov 26, 2018
@LebedevRI LebedevRI removed their assignment Aug 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants