[compiler-rt] r180980 - Use unbuffered I/O. This reduces the runtime by about half. Our implementation is now only about 5 times slower than gcc's.
Bill Wendling
isanbard at gmail.com
Thu May 2 17:25:50 PDT 2013
Author: void
Date: Thu May 2 19:25:49 2013
New Revision: 180980
URL: http://llvm.org/viewvc/llvm-project?rev=180980&view=rev
Log:
Use unbuffered I/O. This reduces the runtime by about half. Our implementation is now only about 5 times slower than gcc's.
Modified:
compiler-rt/trunk/SDKs/darwin/usr/include/stdio.h
compiler-rt/trunk/SDKs/linux/usr/include/stdio.h
compiler-rt/trunk/lib/profile/GCDAProfiling.c
Modified: compiler-rt/trunk/SDKs/darwin/usr/include/stdio.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/SDKs/darwin/usr/include/stdio.h?rev=180980&r1=180979&r2=180980&view=diff
==============================================================================
--- compiler-rt/trunk/SDKs/darwin/usr/include/stdio.h (original)
+++ compiler-rt/trunk/SDKs/darwin/usr/include/stdio.h Thu May 2 19:25:49 2013
@@ -74,6 +74,7 @@ size_t fwrite(const void * __restrict, s
size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
long ftell(FILE *);
int fseek(FILE *, long, int);
+void setbuf(FILE * __restrict, char * __restrict);
int snprintf(char * __restrict, size_t, const char * __restrict, ...);
Modified: compiler-rt/trunk/SDKs/linux/usr/include/stdio.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/SDKs/linux/usr/include/stdio.h?rev=180980&r1=180979&r2=180980&view=diff
==============================================================================
--- compiler-rt/trunk/SDKs/linux/usr/include/stdio.h (original)
+++ compiler-rt/trunk/SDKs/linux/usr/include/stdio.h Thu May 2 19:25:49 2013
@@ -38,5 +38,6 @@ extern size_t fwrite(const void * restri
extern size_t fread(void * restrict, size_t, size_t, FILE * restrict);
extern long ftell(FILE *);
extern int fseek(FILE *, long, int);
+extern void setbuf(FILE * restrict, char * restrict);
#endif /* __STDIO_H__ */
Modified: compiler-rt/trunk/lib/profile/GCDAProfiling.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/GCDAProfiling.c?rev=180980&r1=180979&r2=180980&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/GCDAProfiling.c (original)
+++ compiler-rt/trunk/lib/profile/GCDAProfiling.c Thu May 2 19:25:49 2013
@@ -194,6 +194,9 @@ void llvm_gcda_start_file(const char *or
}
}
+ /* Make the file I/O unbuffered. */
+ setbuf(output_file, (char*)NULL);
+
/* gcda file, version, stamp LLVM. */
fwrite("adcg", 4, 1, output_file);
fwrite(version, 4, 1, output_file);
More information about the llvm-commits
mailing list