Bug 1063321 - Print to the console the paths of all files that DMD opens. r=mccr8.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 04 Sep 2014 20:45:22 -0700
changeset 226944 f83374a6c136f7173c616aeea1e11278c96dff9d
parent 226943 a541e12193bfa7da4f6e4b81cbeddb4a7a989e30
child 226945 66b4b04133667946f834e7fd0caf339674f35471
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1063321
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1063321 - Print to the console the paths of all files that DMD opens. r=mccr8.
memory/replace/dmd/DMD.cpp
memory/replace/dmd/DMD.h
xpcom/base/nsMemoryInfoDumper.cpp
--- a/memory/replace/dmd/DMD.cpp
+++ b/memory/replace/dmd/DMD.cpp
@@ -190,17 +190,17 @@ public:
 
 // This is only needed because of the |const void*| vs |void*| arg mismatch.
 static size_t
 MallocSizeOf(const void* aPtr)
 {
   return gMallocTable->malloc_usable_size(const_cast<void*>(aPtr));
 }
 
-static void
+MOZ_EXPORT void
 StatusMsg(const char* aFmt, ...)
 {
   va_list ap;
   va_start(ap, aFmt);
 #ifdef ANDROID
   __android_log_vprint(ANDROID_LOG_INFO, "DMD", aFmt, ap);
 #else
   // The +64 is easily enough for the "DMD[<pid>] " prefix and the NUL.
--- a/memory/replace/dmd/DMD.h
+++ b/memory/replace/dmd/DMD.h
@@ -79,16 +79,20 @@ struct Sizes
   void Clear() { memset(this, 0, sizeof(Sizes)); }
 };
 
 // Gets the size of various data structures.  Used to implement a memory
 // reporter for DMD.
 MOZ_EXPORT void
 SizeOf(Sizes* aSizes);
 
+// Prints a status message prefixed with "DMD[<pid>]". Use sparingly.
+MOZ_EXPORT void
+StatusMsg(const char* aFmt, ...);
+
 // Indicates whether or not DMD is running.
 MOZ_EXPORT bool
 IsRunning();
 
 } // namespace mozilla
 } // namespace dmd
 
 #endif /* DMD_h___ */
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -706,16 +706,25 @@ nsMemoryInfoDumper::OpenDMDFile(const ns
   rv = nsDumpUtils::OpenTempFile(dmdFilename,
                                  getter_AddRefs(dmdFile),
                                  NS_LITERAL_CSTRING("memory-reports"));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   rv = dmdFile->OpenANSIFileDesc("wb", aOutFile);
   NS_WARN_IF(NS_FAILED(rv));
+
+  // Print the path, because on some platforms (e.g. Mac) it's not obvious.
+  nsCString path;
+  rv = dmdFile->GetNativePath(path);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
+  dmd::StatusMsg("opened %s for writing\n", path.get());
+
   return rv;
 }
 
 nsresult
 nsMemoryInfoDumper::DumpDMDToFile(FILE* aFile)
 {
   nsRefPtr<nsGZFileWriter> dmdWriter = new nsGZFileWriter();
   nsresult rv = dmdWriter->InitANSIFileDesc(aFile);