[Nut-upsdev] timestamped debug output (was: upsd flapping in the breeze)

Arjen de Korte nut+devel at de-korte.org
Mon May 18 19:16:16 UTC 2009


Citeren Arnaud Quette <aquette.dev op gmail.com>:

> as a side note, debug timestamping is now available:
> ie: mge-shut -DDDT -a ...
>
> Network UPS Tools - MGE UPS SYSTEMS/SHUT driver 0.68 (2.4.1-1840:1845M)
> 14:27:25: debug level is '3'
> 14:27:25: entering upsdrv_initups()
> 14:27:25: entering setline(1)
> 14:27:25: entering shut_ups_start()
> ...
>
> This is effective for upsd, upsmon, upsdrvctl and the drivers by using "-T".
> The best, as told in the manpages, is to use it in conjunction with the
> debug flags (ie -D...)
> This should help out in troubleshooting timeframe problems.

Brilliant! I've found myself adding timestamps (and removing them  
again) several times. It probably would be much better to enable this  
everywhere. Two remarks:

1) I wouldn't mind enabling this by default in upsdebugx() and friends  
when debugging is enabled. In that case, the changes would be limited  
to common.c

2) It might be better to use gettimeofday() instead if time() here. A  
one second resolution might not provide enough granularity to be  
really useful, except for finding timeouts. If we however add a  
millisecond resolution, we might also get an idea how long certain  
actions take, to see if it is worth optimizing things.

Best regards, Arjen
-- 
Please keep list traffic on the list




More information about the Nut-upsdev mailing list