On Wed, Mar 29, 2017 at 10:45:55PM +0000, Legacy, Allain wrote:
> > -----Original Message-----
> > From: Yuanhan Liu [mailto:yuanhan....@linux.intel.com]
> > Sent: Wednesday, March 29, 2017 3:02 AM
> 
> <...>
> > 
> > OTOH, it's still good to have RTE_LOG_ONCE. It explicitly tells you 
> > something
> > is wrong, then you could dump those stats for more info.
> 
> Has the implementation of something like RTE_LOG_ONCE been discussed before?  

No. It's just something comes to my mind after saw your patch.

> Do you have a proposal on what you would find acceptable as an implementation 
> that considers multiples threads, multiple devices, multiple logs per file, 
> etc.?

No, that would be way to complex. Something I thought of is quite
simple (like what Linux kernel does):

        #define RTE_LOG_ONCE(...)       do {    \
                static int warned;              \
                if (!warned) {                  \
                        RTE_LOG(...);           \
                        warned = 1;             \
                }                               \
        } while (0)


And yes, I know it's far away from being perfect (and accurate, regarding
to multiple devices and so on as you mentioned). Even though, I think
it's much better than showing nothing when something goes wrong.

        --yliu

Reply via email to