summaryrefslogtreecommitdiff
path: root/lib/profile/GCDAProfiling.c
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-05-03 00:25:49 +0000
committerBill Wendling <isanbard@gmail.com>2013-05-03 00:25:49 +0000
commitd83a6d8bafbf2afa3ebcf9e006bf0c7414f9b2dc (patch)
tree0bd04f2d76770370749cf1fd28807bf61741f83e /lib/profile/GCDAProfiling.c
parent2b26c909424953af8fa443d075e27e68c1571be4 (diff)
Use unbuffered I/O. This reduces the runtime by about half. Our implementation is now only about 5 times slower than gcc's.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@180980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/GCDAProfiling.c')
-rw-r--r--lib/profile/GCDAProfiling.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/profile/GCDAProfiling.c b/lib/profile/GCDAProfiling.c
index 653f641f7..3e0fff25f 100644
--- a/lib/profile/GCDAProfiling.c
+++ b/lib/profile/GCDAProfiling.c
@@ -194,6 +194,9 @@ void llvm_gcda_start_file(const char *orig_filename, const char version[4]) {
}
}
+ /* 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);