SOL9 Sample: PerformanceCounterPath

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * PerformanceCounterPath.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9
// 2009/09/25

#include <sol/pdh/PerformanceQuery.h>
#include <sol/pdh/PerformanceCounter.h>
#include <sol/pdh/PerformanceCounterPath.h>
#include <sol/pdh/PerformanceCounterInfo.h>
#include <sol/Locale.h>

void _tmain(int argc, TCHAR** argv)
{
  Locale locale;
  try {  
    PerformanceQuery query;

    PerformanceCounter counter;

    String fullPath = "";

    const TCHAR* machineName = NULL;
    const TCHAR* objectName  = _T("Process");
    const TCHAR* counterName  = _T("% Processor Time");
    const TCHAR* instanceName = _T("notepad");
    int  instanceIndex = 0;

    PerformanceCounterPath counterPath;

    counterPath.make(fullPath, machineName, objectName, 
        counterName, instanceName, instanceIndex);

    query.addCounter((const TCHAR*)fullPath, counter);

    PerformanceCounterInfo counterInfo(counter);

    counterInfo.display();

  } catch (int error) {
    printf("Exception %d\n", error);
  }
}

Last modified: 2 May 2016

Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.