RE: kernel optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adrian Bunk wrote: {
On Tue, Jul 26, 2005 at 08:22:59AM +0300, Al Boldi wrote:
> Dr. Horst H. von Brand wrote: {
> Al Boldi <[email protected]> wrote:
> >  Adrian Bunk wrote: {
> > On Fri, Jul 22, 2005 at 07:55:48PM +0100, christos gentsis wrote:
> > > i would like to ask if it possible to change the optimization of the 
> > > kernel from -O2 to -O3 :D, how can i do that? if i change it to the 
> > > top level Makefile does it change to all the Makefiles?
> > And since it's larger, it's also slower.
> > }
> 
> > It's faster but it's flawed.  Root-NFS boot failed!
> 
> How do you know that it is faster if it is busted?
> }
> 
> The -O3 compile produces a faster kernel, which seems to work perfectly,
> albeit the Root-NFS boot flaw!

How did you measure that you that your -O3 kernel isn't slower?
}

Gettimeofday loops using gcc-3.2.2 on 2.4.31 and 2.6.12.

Also, 2.4 is faster than 2.6!

Try this:

#define __USE_GNU
#include <stdio.h>
#include <sys/time.h>

unsigned long elapsed(int start) {

	static struct timeval s,e;

	if (start) return gettimeofday(&s, NULL);

	gettimeofday(&e, NULL);

	return ((e.tv_sec - s.tv_sec) * 1000 + (e.tv_usec - s.tv_usec) /
1000);

}

int main(int argc, char *argv[]) {

	int i;
	
	elapsed(1);
	for (i = 0; elapsed(0) < 100; i++) {
		int ret = i;

		if (ret > i)
			break;
		else if (ret < 0) {
			perror("not here");
			break;
		}
		ret++;
	}

	printf("Elapsed: %lu in %lums %lu/ms",i,elapsed(0),i/elapsed(0));

	int tmo=i;

	elapsed(1);
	for (i = 0; i < 100*tmo ; i++) {
		int ret = i;

		if (ret > i)
			break;
		else if (ret < 0) {
			perror("not here");
			break;
		}
		ret++;
	}

	printf(" - %lu/ms",i/elapsed(0));

	elapsed(1);
	for (i = 0; i < 100*tmo ; i++);

	printf(" - %lu/ms\n",i/elapsed(0));

	return 0;
}

--
Al

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux