You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though memtrace_x86.c only prints data to the file every 8K memrefs, it still prints them one at time with a separate dr_fprintf call for each one.
Native is instantaneous to gzip this 1.5MB file (created by concatening 10 copies of this build dir's Makefile together):
In some cases the perf difference is 20x or more between using dr_fprintf or using fprintf: for a naive implementation of instruction tracing that prints on every single instruction.
We do document that dr_fprintf is not buffered, but then we use it in examples like memtrace. We should either add buffering to memtrace, switch it to use fprintf from libc, or add buffering to dr_fprintf. We should also review all other places where dr_fprintf is used and we may want to beef up warnings in the docs if we decide not to add buffering.
The text was updated successfully, but these errors were encountered:
In memtrace(), using dr_snprintf() to write to a buffer inside the loop and then printing the buffer with dr_write_file() is better than dr_fprintf() on each iteration but still slower than libc fprintf:
Of course, turning off READABLE_TRACE and avoiding any printf (just a raw dr_write_file) results in a much, much faster runtime and a 639MB file instead of 1.5GB:
Even though memtrace_x86.c only prints data to the file every 8K memrefs, it still prints them one at time with a separate dr_fprintf call for each one.
Native is instantaneous to gzip this 1.5MB file (created by concatening 10 copies of this build dir's Makefile together):
Here's memtrace_x86 from TOT:
And here's with buffering, basically calling fdopen(data->log, "w") and calling fprintf on the resulting FILE* instead of using dr_fprintf:
That is a big difference, 4.6x. The trace log file created is 1.5GB.
Here's the client with the printing removed, showing all the time spent is there and not in the instrumentation:
In some cases the perf difference is 20x or more between using dr_fprintf or using fprintf: for a naive implementation of instruction tracing that prints on every single instruction.
We do document that dr_fprintf is not buffered, but then we use it in examples like memtrace. We should either add buffering to memtrace, switch it to use fprintf from libc, or add buffering to dr_fprintf. We should also review all other places where dr_fprintf is used and we may want to beef up warnings in the docs if we decide not to add buffering.
The text was updated successfully, but these errors were encountered: