GCC Code Coverage Report


Directory: src/
File: src/apis/DLB_interface_stats.c
Date: 2025-01-24 16:45:56
Exec Total Coverage
Lines: 0 46 0.0%
Functions: 0 16 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*********************************************************************************/
2 /* Copyright 2009-2024 Barcelona Supercomputing Center */
3 /* */
4 /* This file is part of the DLB library. */
5 /* */
6 /* DLB is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU Lesser General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* DLB is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU Lesser General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU Lesser General Public License */
17 /* along with DLB. If not, see <https://www.gnu.org/licenses/>. */
18 /*********************************************************************************/
19
20 /* Statistics API */
21
22 #include "apis/dlb_stats.h"
23
24 #include "LB_comm/shmem_procinfo.h"
25 #include "LB_core/spd.h"
26 #include "apis/dlb_errors.h"
27 #include "support/mask_utils.h"
28 #include "support/options.h"
29
30 #include <stddef.h>
31
32 #pragma GCC visibility push(default)
33
34 int DLB_Stats_Init(void) {
35 char shm_key[MAX_OPTION_LENGTH];
36 options_parse_entry("--shm-key", &shm_key);
37 int shm_size_multiplier;
38 options_parse_entry("--shm-size-multiplier", &shm_size_multiplier);
39 shmem_procinfo_ext__init(shm_key, shm_size_multiplier);
40 return DLB_SUCCESS;
41 }
42
43 int DLB_Stats_Finalize(void) {
44 shmem_procinfo_ext__finalize();
45 return DLB_SUCCESS;
46 }
47
48 int DLB_Stats_GetNumCpus(int *ncpus) {
49 *ncpus = mu_get_system_size();
50 return DLB_SUCCESS;
51 }
52
53 int DLB_Stats_GetPidList(int *pidlist, int *nelems, int max_len) {
54 shmem_procinfo__getpidlist(pidlist, nelems, max_len);
55 return DLB_SUCCESS;
56 }
57
58 int DLB_Stats_GetCpuUsage(int pid, double *usage) {
59 *usage = shmem_procinfo__getcpuusage(pid);
60 return DLB_SUCCESS;
61 }
62
63 int DLB_Stats_GetCpuAvgUsage(int pid, double *usage) {
64 *usage = shmem_procinfo__getcpuavgusage(pid);
65 return DLB_SUCCESS;
66 }
67
68 int DLB_Stats_GetCpuUsageList(double *usagelist, int *nelems, int max_len) {
69 shmem_procinfo__getcpuusage_list(usagelist, nelems, max_len);
70 return DLB_SUCCESS;
71 }
72
73 int DLB_Stats_GetCpuAvgUsageList(double *avgusagelist, int *nelems, int max_len) {
74 shmem_procinfo__getcpuavgusage_list(avgusagelist, nelems, max_len);
75 return DLB_SUCCESS;
76 }
77
78 int DLB_Stats_GetNodeUsage(double *usage) {
79 *usage = shmem_procinfo__getnodeusage();
80 return DLB_SUCCESS;
81 }
82
83 int DLB_Stats_GetNodeAvgUsage(double *usage) {
84 *usage = shmem_procinfo__getnodeavgusage();
85 return DLB_SUCCESS;
86 }
87
88 int DLB_Stats_GetActiveCpus(int pid, int *ncpus) {
89 *ncpus = shmem_procinfo__getactivecpus(pid);
90 return DLB_SUCCESS;
91 }
92
93 int DLB_Stats_GetActiveCpusList(int *cpuslist, int *nelems, int max_len) {
94 shmem_procinfo__getactivecpus_list(cpuslist, nelems, max_len);
95 return DLB_SUCCESS;
96 }
97
98 int DLB_Stats_GetLoadAvg(int pid, double *load) {
99 return shmem_procinfo__getloadavg(pid, load);
100 }
101
102 int DLB_Stats_GetCpuStateIdle(int cpu, float *percentage) {
103 return DLB_SUCCESS;
104 }
105
106 int DLB_Stats_GetCpuStateOwned(int cpu, float *percentage) {
107 return DLB_SUCCESS;
108 }
109
110 int DLB_Stats_GetCpuStateGuested(int cpu, float *percentage) {
111 return DLB_SUCCESS;
112 }
113
114 #pragma GCC visibility pop
115