Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to diagnose a runaway driver issue
Sometimes a driver may go haywire and start eating up CPU badly, generally due to programming error, or so the cynics claim, though we generally hold to the view that we are without error. You will see in the task list that CQCServer.exe, the program that hosts all the drivers, is using excessive CPU. It may legitimately bounce up a little high periodically, but if it is steadily eating up a CPU core, or close to that, then something is awry.

It can be a bit of a problem to figure out which driver is the culprit. You can of course just go through and pause each one until the CPU usage goes away. But that's both tedious and disruptive of a deployed system. It would be nice to be about to figure out which specific driver it is (or perhaps multiple drivers.) This can be done using the instructions below.

Driver Thread Id

If you open the Host Admin dialog, where you load/unload/etc... drivers in the Admin Intf program, when you select a driver, you will see on the lower right a Thread Id value. Each driver runs on its own thread within the CQCServer process. This means that, if we can identify the thread id of the thread that is eating the CPU, we can match that to a driver.

Performance Monitor

Windows includes a tool that will let us do that. It's called Perfmon.exe. If you go to the Start Menu and in the direct invocation box at the bottom type in PerfMon and hit enter, it'll bring up the performance monitor. The trick now is to make it show us the info we want. Here is how you do it (at least it's like this on Windows 7, and likely to be about the same on anything XP and forward I think.)

1.On the left side, expand Monitoring Tools and select Peformance Monitor. This is a live display of what it calls 'counters'. Counters are just values being collected, they often aren't actually counting anything.

2. Click the big + sign in the tool bar on the top right, to add new ones, taking you to the Add Counters dialog box. Here you get to select a computer (local computer is the default and presumably you are doing this on the machine where the driver is loaded.) So keep that default.

3. We now need to select what we want to see. Scroll down in the list to the one that says Thread. Usually Processor is initiallly selected by default. Click the down arrow on Thread to expand that list. Then select % Processor Time, which will highlight. Hold Ctrl to select another one and select ID Thread.

4. So now both are selected. In the drop down below the list drop it down and select All Instances. How the Search button lights up. Press that and we can select specific instances of these two things we want to monitor.

5. This will show you these selected counters for each running process. Scroll down to the CQCServer ones and select them all. Click on the first CQCServer one, then run down the last one and do Shift-Click to select all of the ones in betwen. Now press the Add>> button. This will add them all to the list of counters are going to look at.

6. Press OK to load these. The initial view is a line graph. The thread id values don't really show up here since they aren't graphable. They are all just crowded along the top. But you should see one of the lines running up quite high while the others are just sort of bouncing along the bottom. The red one is total for the process, so you don't want that one. There should be another one that is the thread running wild. Put your mouse over it and it should show you some info, the important one being the name of the counter.

So I put the mouse over one that is high and the name is CQCServer/24\Processor %, meaning it's counter nubmer 24 of the processor CPU percent usage.

Note that, if things are too crowded, you can turn lines off by just unchecking in the list below the grapha. Select them all, right click, and do 'Hide selected counters' and they will all go away. Then check the ones you want to concentrate on and they will show up.

7.Go back to the dropdown at the top and select Report as the graph format this time. This will now create a horizontal list, with the numbered counters lined up over each other. I.e. first ther eis CQCServer 0 with both the processor % and thread id under it, then CQCServer 1, and so on. Scroll over to the one we found above, so I scroll over to number 24. And I see that the thread ID value is showing as 4376. This is the decimal value of the thread's id. And of course the percentage of CPU is shown there above the thread id, so we can verify again that is the guy using the CPU.

8.We want the hex format of the thread id, so we can use the Windows calculator for that. Bring it up and in the main menu do View -> Programmer to enable what we want. Make sure it's in Dec mode, on the left, enter the thread id. I enter 4376, then click the Hex button to see what the hex equivalent is, which is 1118 for me.

9.Now I can go back to the Host Admin dialog and run the cursor down until I find the driver on 1118, which in my case matches a repository driver. So that's the driver that was showing high CPU usage in the performance monitor.

So, that's how you can do it. It's a little bit of a pain the first time you do it, but not very hard. And it tells you for sure which one it is without having to load any third party tools or anything.
Dean Roddey
Explorans limites defectum
I could get rid of one step I guess by showing both Hex and Decimal formats of the thread id in the Host Admin dialog.

And of course you could have skipped step 6 with the finding the right line and seeing what number it corresponds to, and just gone straight to the report format. Once there you could have just scrolled over until you saw one showing a high value for the CPU percentage, and the thread id for that one will be there in the same column.
Dean Roddey
Explorans limites defectum
would sysinternals make this easier? I didn't actually read your whole post, but process explorer is pretty handy.
--Kill all the serial ports--
In my experience it's not really simpler to understand. And, at least when I've tried to use it, it has seemed to be very heavy in terms of CPU usage, to the point that it might make the system semi-unusable. But that might have just been me not using it optimally, I dunno.

The scheme above works pretty easily and can be done on any system, including a customer's system, without having to install anything on it. So there's a lot to be said for that.
Dean Roddey
Explorans limites defectum
I agree that the SysInternals tool is super heavy on the CPU. On the order of like 40% while it's running in my experience.

Thanks for writing this up Dean, it's very helpful!

Possibly Related Threads...
Thread Author Replies Views Last Post
  How To - Configure MyMovies Driver on Windows 7 x64 wuench 18 19,249 10-10-2016, 09:05 AM
Last Post: MikeA
  How to get the DataLogdb driver up and running Zanthic 20 24,439 01-17-2013, 03:20 PM
Last Post: Dean Roddey
  How To: Logitech Squeeze Center Driver jkish 328 105,444 12-17-2010, 02:09 AM
Last Post: gacevich
  How to setup the Weather Channel data feed driver. beelzerob 3 13,688 05-24-2010, 04:39 PM
Last Post: Dean Roddey
  Get Album Art Working with J. River Repository Driver Squiddy 0 6,457 11-23-2008, 06:15 PM
Last Post: Squiddy

Forum Jump:

Users browsing this thread: 1 Guest(s)