Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[c++] [hwmon] std::ifstream read file with timeout so long #16

Open
nguyenchanh2201 opened this issue Oct 6, 2020 · 3 comments
Open

Comments

@nguyenchanh2201
Copy link

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

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.

Screen Shot 2020-10-03 at 11 32 36 AM

@spinler
Copy link
Contributor

spinler commented Oct 7, 2020

People have hit this in the past, and they've fixed it in their device driver.

@nguyenchanh2201
Copy link
Author

Thank @spinler , please help me give more info the fixing at device driver! Commit , Merg request or any link that you think it's useful with me.

@spinler
Copy link
Contributor

spinler commented Oct 8, 2020

What driver is it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants