google / google/benchmark

[BUG] csv outputs in floating point with low precision

Open
#1,018 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
10.4k
Forks
1.8k
Avg merge
2d 4h
Merged PRs (30d)
8

Description

**Describe the bug**

Number of significant digits is very low for CSV compared to console or json

**System**
Which OS, compiler, and compiler version are you using:
Fedora 32
gcc version 10.1.1
**To reproduce**
Steps to reproduce the behavior:
1. long executing benchmar; e.g. sleep(10)
2. ./a.out --benchmark_format=json
3. ./a.out --benchmark_format=csv
4. compare number of digits

**Expected behavior**
Number of digits should be the same

**Screenshots**
[marcpawl@compile bin]$ ./pubsub --benchmark_format=csv
2020-08-09 20:23:28
Running ./pubsub
Run on (2 X 1598.84 MHz CPU s)
CPU Caches:
L1 Data 32K (x2)
L1 Instruction 32K (x2)
L2 Unified 256K (x2)
L3 Unified 3072K (x2)
Load Average: 0.25, 0.26, 0.22
name,iterations,real_time,cpu_time,time_unit,bytes_per_second,items_per_second,label,error_occurred,error_message
"A_create_legacy",721,919894,917702,ns,,,,,
"B_destruct_legacy",1,1.27669e+13,7.74298e+08,ns,,,,,
"C_subscribe_legacy",1,1.27669e+13,7.88876e+08,ns,,,,,
"D_unsubscribe_legacy",1,1.2767e+13,8.50538e+08,ns,,,,,
..
[marcpawl@compile bin]$ ./pubsub --benchmark_format=json | head -30
...
"benchmarks": [
{
"name": "A_create_legacy",
"run_name": "A_create_legacy",
"run_type": "iteration",
"repetitions": 0,
"repetition_index": 0,
"threads": 1,
"iterations": 937,
"real_time": 7.4696266808851599e+05,
"cpu_time": 7.4180009925293492e+05,
"time_unit": "ns"
},
{
"name": "B_destruct_legacy",
"run_name": "B_destruct_legacy",
"run_type": "iteration",
"repetitions": 0,
"repetition_index": 0,
"threads": 1,
"iterations": 1,
"real_time": 1.3117869548773998e+13,
"cpu_time": 7.8898283200000012e+08,
"time_unit": "ns"
},
...

Running ./pubsub
Run on (2 X 1598.84 MHz CPU s)
CPU Caches:
L1 Data 32K (x2)
L1 Instruction 32K (x2)
L2 Unified 256K (x2)
L3 Unified 3072K (x2)
Load Average: 0.58, 0.22, 0.20
---------------------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------------------
A_create_legacy 781402 ns 779145 ns 875
B_destruct_legacy 13088815845011 ns 776637756 ns 1
C_subscribe_legacy 13088832052804 ns 792733067 ns 1
D_unsubscribe_legacy 13088889551424 ns 850066853 ns 1
E_update_legacy 3.36 ns 3.36 ns 208110025
A_create_subscription 774053 ns 771858 ns 867
B_destruct_subscription 13090709722097 ns 2665292010 ns 1
C_subscribe_subscription 13090727067425 ns 2681978905 ns 1
...

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.