Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.5 KiB

  1. // COUNTERS.CPP
  2. //
  3. // Global performance counters for H.263 video codec
  4. //
  5. // Created 13-Nov-96 [JonT] <for NAC.DLL>
  6. // Added H.263 counters 30-Jan-97 [PhilF]
  7. #include "precomp.h"
  8. #if defined(DECODE_TIMINGS_ON) || defined(ENCODE_TIMINGS_ON) || defined(DETAILED_DECODE_TIMINGS_ON) || defined(DETAILED_ENCODE_TIMINGS_ON) // { #if defined(DECODE_TIMINGS_ON) || defined(ENCODE_TIMINGS_ON) || defined(DETAILED_DECODE_TIMINGS_ON) || defined(DETAILED_ENCODE_TIMINGS_ON)
  9. // Global ICounterMgr. We just use as an CLSID_Counter class factory
  10. ICounterMgr* g_pCtrMgr;
  11. // Define all counters here
  12. ICounter* g_pctrCompressionTimePerFrame;
  13. ICounter* g_pctrDecompressionTimePerFrame;
  14. ICounter* g_pctrBEFTimePerFrame;
  15. // Put these in a .LIB file someday
  16. const IID IID_ICounterMgr = {0x9CB7FE5B,0x3444,0x11D0,{0xB1,0x43,0x00,0xC0,0x4F,0xC2,0xA1,0x18}};
  17. const CLSID CLSID_CounterMgr = {0x65DDC229,0x38FE,0x11d0,{0xB1,0x43,0x00,0xC0,0x4F,0xC2,0xA1,0x18}};
  18. // InitCounters
  19. // Initializes all counters that we want to use
  20. extern "C"
  21. BOOL
  22. WINAPI
  23. InitCounters(void)
  24. {
  25. // Get a pointer to the statistics counter interface if it's around
  26. if (CoCreateInstance(CLSID_CounterMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICounterMgr,
  27. (void**)&g_pCtrMgr) != S_OK)
  28. return FALSE;
  29. // Create counters here
  30. DEFINE_COUNTER(&g_pctrCompressionTimePerFrame, "Compression Time Per Frame (ms)", COUNTER_FLAG_ACCUMULATE);
  31. DEFINE_COUNTER(&g_pctrDecompressionTimePerFrame, "Decompression Time Per Frame (ms)", COUNTER_FLAG_ACCUMULATE);
  32. DEFINE_COUNTER(&g_pctrBEFTimePerFrame, "Block Edge Filtering Time Per Frame (ms)", COUNTER_FLAG_ACCUMULATE);
  33. return TRUE;
  34. }
  35. // DoneCounters
  36. // Cleans up after all counters we wanted to use
  37. extern "C"
  38. void
  39. WINAPI
  40. DoneCounters(void)
  41. {
  42. ICounterMgr* pctrmgr;
  43. // Release the statistics stuff if it's around
  44. if (!g_pCtrMgr)
  45. return;
  46. // Zero out the interface pointer so we don't accidentally use it elsewhere
  47. pctrmgr = g_pCtrMgr;
  48. g_pCtrMgr = NULL;
  49. // Remove counters here
  50. DELETE_COUNTER(&g_pctrCompressionTimePerFrame);
  51. DELETE_COUNTER(&g_pctrDecompressionTimePerFrame);
  52. DELETE_COUNTER(&g_pctrBEFTimePerFrame);
  53. // Done with ICounterMgr
  54. pctrmgr->Release();
  55. }
  56. #endif // } #if defined(DECODE_TIMINGS_ON) || defined(ENCODE_TIMINGS_ON) || defined(DETAILED_DECODE_TIMINGS_ON) || defined(DETAILED_ENCODE_TIMINGS_ON)