openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Williams <patrick@stwcx.xyz>
To: Nguyen Chanh <nguyenchanh2201@gmail.com>
Cc: openbmc@lists.ozlabs.org
Subject: Re: [c++] [hwmon] std::ifstream read file with timeout so long
Date: Wed, 7 Oct 2020 10:24:28 -0500	[thread overview]
Message-ID: <20201007152428.GJ6152@heinlein> (raw)
In-Reply-To: <CAPGDkaHzu5UOES-irDLtu9jwLULyX9_BWAX7rgTPiaeXOT2ByA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-10-07 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 15:42 [c++] [hwmon] std::ifstream read file with timeout so long Nguyen Chanh
2020-10-07 15:24 ` Patrick Williams [this message]
2020-10-07 19:02   ` Anton Kachalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201007152428.GJ6152@heinlein \
    --to=patrick@stwcx.xyz \
    --cc=nguyenchanh2201@gmail.com \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).