blob: 5c238d1a92d48d842f854f0ac410675a01d731c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Copyright (C) 2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "monitors/query_wrapper.h"
#include <Windows.h>
#include <system_error>
QueryWrapper::QueryWrapper() {
PDH_STATUS status = PdhOpenQuery(NULL, NULL, &query);
if (ERROR_SUCCESS != status) {
throw std::system_error(status, std::system_category(), "PdhOpenQuery() failed");
}
}
QueryWrapper::~QueryWrapper() {
PdhCloseQuery(query);
}
QueryWrapper::operator PDH_HQUERY() const {
return query;
}
|