Messages in this thread | | | Date | Thu, 20 Jan 2000 10:52:02 +0200 (EET) | From | Sergey Kubushin <> | Subject | Re: CPU usage (Read by `top`) |
| |
On Wed, 19 Jan 2000, Richard B. Johnson wrote:
And my $0.25 - why the shared memory is always reported as 0 bytes? Is it something mentioned somewhere in FAQs? Please give me directions if it is.
> > In linux 2.3.39, if the CPU is given up by calling sched_yield(), even > though the caller may give up the CPU for many milliseconds, `top` > still shows that the caller is using 99% of the CPU time. > > This shows the problem: > > > #include <stdio.h> > #include <sys/time.h> > #define MICRO 1e6 > main() > { > struct timeval tv; > double start; > double stop; > double total; > for(;;) > { > gettimeofday(&tv, NULL); > start = ((double) tv.tv_sec * MICRO) + (double) tv.tv_usec; > sched_yield(); > sched_yield(); > sched_yield(); > sched_yield(); > sched_yield(); > sched_yield(); > sched_yield(); > sched_yield(); > sched_yield(); > sched_yield(); > gettimeofday(&tv, NULL); > stop = ((double) tv.tv_sec * MICRO) + (double) tv.tv_usec; > total = stop - start; > fprintf(stderr,"TT %8.2f us\n", total); > } > } > > Now sched_yield(), itself, works well. The problem is that the task > that gave up the CPU is still being 'Charged' for it! > > Cheers, > Dick Johnson > > Penguin : Linux version 2.3.39 on an i686 machine (800.63 BogoMips). > > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.rutgers.edu > Please read the FAQ at http://www.tux.org/lkml/ >
=========================================================================== Sergey Kubushin aka the Tamer < > The impossible we do immediately. e-mail: ksi@ksi-linux.com SK320-RIPE < > Miracles require 24-hour notice. ===========================================================================
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |