[ccache] ccacje direct mode without fall back to running the preprocessor

vkr venkatakrishnarao.ks at gmail.com
Mon Sep 8 04:37:52 MDT 2014


Hi Andrew
It seems to me that I can switch off preprocessing in a read-only
ccache mode, after a direct lookup fail.
How do you see the following patch?

If the env variable TRS_CCACHE_NO_PREPROCESSOR_ON_DIRECT_LOOKUP_MISS is set
then, I do not run preprocessing, but just fall back to running real-compiler.

I see a lot of time saving, and I can't think of any side-effect.

Your comments on this are very much appreciated. Thank you!.

--- ccache-3.1.9/ccache.c       2013-01-06 22:27:59.000000000 +0530
+++ ccache-3.1.9_patched/ccache.c   2014-09-08 15:55:49.000000000 +0530
@@ -2029,6 +2029,14 @@
        }
  }

+
+ if (getenv("CCACHE_READONLY")) {
+   if (getenv("TRS_CCACHE_NO_PREPROCESSOR_ON_DIRECT_LOOKUP_MISS")) {
+       cc_log("TRS; Lets no run preprocessor in read-only mode, as it
goes in vain. Running real-compiler.");
+       failed();
+          }
+         }
+
  /*
   * Find the hash using the preprocessed output. Also updates
   * included_files.


On Fri, Sep 5, 2014 at 2:51 PM, vkr <venkatakrishnarao.ks at gmail.com> wrote:
> Hello
> First of all, sorry about the typo in the subject/title of my post.
>
> I run ccache in read-only mode itself. But, I still see that after the
> direct cache lookup fail, it falls back to running the preprocessor.
> That's exactly what I wanted to avoid.
>
> It seems to me that having an option to avoid preprocessing after a
> direct-cache-lookup fail is still a very valid option if the user
> knows that preprocesor will result in a failure/he purposefully wants
> to avoid it.
> I hope my justification is valid.
>
>  88 [2014-09-05T14:45:17.445383 25208] Hostname: host.myhost.net
>  89 [2014-09-05T14:45:17.445393 25208] Working directory: (null)
>  90 [2014-09-05T14:45:17.445399 25208] Base directory:
> /var/fpwork/workspace_venkrao/release
>  91 [2014-09-05T14:45:17.445734 25208] Source file: ../my_source.cpp
>  92 [2014-09-05T14:45:17.445745 25208] Dependency file: ../my_source.d
>  93 [2014-09-05T14:45:17.445752 25208] Object file: ../my_source.cpp.o
>  94 [2014-09-05T14:45:17.447011 25208] Trying direct lookup
>  95 [2014-09-05T14:45:17.447167 25208] Looking for object file hash in
> /disk1/ccache_cache_store/transport_release/175750/0/5/eb2b36e5e9d0bb723de833a4529cab-11859.manifest
>  96 [2014-09-05T14:45:17.479757 25204] Looking for object file hash in
> /disk1/ccache_cache_store/transport_release/175750/6/6/e186baaf3c2e9e06619878dac77fe1-114310.manifest
>  97 [2014-09-05T14:45:17.863524 25194] Did not find object file hash in manifest
>  98 [2014-09-05T14:45:17.864854 25194] Running preprocessor
>
>
>
> Regards,
> venkrao
>
> On Fri, Sep 5, 2014 at 1:51 AM, Andrew Stubbs <ams at codesourcery.com> wrote:
>> On 04/09/14 08:32, vkr wrote:> I would like to know if I can avoid
>>> "If there is no match, ccache falls back to running the preprocessor."
>>
>> The answer is "no", because it is necessary to run the preprocessor in order
>> to fill the cache and record the file list that direct mode lookups use.
>>
>> It might be possible if you wanted to run the cache in read-only mode, but
>> that might not be very useful, and I don't believe there's an option for
>> that now.
>>
>> Andrew


More information about the ccache mailing list