blob: 6628ff8640158e40fc0744411749d23dbd3c6e02 (
plain)
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
|
// SPDX-License-Identifier: GPL-3.0-or-later
#include "windows_plugin.h"
#include "windows-internals.h"
#define _COMMON_PLUGIN_NAME "windows.plugin"
#define _COMMON_PLUGIN_MODULE_NAME "PerflibObjects"
#include "../common-contexts/common-contexts.h"
static void initialize(void) {
;
}
static bool do_objects(PERF_DATA_BLOCK *pDataBlock, int update_every) {
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "Objects");
if (!pObjectType)
return false;
static COUNTER_DATA semaphores = { .key = "Semaphores" };
if(perflibGetObjectCounter(pDataBlock, pObjectType, &semaphores)) {
ULONGLONG sem = semaphores.current.Data;
common_semaphore_ipc(sem, WINDOWS_MAX_KERNEL_OBJECT, _COMMON_PLUGIN_MODULE_NAME, update_every);
}
return true;
}
int do_PerflibObjects(int update_every, usec_t dt __maybe_unused) {
static bool initialized = false;
if(unlikely(!initialized)) {
initialize();
initialized = true;
}
DWORD id = RegistryFindIDByName("Objects");
if(id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
return -1;
PERF_DATA_BLOCK *pDataBlock = perflibGetPerformanceData(id);
if(!pDataBlock) return -1;
do_objects(pDataBlock, update_every);
return 0;
}
|