Experimental Physics and
| |||||||||||||||||||||||||||||||||||||||||||||||
|
Jeff, Thank you very much for your detailed guidance, and sorry for the delayed reply, I was fixing some other issues during the week. I checked the result that ca_pend_event returns, and found it IS ECA_INTERNAL(142)#!I also saw exception related stuff in my profiler (attached below). What does this tell us? (All this is based on preemptive callback mode being turned off.) I have no idea about the "old file descriptor registration features of the CA Client API" , but I saw some suspicious comments on the function ca_client_context::pendEvent(), which appears in the call stack in profiler. Are they relevant? I also tried stop/resume thread and check the call stack, I found that it is the first EPICS thread that has eaten up the CPU. It hangs at semMGive(), and before that there's an allocate exception?? For the second EPICS thread, it gets stuck in semMTake(). Here comes the most weird thing, if I add a printf after calling ca_pend_event() to print out the return value of the function, then after deploy a second EPICS client, the CPU usage will stay low, while the return value is still ECA_INTERNAL (before deploy the second one, ca_pend_event() returns 80, which is ECA_TIMEOUT). Any thoughts?? BTW, Alex Chen sits just behind me :-p Lorna Zhang
(* The delay passed to ca_pend_event is 0.5s. (* (* I changed to call ca_context_create with ca_enable_preemptive_callback (* (without any other change... and still calling ca_pend_event afterwards), (* and found out the CPU 100% usage issue was gone. Weird! That is definitely weird, because changing to preemptive callback shouldn!/t have that impact. I am suspicious that there is a bug, but I had a look at the ca client code and I don!/t (yet) see an issue which would be impacted by preemptive callback mode being turned on/off.
Please suspend the thread that is using CPU, and take some samples of its stack trace so we can see where the CPU is spending time. On vxWorks, with the target shell, one can suspend the thread with !0ts <task id>!1, print a stack trace with !0tt <task id >!1, and resume the thread with !0tr <task id>!1. If you repeat that sequence several times we should receive a good indication of where the CPU is being consumed.
Considering this further, if there was an unexpected C++ exception occurring in ca_pend_event it would be caught by a try catch block at the membrane between C and C++. In that situation ca_pend_event would return ECA_INTERNAL and one could imagine that some CPU would be consumed, because the epicsThreadSleep in ca_pend_event might not be executed. Does ca_pend_event return ECA_INTERNAL?
Are you using the old file descriptor registration features of the CA Client API? I suspect not. Knowing that you are not using that API eliminates some of the code in ca_pend_event from further scrutiny.
Presumably this isn!/t an SMP system (because it is ppc-603)?
Note also that Alex Chen, also of NI, has some bug entries against EPICS at launch pad related to glitches in the advancement of time on windows, but they shouldn!/t be relevant to vxWorks.
Jeff
Message content: TSPA
With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
From: [email protected] [mailto:[email protected]]
What delay is being passed to ca_pend_event?
Otherwise, set a breakpoint in the function that uses CPU, to see who calls it, and how often.
Jeff ______________________________________________________
Message content: TSPA
With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
From: [email protected]
[mailto:[email protected]]
On Behalf Of [email protected]
| ||||||||||||||||||||||||||||||||||||||||||||||
ANJ, 18 Nov 2013 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |