[Support/Timer] Make GetMallocUsage() aware of jemalloc.
[oota-llvm.git] / lib / Fuzzer / FuzzerIO.cpp
index 4e0ac81921878b5cf8ae71e4c9fd6404967aa106..224808c5e16d075b7569ed23ff2387878dd207f1 100644 (file)
@@ -9,6 +9,8 @@
 // IO functions.
 //===----------------------------------------------------------------------===//
 #include "FuzzerInternal.h"
+#include <iostream>
+#include <iterator>
 #include <fstream>
 #include <dirent.h>
 namespace fuzzer {
@@ -31,6 +33,12 @@ Unit FileToVector(const std::string &Path) {
               std::istreambuf_iterator<char>());
 }
 
+void CopyFileToErr(const std::string &Path) {
+  std::ifstream T(Path);
+  std::copy(std::istreambuf_iterator<char>(T), std::istreambuf_iterator<char>(),
+            std::ostream_iterator<char>(std::cerr, ""));
+}
+
 void WriteToFile(const Unit &U, const std::string &Path) {
   std::ofstream OF(Path);
   OF.write((const char*)U.data(), U.size());