Changeset 839
- Timestamp:
- Mar 30, 2018, 10:19:28 AM (5 years ago)
- Location:
- trunk/DirectShowSpy
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DirectShowSpy/DirectShowSpy.vcxproj
r831 r839 160 160 <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> 161 161 <MinimalRebuild>true</MinimalRebuild> 162 <ExceptionHandling>Async</ExceptionHandling>163 162 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> 164 163 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> … … 206 205 <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> 207 206 <MinimalRebuild>true</MinimalRebuild> 208 <ExceptionHandling>Async</ExceptionHandling>209 207 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> 210 208 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> … … 259 257 <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> 260 258 <StringPooling>true</StringPooling> 261 <ExceptionHandling>Async</ExceptionHandling>262 259 <RuntimeLibrary>MultiThreaded</RuntimeLibrary> 263 260 <PrecompiledHeader>Use</PrecompiledHeader> … … 313 310 <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> 314 311 <StringPooling>true</StringPooling> 315 <ExceptionHandling>Async</ExceptionHandling>316 312 <RuntimeLibrary>MultiThreaded</RuntimeLibrary> 317 313 <PrecompiledHeader>Use</PrecompiledHeader> … … 368 364 <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;_TRACE=1;_TRACELEVEL=4;%(PreprocessorDefinitions)</PreprocessorDefinitions> 369 365 <StringPooling>true</StringPooling> 370 <ExceptionHandling>Async</ExceptionHandling>371 366 <RuntimeLibrary>MultiThreaded</RuntimeLibrary> 372 367 <PrecompiledHeader>Use</PrecompiledHeader> … … 422 417 <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;_TRACE=1;_TRACELEVEL=4;%(PreprocessorDefinitions)</PreprocessorDefinitions> 423 418 <StringPooling>true</StringPooling> 424 <ExceptionHandling>Async</ExceptionHandling>425 419 <RuntimeLibrary>MultiThreaded</RuntimeLibrary> 426 420 <PrecompiledHeader>Use</PrecompiledHeader> -
trunk/DirectShowSpy/FilterGraphSpy.h
r831 r839 638 638 CComPtr<IUnknown> m_pSite; 639 639 CStringW m_sFriendlyName; 640 641 static VOID TraceProcessPerformance(LPCTSTR pszDescription = NULL, BOOL bForce = FALSE) 642 { 643 pszDescription; 644 #if _DEVELOPMENT || _TRACE 645 const ULONG nTime = GetTickCount(); 646 MEMORYSTATUSEX MemoryStatus = { sizeof MemoryStatus }; 647 const BOOL bGlobalMemoryStatusExResult = GlobalMemoryStatusEx(&MemoryStatus); 648 PROCESS_MEMORY_COUNTERS_EX Counters = { sizeof Counters }; 649 const BOOL bGetProcessMemoryInfoResult = GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*) &Counters, sizeof Counters); 650 _A(bGlobalMemoryStatusExResult && bGetProcessMemoryInfoResult); 651 BOOL bReportGlobalMemoryStatusEx = FALSE, bReportGetProcessMemoryInfo = FALSE; 652 #pragma region Reduce Similar Traces 653 { 654 _A(_pAtlModule); 655 CComCritSecLock<CComCriticalSection> Lock(_pAtlModule->m_csStaticDataInitAndTypeInfo); 656 static ULONG g_nReportTime = 0; 657 static MEMORYSTATUSEX g_MemoryStatus; 658 static PROCESS_MEMORY_COUNTERS_EX g_Counters; 659 #if !defined(_DEBUG) 660 if(bForce || !g_nReportTime || nTime - g_nReportTime >= 15 * 1000) // 15 seconds 661 { 662 bReportGlobalMemoryStatusEx = bGlobalMemoryStatusExResult; 663 bReportGetProcessMemoryInfo = bGetProcessMemoryInfoResult; 664 } else 665 { 666 #pragma region MEMORYSTATUSEX 667 if(fabs(((DOUBLE) MemoryStatus.dwMemoryLoad - g_MemoryStatus.dwMemoryLoad) / ((MemoryStatus.dwMemoryLoad + g_MemoryStatus.dwMemoryLoad) / 2)) > 0.05) // 5% 668 bReportGlobalMemoryStatusEx = TRUE; 669 else 670 if(fabs(((DOUBLE) MemoryStatus.ullAvailVirtual - g_MemoryStatus.ullAvailVirtual) / ((MemoryStatus.ullAvailVirtual + g_MemoryStatus.ullAvailVirtual) / 2)) > 0.05) // 5% 671 bReportGlobalMemoryStatusEx = TRUE; 672 #pragma endregion 673 #pragma region PROCESS_MEMORY_COUNTERS_EX 674 if(fabs(((DOUBLE) Counters.WorkingSetSize - g_Counters.WorkingSetSize) / ((Counters.WorkingSetSize + g_Counters.WorkingSetSize) / 2)) > 0.05) // 5% 675 bReportGetProcessMemoryInfo = TRUE; 676 else 677 if(fabs(((DOUBLE) Counters.PrivateUsage - g_Counters.PrivateUsage) / ((Counters.PrivateUsage + g_Counters.PrivateUsage) / 2)) > 0.05) // 5% 678 bReportGetProcessMemoryInfo = TRUE; 679 #pragma endregion 680 } 681 #else 682 bReportGlobalMemoryStatusEx = bGlobalMemoryStatusExResult; 683 bReportGetProcessMemoryInfo = bGetProcessMemoryInfoResult; 684 #endif // !defined(_DEBUG) 685 if(bReportGlobalMemoryStatusEx) 686 g_MemoryStatus = MemoryStatus; 687 if(bReportGetProcessMemoryInfo) 688 g_Counters = Counters; 689 if(bReportGlobalMemoryStatusEx || bReportGetProcessMemoryInfo) 690 g_nReportTime = nTime; 691 } 692 #pragma endregion 693 CString sDescription = pszDescription; 694 if(!sDescription.IsEmpty()) 695 sDescription.Append(_T(": ")); 696 if(bReportGlobalMemoryStatusEx) 697 { 698 _Z2(atlTraceGeneral, 2, _T("%s") _T("Memory Status, ") 699 _T("dwMemoryLoad %d") _T(", ") 700 _T("ullTotalVirtual %s MB") _T(", ") 701 _T("ullAvailVirtual %s MB (in use %s MB)") //_T(", ") 702 _T("\n"), 703 sDescription, 704 MemoryStatus.dwMemoryLoad, 705 _StringHelper::FormatNumber((LONGLONG) MemoryStatus.ullTotalVirtual >> 20), 706 _StringHelper::FormatNumber((LONGLONG) MemoryStatus.ullAvailVirtual >> 20), _StringHelper::FormatNumber((LONGLONG) (MemoryStatus.ullTotalVirtual - MemoryStatus.ullAvailVirtual) >> 20), 707 0); 708 } 709 if(bReportGetProcessMemoryInfo) 710 { 711 _Z2(atlTraceGeneral, 2, _T("%s") _T("Process Performance, ") 712 _T("WorkingSetSize %s MB (peak %s MB)") _T(", ") 713 _T("PrivateUsage %s MB") //_T(", ") 714 _T("\n"), 715 sDescription, 716 _StringHelper::FormatNumber((LONGLONG) Counters.WorkingSetSize >> 20), _StringHelper::FormatNumber((LONGLONG) Counters.PeakWorkingSetSize >> 20), 717 _StringHelper::FormatNumber((LONGLONG) Counters.PrivateUsage >> 20), 718 0); 719 } 720 #endif // _DEVELOPMENT || _TRACE 721 } 640 722 641 723 BOOL IsAggregated() const … … 1167 1249 return S_OK; 1168 1250 } 1251 STDMETHOD(CreateFilterGraphHelper)(IFilterGraphHelper** ppFilterGraphHelper) override 1252 { 1253 _Z4(atlTraceCOM, 4, _T("this 0x%p\n"), this); 1254 _ATLTRY 1255 { 1256 __D(ppFilterGraphHelper, E_POINTER); 1257 *ppFilterGraphHelper = NULL; 1258 CObjectPtr<CFilterGraphHelper> pFilterGraphHelper; 1259 pFilterGraphHelper.Construct()->SetFilterGraph(this); 1260 *ppFilterGraphHelper = pFilterGraphHelper.Detach(); 1261 } 1262 _ATLCATCHALL() 1263 { 1264 _Z_EXCEPTION(); 1265 } 1266 return S_OK; 1267 } 1169 1268 1170 1269 // ISpyEx … … 1402 1501 OnRun(pT, &bDefault); 1403 1502 HOOK_EPILOG() 1503 TraceProcessPerformance(_T("Before IMediaControl::Run")); 1404 1504 const HRESULT nRunResult = m_pInnerMediaControl->Run(); 1405 1505 _Z4_DSHRESULT(nRunResult); 1506 TraceProcessPerformance(_T("After IMediaControl::Run")); 1406 1507 return nRunResult; 1407 1508 } … … 1422 1523 OnPause(pT, &bDefault); 1423 1524 HOOK_EPILOG() 1424 return m_pInnerMediaControl->Pause(); 1525 TraceProcessPerformance(_T("Before IMediaControl::Pause")); 1526 const HRESULT nPauseResult = m_pInnerMediaControl->Pause(); 1527 _Z4_DSHRESULT(nPauseResult); 1528 TraceProcessPerformance(_T("After IMediaControl::Pause")); 1529 return nPauseResult; 1425 1530 } 1426 1531 STDMETHOD(Stop)() override … … 1430 1535 OnStop(pT, &bDefault); 1431 1536 HOOK_EPILOG() 1432 return m_pInnerMediaControl->Stop(); 1537 TraceProcessPerformance(_T("Before IMediaControl::Stop")); 1538 const HRESULT nStopResult = m_pInnerMediaControl->Stop(); 1539 _Z4_DSHRESULT(nStopResult); 1540 TraceProcessPerformance(_T("After IMediaControl::Stop")); 1541 return nStopResult; 1433 1542 } 1434 1543 STDMETHOD(GetState)(LONG nTimeout, OAFilterState* pState) override … … 1516 1625 if(nEventCode == EC_ERRORABORTEX && nParameter2) 1517 1626 _Z4(atlTraceGeneral, 4, _T("nParameter2 \"%s\"\n"), CString((BSTR) nParameter2)); 1627 TraceProcessPerformance(_FilterGraphHelper::FormatEventCode(nEventCode), TRUE); 1518 1628 static CConstIntegerRegistryValue g_nErrorAbortMiniDumpMode(_T("ErrorAbort MiniDump Mode")); // 0 Default (=1), 1 Disabled, 2 Enabled 1519 1629 if((DWORD) g_nErrorAbortMiniDumpMode == 2) // Enabled -
trunk/DirectShowSpy/Module.idl
r617 r839 64 64 HRESULT RegisterComment([in] IUnknown* pBaseFilterUnknown, [in] const WCHAR* pszStreamName, [in] const WCHAR* pszComment, [in] USHORT nHighlight); 65 65 }; 66 interface IFilterGraphHelper; 66 67 [ 67 68 object, … … 85 86 [id(8)] HRESULT ReadRunPropertyBag([in] IUnknown* pBaseFilterUnknown, [in] VARIANT_BOOL bAllowExtension, [out, retval] VARIANT* pvValue); 86 87 [id(9)] HRESULT CreateMediaSampleTrace([out, retval] IMediaSampleTrace** ppMediaSampleTrace); 88 [id(10)] HRESULT CreateFilterGraphHelper([out, retval] IFilterGraphHelper** ppFilterGraphHelper); 87 89 }; 88 90 [ -
trunk/DirectShowSpy/Module.ini
r833 r839 4 4 ;Language=133 ;MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US) 5 5 ;Version String Format=%d.%d.%d.%d 6 Current Build Number=213 46 Current Build Number=2138
Note: See TracChangeset
for help on using the changeset viewer.