[Ace-users] profiling server using ACE_Tasks

sunil sunilsreenivas2001 at yahoo.com
Mon Dec 17 18:00:22 CST 2007

I am  positing this again as my old post has become quite old by now
and am not sure if it will be seen now by members of this group. I am
hoping that its OK to do this, sorry for any inconvenience
Thank You,

Hello All,
 I found out that in our application we spawn new ACE_Tasks/threads
using THR_NEW_LWP.  I did some reasearch on this and found that it
means create a new LWP process. I used pstack and ps -L commands to
confirm that server spawns multiple LUWs and that each LWP/thread has
its own stack. Now the problem seems to be simplified  in that I can
call _lwp_info() method at the beginning and end of the accounting
interval  (say I want to get %busy  by using 1 hr as accounting
interval so I get usage at beginning of 1 hr and at end) and this
would tell me how much time lwp actually ran something in that 1 hr.
So this means that
%busy = diff/acctint*100. This seems to be reasonable. Any thoughts?
My assumption here is that lwp_info wont include time for waiting
(getq()) or anyother blocking operation) and that lwp theoretically
could have run for 1 hr but it ran only for difference in usage so
above stat represents %busy . Is this good way to look at thread
A problem with this approach is that once we change how we span our
processes the accounting implementation has to be changed.... (I
assume THR_SCOPE_PROCESS means M user threads map to 1 LWP/Kernl
thread, and so this solution wont work, not sure abt
Any comments or insights would be extremely helpful..
Thank You,

On Dec 14, 7:38 pm, sunil <sunilsreenivas2... at yahoo.com> wrote:

- Hide quoted text -
- Show quoted text -

- Hide quoted text -
- Show quoted text -

> Hello,
>         We have an application thats using multiple ACE_Tasks
> (threads) each with their own queue. I want to print something like
> what% of the time each of the threads are doing some work (%busy). A
> simple way to get the time stamp in my svc method after coming out
> wait state from getq()(t1) and get time before it enters getq again
> (t2),
> so it has took t2-t1 (assuming this is to milli seconds) precisions
> (is there an ace timer with milli second pricesion?), add up these
> over some observed time window (of say 10 seconds) and then
> %utilization =
>    sum/obintr *100.
>  The only catch I can see here is that its possible that while thread
> is processing its context switched by OS and so it doesnt really run
> for t2-t1 but for time less than that.  This again depends on the
> native thread library that ACE_Task is wrapping whether its M to N/N
> to 1/1 to 1....
>  Also if we are doing blocking I/O read/write given that we use
> reactor, we are guaranteed to not block/include that time in
> processing time is that correct....
> Any ideas on this stuff?
> Thank you,Sunil

More information about the Ace-users mailing list