-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcounters.h
More file actions
62 lines (47 loc) · 1.3 KB
/
counters.h
File metadata and controls
62 lines (47 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef __PDH_H__
#define __PDH_H__
#include <windows.h>
#include <stdio.h>
#pragma hdrstop
#include "pdh.h"
enum {kHistory = 1024};
// ================================================================================================
// Single-query PDH wrapper with history
// ================================================================================================
class PDHQuery {
friend class PDH;
HQUERY query;
HCOUNTER counter;
TCHAR counterpath[256];
long history[kHistory];
long historysize;
public:
PDHQuery() : query(NULL), counter(NULL), historysize(0) {
PdhOpenQuery(NULL, 0, &query);
}
~PDHQuery() {
PdhCloseQuery(query);
}
void SetPath(char *path);
int GetData();
};
// ================================================================================================
// Class to manage multiple queries and add more
// ================================================================================================
class PDH {
struct PDHList {
PDHList() { next = NULL; }
PDHQuery q;
PDHList *next;
};
int counters;
PDHList *head;
public:
PDH() : head(NULL), counters(0) {}
long Sum(int timeago);
void AddCounter(char *path);
void ChooseUI();
void AddObjects(char *objsearch, char *countersearch = NULL, char *ifsearch = NULL);
void Tick();
};
#endif // __PDH_H__