goldsborough / ipc-bench

:racehorse: Benchmarks for Inter-Process-Communication Techniques
MIT License
696 stars 108 forks source link

Useless results on Raspbian #15

Closed tangentsoft closed 3 years ago

tangentsoft commented 5 years ago

I've tried several of the benchmarks, and they all give the same bogus result:

============ RESULTS ================
Message size:       4096
Message count:      1000
Total duration:     0.000   ms
Average duration:   0.000   us
Minimum duration:   0.000   us
Maximum duration:   0.000   us
Standard deviation: 0.000   us
Message rate:       2147483647  msg/s
=====================================

The programs exit with a zero exit code.

I've also tried it on Debian 9 (Stretch), which is the base OS for Raspbian Stretch, and the benchmark runs properly there, so I assume there is some ARM portability problem here.

Can you please try running this benchmark on a Raspberry Pi and fix up the portability problems that prevent it from giving useful results? Thanks.

luksan commented 3 years ago

The problem is that bench_t in common/benchmark.h is typedefed as unsigned long which is 32 bits on 32 bit platforms, and now() returns ts.tv_sec * 1e9 + ts.tv_nsec, which overflows in 32 bits.

Changing bench_t to unsigned long long gives me correct results on Rasbian (Stretch)

alexandervanrenen commented 3 years ago

Thanks @luksan

Should be fixed now.

I am trying to spend a bit of time on this code base again and fixes like that are super helpful!