コード例 #1
0
ファイル: memory.cpp プロジェクト: ACanadianKernel/pcsx2
bool wxDebugContext::Dump(void)
{
#ifdef __WXDEBUG__
  {
    wxChar* appName = (wxChar*) wxT("application");
    wxString appNameStr;
    if (wxTheApp)
    {
        appNameStr = wxTheApp->GetAppName();
        appName = WXSTRINGCAST appNameStr;
        OutputDumpLine(wxT("----- Memory dump of %s at %s -----"), appName, WXSTRINGCAST wxNow() );
    }
    else
    {
      OutputDumpLine( wxT("----- Memory dump -----") );
    }
  }

  TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL));

  OutputDumpLine(wxEmptyString);
  OutputDumpLine(wxEmptyString);

  return true;
#else
  return false;
#endif
}
コード例 #2
0
ファイル: memory.cpp プロジェクト: Zombiebest/Dolphin
bool wxDebugContext::Dump(void)
{
  {
    const wxChar* appName = wxT("application");
    wxString appNameStr;
    if (wxTheApp)
    {
        appNameStr = wxTheApp->GetAppName();
        appName = appNameStr.c_str();
        OutputDumpLine(wxT("----- Memory dump of %s at %s -----"), appName, static_cast<const wxChar *>(wxNow().c_str()));
    }
    else
    {
      OutputDumpLine( wxT("----- Memory dump -----") );
    }
  }

  TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : NULL));

  OutputDumpLine(wxEmptyString);
  OutputDumpLine(wxEmptyString);

  return true;
}
コード例 #3
0
ファイル: memory.cpp プロジェクト: Zombiebest/Dolphin
bool wxDebugContext::PrintStatistics(bool detailed)
{
  {
    const wxChar* appName = wxT("application");
    wxString appNameStr;
    if (wxTheApp)
    {
        appNameStr = wxTheApp->GetAppName();
        appName = appNameStr.c_str();
        OutputDumpLine(wxT("----- Memory statistics of %s at %s -----"), appName, static_cast<const wxChar *>(wxNow().c_str()));
    }
    else
    {
      OutputDumpLine( wxT("----- Memory statistics -----") );
    }
  }

  bool currentMode = GetDebugMode();
  SetDebugMode(false);

  long noNonObjectNodes = 0;
  long noObjectNodes = 0;
  long totalSize = 0;

  wxDebugStatsStruct *list = NULL;

  wxMemStruct *from = (checkPoint ? checkPoint->m_next : NULL );
  if (!from)
    from = wxDebugContext::GetHead ();

  wxMemStruct *st;
  for (st = from; st != 0; st = st->m_next)
  {
    void* data = st->GetActualData();
    if (detailed && (data != (void*) wxLog::GetActiveTarget()))
    {
      wxChar *className = (wxChar*) wxT("nonobject");
      if (st->m_isObject && st->GetActualData())
      {
        wxObject *obj = (wxObject *)st->GetActualData();
        if (obj->GetClassInfo()->GetClassName())
          className = (wxChar*)obj->GetClassInfo()->GetClassName();
      }
      wxDebugStatsStruct *stats = FindStatsStruct(list, className);
      if (!stats)
      {
        stats = (wxDebugStatsStruct *)malloc(sizeof(wxDebugStatsStruct));
        stats->instanceClass = className;
        stats->instanceCount = 0;
        stats->totalSize = 0;
        list = InsertStatsStruct(list, stats);
      }
      stats->instanceCount ++;
      stats->totalSize += st->RequestSize();
    }

    if (data != (void*) wxLog::GetActiveTarget())
    {
        totalSize += st->RequestSize();
        if (st->m_isObject)
            noObjectNodes ++;
        else
            noNonObjectNodes ++;
    }
  }

  if (detailed)
  {
    while (list)
    {
      OutputDumpLine(wxT("%ld objects of class %s, total size %ld"),
          list->instanceCount, list->instanceClass, list->totalSize);
      wxDebugStatsStruct *old = list;
      list = old->next;
      free((char *)old);
    }
    OutputDumpLine(wxEmptyString);
  }

  SetDebugMode(currentMode);

  OutputDumpLine(wxT("Number of object items: %ld"), noObjectNodes);
  OutputDumpLine(wxT("Number of non-object items: %ld"), noNonObjectNodes);
  OutputDumpLine(wxT("Total allocated size: %ld"), totalSize);
  OutputDumpLine(wxEmptyString);
  OutputDumpLine(wxEmptyString);

  return true;
}