Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic DPC latency testing - how?

For real-time multimedia tasks the low latency is essential. A stable low latency value makes it possible to use a computer for making music for example.

As far as I know, under Windows systems there's a DPC latency thing that's quite crucial for ensuring the stability of the latency. You can read more about Deferred Procedure Calls here: http://en.wikipedia.org/wiki/Deferred_Procedure_Call.

As you can read on the Thescyon website,

If any kernel-mode device driver in your Windows system is implemented improperly and causes excessive latencies of Deferred Procedure Calls (DPCs) then probably drop-outs will occur when you use real-time audio or video streaming applications.

They provide a simple tool for checking this which draws a latency graph. When you want to test a Windows computer for pro audio, you should run this DPC latency checker and stress the components that could cause problems. For example when I'm testing laptops, I check what happens with the latency when you

  • switch the wireless on-off or use a wireless connection
  • insert a memory card into a card reader
  • adjust the screen brightness (ACPI-related things can cause a real mess...)

and so on.

My question is, what should I do if I want to check the above automatically? I would like to develop a tool which could test this and generate a report, so we could test a lot of configurations in a short time. (My problems: I don't know how to measure DPC latency and how to automate brightness controlling from code etc.)

Background: I bought a laptop that should be fairly ideal for making music - but it's not, since it produces almost irrational latency problems. In fact, I've consulted with the Focusrite support for months and we weren't able to solve the problem. So I want to help musicians in choosing by creating an easy-to-use testing tool which could clearly says if a computer is okay. Or the better, to create an up-to-date public database with DPC latency informations.

Please support this question to raise DPC awareness - we do need to let manufacturers know that this is a real issue for anyone interested in multimedia on Windows systems.

like image 877
Scorchio Avatar asked May 27 '10 12:05

Scorchio


People also ask

What is DPC Latency Checker?

LatencyMon checks if a system running Windows is suitable for processing real-time audio and other tasks. LatencyMon analyzes the possible causes of buffer underruns by measuring kernel timer latencies and reporting DPC and ISR execution times as well as hard pagefaults.

What is considered good DPC latency?

Low DPC latency will result in a system which is less likely to cause errors in the audio. In practice we are looking for the DPC latency to be consistently well below 1ms (1000µs) to avoid audio glitches.


1 Answers

There are several problems with your Question.

First of all, you cannot really check the DPC latency. You either can queue an own DPC and then check when its executed. Or you can query the time a/all DPCs run (I don't know if you have performance counter information for that, or if have to do sample based profiling).

Even if you have this information, it is very specific to the situation you are in. Furthermore there are several random factors which skew numbers.

A DPC is queued into the global DPC queue, and can be run on any processor. So if you really have a long (-running) DPC on one core, the other core is free to process another. So any timing information is really dependent on the count of processors you have and how many things get currently executed concurrently. So on multicore processors these numbers might vary widely.

Even when you have information about one use case, this is very dependent on the current situation of the system. When its connected to a (large) network, there may be very many small DPCs raised for the network packets that are received by your computer. When you unplug your computer (or everyone goes home) this DPC storm suddenly stops.

NB: When you have a new computer, your DPC latency problem may derive from the c-states your processor sleeps in. The Core-iX processors do really fast into a sleep state from which they wake really slowly.

like image 79
Christopher Avatar answered Sep 28 '22 07:09

Christopher