On Aug 21, 2013, at 10:45 PM, sun york-R58495 wrote:

> 
> On Aug 21, 2013, at 10:02 PM, Marek Vasut wrote:
> 
>> Dear sun york-R58495,
>> 
>>> On Aug 21, 2013, at 7:51 PM, Marek Vasut wrote:
>>>> Dear York Sun,
>>>> 
>>>>> On 05/20/2013 10:25 AM, Marek Vasut wrote:
>>>>>> Prefix HOSTCC and CC with CCACHE variable to allow easy use of ccache.
>>>>>> In case the user wants to use ccache, exporting CCACHE=ccache will do
>>>>>> the trick. It is of course possible to either make the cross-compiler
>>>>>> name into a shellscript which invokes the ccache and the compiler, but
>>>>>> setting this variable makes use of ccache easier and more convenient.
>>>>>> 
>>>>>> Using ccache becomes convenient when using MAKEALL for large build
>>>>>> tests, where the speedup after building the cache for the first time
>>>>>> is about 4-6 times.
>>>>>> 
>>>>>> Signed-off-by: Marek Vasut <ma...@denx.de>
>>>>>> Cc: Tom Rini <tr...@ti.com>
>>>>>> 
>>>>>> ---
>>>>>> config.mk |    8 +++++---
>>>>>> 
>>>>>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>>>>> 
>>>>>> diff --git a/config.mk b/config.mk
>>>>>> index 1fd109f..d59ded2 100644
>>>>>> --- a/config.mk
>>>>>> +++ b/config.mk
>>>>>> @@ -98,6 +98,8 @@ else
>>>>>> 
>>>>>> HOSTCC           = gcc
>>>>>> endif
>>>>>> 
>>>>>> +HOSTCC          := $(CCACHE) $(HOSTCC)
>>>>>> +
>>>>>> 
>>>>>> ifeq ($(HOSTOS),cygwin)
>>>>>> HOSTCFLAGS       += -ansi
>>>>>> endif
>>>>>> 
>>>>>> @@ -140,13 +142,13 @@ binutils-version = $(shell $(SHELL)
>>>>>> $(SRCTREE)/tools/binutils-version.sh $(AS))
>>>>>> 
>>>>>> #
>>>>>> # Include the make variables (CC, etc...)
>>>>>> #
>>>>>> 
>>>>>> -AS      = $(CROSS_COMPILE)as
>>>>>> +AS      = $(CCACHE) $(CROSS_COMPILE)as
>>>>>> 
>>>>>> # Always use GNU ld
>>>>>> LD       = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \
>>>>>> 
>>>>>>          then echo "$(CROSS_COMPILE)ld.bfd"; else echo
>>>> 
>>>> "$(CROSS_COMPILE)ld";
>>>> 
>>>>>>          fi;)
>>>>>> 
>>>>>> -CC      = $(CROSS_COMPILE)gcc
>>>>>> +CC      = $(CCACHE) $(CROSS_COMPILE)gcc
>>>>>> 
>>>>>> CPP      = $(CC) -E
>>>>>> AR       = $(CROSS_COMPILE)ar
>>>>>> NM       = $(CROSS_COMPILE)nm
>>>>>> 
>>>>>> @@ -320,7 +322,7 @@ endif
>>>>>> 
>>>>>> #######################################################################
>>>>>> # #
>>>>>> 
>>>>>> -export  HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE
>>>> 
>>>> \
>>>> 
>>>>>> +export  HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE
>>>>>> CCACHE \
>>>>>> 
>>>>>>  AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
>>>>>> 
>>>>>> export   CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS
>>>> 
>>>> CPPFLAGS
>>>> 
>>>>>> CFLAGS AFLAGS
>>>>> 
>>>>> Where did this patch go? I found it useful.
>>>> 
>>>> It needs additional fixes, try running with MAKEALL and you will see the
>>>> problem -- the problem is you would need separate ccache for each
>>>> MAKEALL thread.
>>> 
>>> I didn't use this patch but I modified config.mk as this patch did. MAKEALL
>>> works fine for "-a powerpc". It cuts my compiling time more than half for
>>> 660+ boards.
>> 
>> That is still poor, it should be much faster. If you use separate ccache for 
>> each board, then it will be _much_ more performant.
>> 
>> The problem is that when rebuilding all of those 680 configurations, the 
>> cached 
>> files get replaced by ones based on different board config all the time => 
>> you 
>> need to rebuild them => you loose performance.
>> 
> 
> I kind of get it. I have to increase my ccache size a lot (more than 2GB) to 
> get consistent cache hit. I thought that was because I was using out-of-tree 
> build when setting BUILD_NBUILDS. For the first time I run MAKEALL with 
> ccache, it was completely miss. I mean zero hit. It would be nice to be able 
> hit the cache. I was read the ccache document to understand how the path is 
> involved when calculating the hash. How do you plan to make it work?
> 
I forgot to mention, if the ccache size is at default (1GB), I don't see any 
performance improvement by using ccache. I think that's what you meant the 
cached files get replaced. I don't understand what you mean to use separated 
ccache for each board. Would it be equivalent to have a big cache? I was 
compiling with and without BUILD_NBUILDS, and my cache size is more than 3GB 
now. I could see the improvement by 2x~3x faster, but not more. 

York



_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to