Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been playing with Performance Monitor in Windows 7 and have been able to create a data collector set that monitors a process and logs an alert when Private Bytes exceeds some threshold. I want to use this when we run certain tests as a crude catch for major memory leaks.

It seems like I have to start my application, then manually start the data collection set. Is there some way that the data collection set can just stay running, even when the process it monitors isn't running? If that's not possible, is there a way that I can tie the starting of the data collection set to the starting of my application?

share|improve this question
up vote 0 down vote accepted

After poking around, I discovered that I can programmatically start the data collection set. My code looks something like this:

#include <pla.h>

void start_perfmon_data_collection_set(const wchar_t* dcs_name) 
    IDataCollectorSet* pdcs;
    HRESULT hr = CoCreateInstance(__uuidof(DataCollectorSet), 
                                  (void**) &pdcs);

    if (FAILED(hr))
        TRACE(L"CoCreateInstance(__uuidof(DataCollectorSet) failed with 0x%x.\n", hr);

    if (FAILED(pdcs->Query(dcs_name, NULL)))
        TRACE(L"unable to query %s\n", dcs_name);
        if (FAILED(pdcs->Start(false)))
            DataCollectorSetStatus status;
            TRACE(L"status = %d\n", status);
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .