bool PrintDumpHeader(FILE* out, const char* msg, nsTraceRefcntImpl::StatisticsType type) {
    fprintf(out, "\n== BloatView: %s, %s process %d\n", msg,
            XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid());
    nsTraceRefcntStats& stats =
      (type == nsTraceRefcntImpl::NEW_STATS) ? mNewStats : mAllStats;
    if (gLogLeaksOnly && !HaveLeaks(&stats))
      return false;

    fprintf(out,
        "\n" \
        "     |<----------------Class--------------->|<-----Bytes------>|<----------------Objects---------------->|<--------------References-------------->|\n" \
        "                                              Per-Inst   Leaked    Total      Rem      Mean       StdDev     Total      Rem      Mean       StdDev\n");

    this->DumpTotal(out);

    return true;
  }
  void Dump(int i, FILE* out, nsTraceRefcntImpl::StatisticsType type) {
    nsTraceRefcntStats* stats = (type == nsTraceRefcntImpl::NEW_STATS) ? &mNewStats : &mAllStats;
    if (gLogLeaksOnly && !HaveLeaks(stats)) {
      return;
    }

    double meanRefs, stddevRefs;
    NS_MeanAndStdDev(stats->mAddRefs + stats->mReleases,
                     stats->mRefsOutstandingTotal,
                     stats->mRefsOutstandingSquared,
                     &meanRefs, &stddevRefs);

    double meanObjs, stddevObjs;
    NS_MeanAndStdDev(stats->mCreates + stats->mDestroys,
                     stats->mObjsOutstandingTotal,
                     stats->mObjsOutstandingSquared,
                     &meanObjs, &stddevObjs);

    if ((stats->mAddRefs - stats->mReleases) != 0 ||
        stats->mAddRefs != 0 ||
        meanRefs != 0 ||
        stddevRefs != 0 ||
        (stats->mCreates - stats->mDestroys) != 0 ||
        stats->mCreates != 0 ||
        meanObjs != 0 ||
        stddevObjs != 0) {
      fprintf(out, "%4d %-40.40s %8d %8llu %8llu %8llu (%8.2f +/- %8.2f) %8llu %8llu (%8.2f +/- %8.2f)\n",
              i+1, mClassName,
              (int32_t)mClassSize,
              (nsCRT::strcmp(mClassName, "TOTAL"))
                  ?(uint64_t)((stats->mCreates - stats->mDestroys) * mClassSize)
                  :mTotalLeaked,
              stats->mCreates,
              (stats->mCreates - stats->mDestroys),
              meanObjs,
              stddevObjs,
              stats->mAddRefs,
              (stats->mAddRefs - stats->mReleases),
              meanRefs,
              stddevRefs);
    }
  }
Пример #3
0
  void Dump(int aIndex, FILE* aOut, nsTraceRefcnt::StatisticsType aType)
  {
    nsTraceRefcntStats* stats =
      (aType == nsTraceRefcnt::NEW_STATS) ? &mNewStats : &mAllStats;
    if (gLogLeaksOnly && !HaveLeaks(stats)) {
      return;
    }

    if ((stats->mCreates - stats->mDestroys) != 0 ||
        stats->mCreates != 0) {
      fprintf(aOut, "%4d %-40.40s %8d %8" PRIu64 " %8" PRIu64 " %8" PRIu64 "\n",
              aIndex + 1, mClassName,
              (int32_t)mClassSize,
              (nsCRT::strcmp(mClassName, "TOTAL"))
                ? (uint64_t)((stats->mCreates - stats->mDestroys) * mClassSize)
                : mTotalLeaked,
              stats->mCreates,
              (stats->mCreates - stats->mDestroys));
    }
  }
Пример #4
0
  bool PrintDumpHeader(FILE* aOut, const char* aMsg,
                       nsTraceRefcnt::StatisticsType aType)
  {
    fprintf(aOut, "\n== BloatView: %s, %s process %d\n", aMsg,
            XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid());
    nsTraceRefcntStats& stats =
      (aType == nsTraceRefcnt::NEW_STATS) ? mNewStats : mAllStats;
    if (gLogLeaksOnly && !HaveLeaks(&stats)) {
      return false;
    }

    fprintf(aOut,
            "\n" \
            "     |<----------------Class--------------->|<-----Bytes------>|<----Objects---->|\n" \
            "                                              Per-Inst   Leaked    Total      Rem\n");

    this->DumpTotal(aOut);

    return true;
  }