Re: [GIT PULL] perf fixes

From: Ingo Molnar
Date: Thu Sep 12 2013 - 16:43:23 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

> Instead of having 20 testcases crammed into a single Makefile:
>
> comet:~/tip/tools/perf> git grep -w main config/feature-tests.mak
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(int argc, char *argv[])
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
> config/feature-tests.mak:int main(void)
>
> Why not put those into 20x standalone .c files and try to build them as
> an explicit make command attempt from within the main Makefile? If the
> build fails then the feature flag is set to off, if it succeeds it's
> defined.
>
> That makes feature tests generally easier to debug, easier to understand
> and generally easier to extend as well.
>
> 'Feature test binaries' that are already built will be 'cached'
> automatically, and the result of their build attempt will be a quick
> success.

A successfull 'make' attempt of a target file within a separate, simple
Makefile is very, very fast:

comet:~/tip/tools/power/x86/turbostat> perf stat --null --sync --repeat 10
make turbostat
make: `turbostat' is up to date.
make: `turbostat' is up to date.
make: `turbostat' is up to date.
make: `turbostat' is up to date.
make: `turbostat' is up to date.
make: `turbostat' is up to date.
make: `turbostat' is up to date.
make: `turbostat' is up to date.
make: `turbostat' is up to date.
make: `turbostat' is up to date.

Performance counter stats for 'make turbostat' (10 runs):

0.002146182 seconds time elapsed ( +- 0.35% )

That's 2 msecs only. 20 such tests will take less than 50 msecs in the
'cached' case.

Thanks,

Ingo

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