Skip to contentSkip to conversation

kernel optimization

DISCUSSION Al Boldi 2 participants 2 messages Jul 27, 2005

lore
Share & tools
lore

Al Boldi

author
#0 lore raw

Adrian Bunk wrote: {

Quoted 10 lines · Al Boldi

Dr. Horst H. von Brand wrote: {

Quoted 7 lines · Al Boldi

Adrian Bunk wrote: {

Quoted 3 lines · christos gentsis

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.
}

Quoted 7 lines
Quoted 1 line

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

#1 lore raw
Quoted 3 lines · Al Boldi

Gettimeofday loops using gcc-3.2.2 on 2.4.31 and 2.6.12.

Also, 2.4 is faster than 2.6!

All this proves is that gettimeofday() is faster on 2.4 than 2.6. Hardly surprising.

Lee