I'd like to suggest that you use the same bit-width for 'Dummy' as that for 'count', and initialize it to 0, so as to ensure that it won't overflow.
-Robby On Fri, Jan 28, 2011 at 1:52 PM, Slawa Olhovchenkov <s...@zxy.spb.ru> wrote: > On Sat, Jan 29, 2011 at 07:52:11AM +1100, Bruce Evans wrote: > > > >> there are of course several possible answers, including: > > >> > > >> 1/ Sometimes BSD and Linux report things differently. Linux may or may > not > > >> account for the lowest level interrupt tie the same as BSD > > > > > > But I see only 20% idle on FreeBSD and 80% idle on Linux. > > > > The time must be counted somewhere, so when it is not properly accounted > > to packet handling, and nothing much else is running, it is accounted to > > idle. > > > > To see how much CPU is actually available, run something else and see how > > fast it runs. A simple counting loops works well on UP systems. > > === > #include <stdio.h> > #include <sys/time.h> > > int Dummy; > > int > main(int argc, char *argv[]) > { > long int count,i,dt; > struct timeval st,et; > > count = atol(argv[1]); > > gettimeofday(&st, NULL); > for(i=count;i;i--) Dummy++; > gettimeofday(&et, NULL); > dt = (et.tv_sec-st.tv_sec)*1000000 + et.tv_usec-st.tv_usec; > printf("Elapsed %d us\n",dt); > } > === > > This is ok? > > ./loop 2000000000 > > FreeBSD > 1 process: Elapsed 7554193 us > 2 process: Elapsed 14493692 us > netperf + 1 process: Elapsed 21403644 us > > Linux > 1 process: Elapsed 7524843 us > 2 process: Elapsed 14995866 us > netperf + 1 process: Elapsed 14107670 us > > _______________________________________________ freebsd-performance@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-performance To unsubscribe, send any mail to "freebsd-performance-unsubscr...@freebsd.org"