aboutsummaryrefslogtreecommitdiffstats
path: root/erts/lib_src/common
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-10-13 13:28:25 +0200
committerBjörn Gustavsson <[email protected]>2017-10-18 14:05:00 +0200
commit360d26b21c169b0c88d6ca43265cbcfa3ce9ef74 (patch)
tree7476c8aaed61a5f788f635c2d46807df72bab6cc /erts/lib_src/common
parentb73c4d012e122547c896f64d92ef9af3e531433e (diff)
downloadotp-360d26b21c169b0c88d6ca43265cbcfa3ce9ef74.tar.gz
otp-360d26b21c169b0c88d6ca43265cbcfa3ce9ef74.tar.bz2
otp-360d26b21c169b0c88d6ca43265cbcfa3ce9ef74.zip
Buffer writing of crash dumps
Writing of crash dumps were done using unbuffered IO. This is slow since many small writes are done. Use a FILE* with an allocated buffer to obtain buffered IO. I wrote a small test program that created 50000 binaries of 200 bytes each and then created a crash dump. The crash dumping was an order of magnitude faster with buffered IO than without.
Diffstat (limited to 'erts/lib_src/common')
-rw-r--r--erts/lib_src/common/erl_printf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/erts/lib_src/common/erl_printf.c b/erts/lib_src/common/erl_printf.c
index 7781fc2196..3b073bcd1b 100644
--- a/erts/lib_src/common/erl_printf.c
+++ b/erts/lib_src/common/erl_printf.c
@@ -147,8 +147,8 @@ write_f_add_cr(void *vfp, char* buf, size_t len)
return len;
}
-static int
-write_f(void *vfp, char* buf, size_t len)
+int
+erts_write_fp(void *vfp, char* buf, size_t len)
{
ASSERT(vfp);
#ifdef PUTC_ON_SMALL_WRITES
@@ -257,7 +257,7 @@ erts_printf(const char *format, ...)
FLOCKFILE(stdout);
res = erts_printf_format(erts_printf_add_cr_to_stdout
? write_f_add_cr
- : write_f,
+ : erts_write_fp,
(void *) stdout,
(char *) format,
arglist);
@@ -285,7 +285,7 @@ erts_fprintf(FILE *filep, const char *format, ...)
else if (erts_printf_add_cr_to_stderr && filep == stderr)
fmt_f = write_f_add_cr;
else
- fmt_f = write_f;
+ fmt_f = erts_write_fp;
FLOCKFILE(filep);
res = erts_printf_format(fmt_f,(void *)filep,(char *)format,arglist);
FUNLOCKFILE(filep);
@@ -390,7 +390,7 @@ erts_vprintf(const char *format, va_list arglist)
errno = 0;
res = erts_printf_format(erts_printf_add_cr_to_stdout
? write_f_add_cr
- : write_f,
+ : erts_write_fp,
(void *) stdout,
(char *) format,
arglist);
@@ -414,7 +414,7 @@ erts_vfprintf(FILE *filep, const char *format, va_list arglist)
else if (erts_printf_add_cr_to_stderr && filep == stderr)
fmt_f = write_f_add_cr;
else
- fmt_f = write_f;
+ fmt_f = erts_write_fp;
res = erts_printf_format(fmt_f,(void *)filep,(char *)format,arglist);
}
return res;