-
Notifications
You must be signed in to change notification settings - Fork 219
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
peaks in read time when using 0 timeout #419
Comments
How confident are you that the measurements are valid? |
Based on the code there, you are going to get some strange timeouts, @ronytigo. Your loop checking for the tag status does not give up the CPU at all: do{
status = plc_tag_status(plc_tag);
} while (status == PLCTAG_STATUS_PENDING); You need to add a delay with a sleep or somehow signal to the OS that the thread can be rescheduled. The timeout durations are suspicious, however. The base timeout in the main IO thread is 100ms. What operating system, compiler and libplctag version are you using? |
util_time_ms is taken from this repository and it looks ok. NAME="Ubuntu" LIBPLC_REQUIRED_VERSION 2, 1, 0 set(CMAKE_CXX_COMPILER_ID "GNU") |
Also tried on another machine with another plc. same results. |
Thanks for trying that. Please try to use a function that forces a thread to yield the CPU, such as What version of the library are you using? The requirement macro just tells the library the minimum version of the API needed, not the version of the library to load. |
Added sched_yield() after the usleep(100), same results. |
/* output the version we are using. */
printf("Library version %d.%d.%d.\n",
plc_tag_get_int_attribute(0, "version_major", 0),
plc_tag_get_int_attribute(0, "version_minor", 0),
plc_tag_get_int_attribute(0, "version_patch", 0)); Thanks for trying |
Thanks! |
@kyle-github any idea? |
Sorry, I've been ill. This is looking like it might be a bug, but I cannot tell what the library is doing during those long delays. Can you turn on debugging to level 4 and capture the output of the test that shows occasional 100+ms delays? You can do this by appending "&debug=4" to the tag string or by calling |
sure, thanks!
|
I have not been able to duplicate this locally, but I have a few more ideas to try. |
Are you trying on Ubuntu? |
Sorry this is taking so long. Still sick. |
I will have more time now so this is back near the head of the queue. I need to rewire my test set up to give me a wired connection to my PLC. Right now, the only thing I have is wireless and that has a lot of noise that would hide these problems. |
This is my code:
when
timeout
is 0, this is the output I get:When the timeout is 10, I get:
The text was updated successfully, but these errors were encountered: