Re: [ccache] More win32 patches

2010-09-27 Thread Joel Rosdahl
On 2010-09-27 06:32, Ramiro Polla wrote:
 At first I tried using a naive wrapper of strtok_r() around strtok()
 but I've been bitten by the reentrancy issue. It involved that
 function that hashes multiple commands and find_executable. I'm
 certain my version works, but I'm certain it's a hack too =). I don't
 really mind which replacement is used as long as it works and the
 functions it uses exist/work as expected on win32. I've checked
 quickly and all of strspn, strpbrk, and strchr seem to be available on
 windows.

Right. Now I've actually read your version and I see no problem except
that it requires *saveptr == NULL on the first invocation, which the
real strtok_r doesn't. But if I'm not mistaken, that's easily fixed like
this:

--- a/util.c
+++ b/util.c
@@ -176,7 +176,7 @@ strtok_r(char *str, const char *delim, char **saveptr)
 {
int len;
char *ret;
-   if (*saveptr)
+   if (!str)
str = *saveptr;
len = strlen(str);
ret = strtok(str, delim);

I've applied your patch and the above tweak.

-- Joel
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] More win32 patches

2010-09-26 Thread Joel Rosdahl
On 2010-09-22 05:17, Ramiro Polla wrote:
 I've updated my github fork at:
 http://github.com/ramiropolla/ccache

All applied, except for the strtok_r and AR patches.

 - There is no strtok_r() on Windows, I've implemented an ugly
 replacement using strtok().

I switched to use strtok_r because I needed nested parsing somewhere.
Although I don't see anything in the current code that needs it (I
probably rewrote it), I think we should use a reentrant replacement.
Maybe this: http://www.mail-archive.com/mutt-...@mutt.org/msg03067.html

 - The ar check on configure.ac fails for cross-compilation. I haven't
 investigated why, I've just removed it, but I suppose it's there for a
 reason so it's better to fix than to remove =)

Perhaps already fixed in e1b287d0ca3cdb48a5d3e8b0d46b9af51ee39abe?

 - Make test on Windows requires a certain dd to work (one that can
 emulate /dev/zero). It's the one found here:
 http://www.chrysocome.net/dd

If it's easier, I guess we could use any existing, large enough file
instead of /dev/zero, e.g. ccache.c.

 [...]
 Joel, is there a way we can time how long each part of ccache takes?
 Not just a whole batch of tests, but it would be nice if under a
 certain ifdef we could print to the ccache log the time it takes to
 perform each step.

That would be a nice thing to have. Added to the TODO list.

 It seems to have gotten slower on Windows since the first port I've
 made (either that or FFmpeg has grown a lot too).

Off the top of my head, here are some things that have changed since
3.0pre0 that may affect the speed:

- The parsing in hash_source_code_string. Last time I measured, it's
actually about 2 times slower than the actual hashing, so there's room
for improvement there.
- The parsing in process_preprocessed_file is probably also possible to
improve.
- read() is now used instead of mmap(); maybe it makes a difference on
Windows.

-- Joel
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] More win32 patches

2010-09-26 Thread Ramiro Polla
Hi,

On Sun, Sep 26, 2010 at 5:42 PM, Joel Rosdahl j...@rosdahl.net wrote:
 On 2010-09-22 05:17, Ramiro Polla wrote:
 - There is no strtok_r() on Windows, I've implemented an ugly
 replacement using strtok().

 I switched to use strtok_r because I needed nested parsing somewhere.
 Although I don't see anything in the current code that needs it (I
 probably rewrote it), I think we should use a reentrant replacement.
 Maybe this: http://www.mail-archive.com/mutt-...@mutt.org/msg03067.html

At first I tried using a naive wrapper of strtok_r() around strtok()
but I've been bitten by the reentrancy issue. It involved that
function that hashes multiple commands and find_executable. I'm
certain my version works, but I'm certain it's a hack too =). I don't
really mind which replacement is used as long as it works and the
functions it uses exist/work as expected on win32. I've checked
quickly and all of strspn, strpbrk, and strchr seem to be available on
windows.

 - The ar check on configure.ac fails for cross-compilation. I haven't
 investigated why, I've just removed it, but I suppose it's there for a
 reason so it's better to fix than to remove =)

 Perhaps already fixed in e1b287d0ca3cdb48a5d3e8b0d46b9af51ee39abe?

Yes, that seems to have worked.

 Joel, is there a way we can time how long each part of ccache takes?
 Not just a whole batch of tests, but it would be nice if under a
 certain ifdef we could print to the ccache log the time it takes to
 perform each step.

 That would be a nice thing to have. Added to the TODO list.

If you want to borrow some timing code there are the START_TIMER and
STOP_TIMER macros from ffmpeg (libavutil/timer.h). It's not good for
absolute timings (since the time comes from rdtsc), but it's great if
we want relative times (before and after a change or one part of the
program relative to the other).
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


[ccache] More win32 patches

2010-09-21 Thread Ramiro Polla
Hi,

I've updated my github fork at:
http://github.com/ramiropolla/ccache

- There is no strtok_r() on Windows, I've implemented an ugly
replacement using strtok().
- The ar check on configure.ac fails for cross-compilation. I haven't
investigated why, I've just removed it, but I suppose it's there for a
reason so it's better to fix than to remove =)
- Make test on Windows requires a certain dd to work (one that can
emulate /dev/zero). It's the one found here:
http://www.chrysocome.net/dd
- %APPDATA% is chosen as home on Windows if $HOME is not found. This
makes ccache work on cmd.exe. Could someone please test whether it now
works on CodeBlocks?
- Executables with dots in the filename are now properly found.
- Checks for win32 directories before stat (I faintly remember already
having done something similar before, but out-of-tree builds were no
longer being cache directly).

Joel, is there a way we can time how long each part of ccache takes?
Not just a whole batch of tests, but it would be nice if under a
certain ifdef we could print to the ccache log the time it takes to
perform each step. It seems to have gotten slower on Windows since the
first port I've made (either that or FFmpeg has grown a lot too).

Ramiro Polla
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache