Personal tools


From AC3Filter
Revision as of 11:29, 31 August 2010 by Valex (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CPUMeter is a DirectShow filter that measures CPU usage of a filter chain.

How it works

Filter measures CPU usage of the filter chain connected to its output:

Pic 1: Real-time CPU usage measurement

In this example CPUMeter measures the time spent at AC3Filter and Renderer filters in the real time. To measure the total decoding time and get rid of the renderer influence you can use NullRenderer:

Pic 2: Decoding to NullRenderer

Note, that rendering goes as fast as possible (due to Hyper Threading only 50% of the CPU used). When the processing finishes you can see the total CPU time used by the filter to decode the test file.

In a complex graph you can use 2 CPUMeters to know the execution time of the certain filter:

Pic 3: Measuring a single filter in a complex graph

Here you can see a recompressing graph that uses AC3Filter to process the audio track before compressing. Processing and compression took 28.9s, and Lame spent 25.5s. So AC3Filter used 3.4s.

CPUMeter uses GetThreadTimes() function to get timing information. It shows the sum of kernel and user times. Important! CPUMeter measures only the processing thread, so it does not work when the filter being measured uses separate worker threads.

Sample utility

CPUMeter comes with a sample application with the source code that shows how to use CPUMeter programmatically for an automated testing. It is a command-line utility that builds the graph like shown on the Picture 2. You can specify any file and any filter to test. After processing you can see how much CPU time did the filter use.

Example: How much CPU time AC3Filter uses to decode the track from an .avi file?

Pic 4: Using 'measure' utility


Contact directly.