From: Rick K. <rk...@nc...> - 2008-01-30 17:09:38
|
Sanjay, The example programs like sampler that are distributed with PerfSuite are not meant to be production-quality tools, but small cases that might be useful for people to see how things work and demonstrate some basic capabilities. However, you might want to think about what's happening underneath if you base something on an example like sampler. It might be helpful for you to take a look at the manual pages for setitimer() and sigaction(), which are used in sampler as building blocks. Here are a few points that may be relevant: 1. For performance data to be printed within sampler, the signal handler that is installed must be triggered by delivery of the signal. The handler itself is the function "sampler". As an aside, this is not typically a good idea to be doing output from within a signal handler but again this is just a toy example program. 2. The sampler program sets interval timers using the ITIMER_VIRTUAL time domain, which is decremented only when the process is executing. If a process is sleeping, it's not accumulating any execution time, and so this timer would likely be decrementing at a much slower rate. 3. The sampler program, in its use of sigaction, does not request that system calls are restarted across signals (see the manual page for sigaction()). I ran some tests and found that even with calls to printf() or sleep() within the busyloop function, output from the signal handler will occur, but not necessarily at the same rate one would expect when running the example unchanged. You might want to play around with it some more to see if you can produce similar results. One other point to raise in case you make some changes is that PAPI, when multiplexing, also uses signals to trigger the timeslicing of counters (in most cases, I believe it uses SIGPROF and ITIMER_PROF). That means some care has to be taken if changing signals and interval timers within sampler. Not trying to be evasive here, but rather, trying to point you in a different direction in terms of how you are thinking things are working with the sampler example. Rick Sanjay H A wrote: > Hello Sir > I got the point. Then I will insert persuite routines in my application to measure performance periodically. > But I am afraid about the test I did with perfsuite sampler program.The thing I noticed is, inside busyloop(), if I insert printf statement or some sleep statement , the performance data will not > be printed on standard output periodically. Any solutions for that? > > Thanx > Regards > Sanjay > > > > |