Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will only print the specified error message once per second. Some caveats: 1) This uses spdk_get_ticks() and friends which is technically a circular dependency since env_dpdk depends on log. log.h doesn't include env.h, and I'm not sure we should add it due to this dependency. It means caller needs to have env.h included before using this new macro. 2) The ratelimit is global, so if thread A prints it as time 0s, and thread B prints it at time 0.5s, the thread B one will get squashed. I think this is the desired behavior. 3) Similar to #2, it means there is small race where two threads do the ERRLOG at the exact same time after the 1 second has expired. In this case both will read the expired value and do the print. Again, I think this is fine, let's not overcomplicate this. 4) This doesn't take argument values into account. So if this macro is getting called many many times but each time with different parameters (i.e. a controller name) then the log will only show one of them. Signed-off-by: Jim Harris <jim.harris@samsung.com> Change-Id: I642350f39bacaaa79358308511dab511e6570cae Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22615 Community-CI: Mellanox Build Bot Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
- Loading branch information