void CBDTWxFrame::RefreshViewMemoryByAddr() { const SMemoryFrameRecord& recordCache = static_cast<CBDTWxApp*>(wxApp::GetInstance())->GetMemoryUICache(); if(recordCache.type == eMFRT_Address || recordCache.type == eMFRT_All) { std::map<void*, SMemoryRecord*>::const_iterator iter = recordCache.recordMap.begin(); std::map<void*, SMemoryRecord*>::const_iterator endIter = recordCache.recordMap.end(); SetGridRowsCount(m_pMemoryDataGrid, recordCache.totalItemCount); int rowIndex = recordCache.startPos; m_memoryRecordCacheStartPos = recordCache.startPos; for (; iter != endIter; ++iter) { uint32_t allocId = iter->second->m_allocId; uint32_t stackOffset = m_pStackOffsetSpinBtn->GetValue(); if (stackOffset > 0) { std::vector<uint32_t> callStack; CMemoryDetector::GetInstance()->GetCallStack((uint32_t)iter->first, callStack); if (callStack.size() > stackOffset) { allocId = callStack[stackOffset]; } else { allocId = callStack.back(); } } IMAGEHLP_LINE info; bool getAddrSuccess = false; bool shouldFilter = FilterTest(allocId, info, getAddrSuccess); if (!shouldFilter) { m_pMemoryDataGrid->SetCellValue(wxString::Format("%p", iter->first),rowIndex, 0); m_pMemoryDataGrid->SetCellValue(wxString::Format("%d", iter->second->m_size),rowIndex, 1); m_pMemoryDataGrid->SetCellValue(wxString::Format("%d", iter->second->m_usage),rowIndex, 2); m_pMemoryDataGrid->SetCellValue(wxString::Format("%d", iter->second->m_allocTime),rowIndex, 3); wxString infoStr = getAddrSuccess ? wxString::Format(_T("%s %d行"), wxString(info.FileName), info.LineNumber) : wxString::Format(_T("未知位置")); bool bValueUpdated = m_pMemoryDataGrid->GetCellValue(rowIndex, 4).CompareTo(infoStr) != 0; if (bValueUpdated) { m_pMemoryDataGrid->SetCellValue(infoStr, rowIndex, 4); } ++rowIndex; } } } else { m_pMemoryDataGrid->ClearGrid(); } }
int main(int argc, char* argv[]) { boost::mpi::environment env(argc, argv); boost::mpi::communicator comm; slctTest(); slctTupleTest(); funcInvokeTest(); MapTest(argc, argv); //ReduceTest(argc, argv); ReduceAllTest(argc, argv); FilterTest(argc, argv); readFileTest(argc, argv); MPIBridgeTest(argc, argv); LoadTest(argc, argv); std::cout<<"All tests passed successfully"<<std::endl; return 0; }
void CBDTWxFrame::RefreshViewMemoryByLocation() { const SMemoryFrameRecord& recordCache = static_cast<CBDTWxApp*>(wxApp::GetInstance())->GetMemoryUICache(); if(recordCache.type == eMFRT_Location || recordCache.type == eMFRT_All) { std::map<uint32_t, std::set<SMemoryRecord*>>::const_iterator iter = recordCache.recordMapForLocation.begin(); std::map<uint32_t, std::set<SMemoryRecord*>>::const_iterator endIter = recordCache.recordMapForLocation.end(); SetGridRowsCount(m_pMemoryDataGrid, recordCache.recordMapForLocation.size()); int rowIndex = recordCache.startPos; m_memoryRecordCacheStartPos = recordCache.startPos; for (; iter != endIter; ++iter) { IMAGEHLP_LINE info; bool getAddrSuccess = false; bool shouldFilter = FilterTest(iter->first, info, getAddrSuccess); if (!shouldFilter) { std::set<SMemoryRecord*>::const_iterator iterSet = iter->second.begin(); uint32_t totalSize = 0; for (; iterSet != iter->second.end(); ++iterSet) { totalSize += (*iterSet)->m_size; } m_pMemoryDataGrid->SetCellValue(wxString::Format("%p", (uint32_t*)iter->first),rowIndex, 0); m_pMemoryDataGrid->SetCellValue(wxString::Format("%d", totalSize),rowIndex, 1); m_pMemoryDataGrid->SetCellValue(wxString::Format("%d", iter->second.size()),rowIndex, 2); wxString infoStr = getAddrSuccess ? wxString::Format(_T("%s %d行"), wxString(info.FileName), info.LineNumber) : wxString::Format(_T("未知位置")); bool bValueUpdated = m_pMemoryDataGrid->GetCellValue(rowIndex, 3).CompareTo(infoStr) != 0; if (bValueUpdated) { m_pMemoryDataGrid->SetCellValue(infoStr, rowIndex, 3); } ++rowIndex; } } } else { m_pMemoryDataGrid->ClearGrid(); } }
void CBDTWxFrame::RefreshViewMemoryByTime() { const SMemoryFrameRecord& recordCache = static_cast<CBDTWxApp*>(wxApp::GetInstance())->GetMemoryUICache(); if(recordCache.type == eMFRT_Time || recordCache.type == eMFRT_All) { std::map<uint32_t, std::set<SMemoryRecord*>>::const_iterator iter = recordCache.recordMapForTime.begin(); std::map<uint32_t, std::set<SMemoryRecord*>>::const_iterator endIter = recordCache.recordMapForTime.end(); std::map<uint32_t, std::set<SMemoryRecord*>>::const_iterator iterForCount = recordCache.recordMapForTime.begin(); SetGridRowsCount(m_pMemoryDataGrid, recordCache.totalItemCount); int rowIndex = recordCache.startPos; m_memoryRecordCacheStartPos = recordCache.startPos; for (; iter != endIter; ++iter) { bool firstRow = true; m_pMemoryDataGrid->SetCellValue(wxString::Format("%d", iter->first),rowIndex, 0); std::set<SMemoryRecord*>::const_iterator iterSet = iter->second.begin(); uint32_t rowCountOnShow = 0; for (; iterSet != iter->second.end(); ++iterSet) { uint32_t allocId = (*iterSet)->m_allocId; uint32_t stackOffset = m_pStackOffsetSpinBtn->GetValue(); if (stackOffset > 0) { std::vector<uint32_t> callStack; CMemoryDetector::GetInstance()->GetCallStack((uint32_t)(*iterSet)->m_pAddress, callStack); if (callStack.size() > stackOffset) { allocId = callStack[stackOffset]; } else { allocId = callStack.back(); } } IMAGEHLP_LINE info; info.SizeOfStruct = sizeof(IMAGEHLP_LINE); bool getAddrSuccess = false; bool shouldFilter = FilterTest(allocId, info, getAddrSuccess); if (!shouldFilter) { if (!firstRow) { m_pMemoryDataGrid->SetCellValue("", rowIndex, 0); } firstRow = false; m_pMemoryDataGrid->SetCellValue(wxString::Format("%p", (uint32_t*)((*iterSet)->m_pAddress)),rowIndex, 1); m_pMemoryDataGrid->SetCellValue(wxString::Format("%d", ((*iterSet)->m_size)),rowIndex, 2); m_pMemoryDataGrid->SetCellValue(wxString::Format("%p", (uint32_t*)(allocId)),rowIndex, 3); //TODO: Try to catch a mystery crash. bool bLineNumberMayOverFlow = getAddrSuccess && info.LineNumber > 100000; bool bFileNameMayBroken = getAddrSuccess && (uint32_t)info.FileName < 10; if (bLineNumberMayOverFlow || bFileNameMayBroken) { BEATS_ASSERT(false); } wxString infoStr = getAddrSuccess ? wxString::Format(_T("%s %d行"), wxString(info.FileName), info.LineNumber) : wxString::Format(_T("未知位置")); //TODO: Try to catch a mystery crash. bLineNumberMayOverFlow = getAddrSuccess && info.LineNumber > 100000; bFileNameMayBroken = getAddrSuccess && (uint32_t)info.FileName < 10; if (bLineNumberMayOverFlow || bFileNameMayBroken) { BEATS_ASSERT(false); } bool bValueUpdated = m_pMemoryDataGrid->GetCellValue(rowIndex, 4).CompareTo(infoStr) != 0; if (bValueUpdated) { m_pMemoryDataGrid->SetCellValue(infoStr, rowIndex, 4); } ++rowCountOnShow; ++rowIndex; } } // if all the rows under the size title are filtered. clear the head. if (rowCountOnShow == 0) { m_pMemoryDataGrid->SetCellValue(wxT(""), rowIndex, 0); } } } else { m_pMemoryDataGrid->ClearGrid(); } }