[c++] [hwmon] std::ifstream read file with timeout so long
Patrick Williams
patrick at stwcx.xyz
Thu Oct 8 02:24:28 AEDT 2020
On Tue, Oct 06, 2020 at 10:42:18PM +0700, Nguyen Chanh wrote:
> In https://github.com/openbmc/phosphor-hwmon => hwmonio.cpp , I saw we use
> the std::ifstream to open and read a device sensor.
>
> But, I met an issue with it. In case the sensor was disabled (Ex: the Fan
> was unplugged), the std::ifstream read will take a long time . The timeout
> in there is so long. It makes my system have a BIG delay in each checking
> sensor.
>
> Other observation : In case the sensor device is ready, the time for sensor
> reading is expected.
>
> Measuring std::ifstream reading:
>
> In case unplugged sensor: 91385 microseconds
> In case plugged sensor. : 507 microseconds
Do you know which device driver it is interacting with? This sounds
like an issue with the underlying driver. Perhaps it is attempting
too many retries.
>
> The patch to measure the std::ifstream reading, please see attachment !
>
> Unexpected behavior you saw
>
> The timeout in there is so long
>
> Expected behavior
>
> Do we have any better solution in this case? take less more timeout.
> [image: Screen Shot 2020-10-03 at 11.32.36 AM.png]
> --
> *Nguyen Minh Chanh *
> *Embedded Software Engineer *
--
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20201007/678a28df/attachment.sig>
More information about the openbmc
mailing list