proc_pressure.c (pcp-6.0.2) | : | proc_pressure.c (pcp-6.0.3) | ||
---|---|---|---|---|
/* | /* | |||
* Linux /proc/pressure/ metrics clusters | * Linux /proc/pressure/ metrics clusters | |||
* | * | |||
* Copyright (c) 2019 Red Hat. | * Copyright (c) 2019,2023 Red Hat. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify it | * This program is free software; you can redistribute it and/or modify it | |||
* under the terms of the GNU General Public License as published by the | * under the terms of the GNU General Public License as published by the | |||
* Free Software Foundation; either version 2 of the License, or (at your | * Free Software Foundation; either version 2 of the License, or (at your | |||
* option) any later version. | * option) any later version. | |||
* | * | |||
* This program is distributed in the hope that it will be useful, but | * This program is distributed in the hope that it will be useful, but | |||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
* for more details. | * for more details. | |||
skipping to change at line 101 | skipping to change at line 101 | |||
} | } | |||
int | int | |||
refresh_proc_pressure_io(proc_pressure_t *proc_pressure) | refresh_proc_pressure_io(proc_pressure_t *proc_pressure) | |||
{ | { | |||
char buf[MAXPATHLEN]; | char buf[MAXPATHLEN]; | |||
FILE *fp; | FILE *fp; | |||
int sts; | int sts; | |||
memset(&proc_pressure->some_io, 0, sizeof(proc_pressure->some_io)); | memset(&proc_pressure->some_io, 0, sizeof(proc_pressure->some_io)); | |||
memset(&proc_pressure->full_io, 0, sizeof(proc_pressure->some_io)); | memset(&proc_pressure->full_io, 0, sizeof(proc_pressure->full_io)); | |||
if (!(fp = linux_statsfile("/proc/pressure/io", buf, sizeof(buf)))) | if (!(fp = linux_statsfile("/proc/pressure/io", buf, sizeof(buf)))) | |||
return -oserror(); | return -oserror(); | |||
sts = read_pressure(fp, SOME, &proc_pressure->some_io); | sts = read_pressure(fp, SOME, &proc_pressure->some_io); | |||
proc_pressure->some_io.updated = sts; | proc_pressure->some_io.updated = sts; | |||
sts = read_pressure(fp, FULL, &proc_pressure->full_io); | sts = read_pressure(fp, FULL, &proc_pressure->full_io); | |||
proc_pressure->full_io.updated = sts; | proc_pressure->full_io.updated = sts; | |||
fclose(fp); | fclose(fp); | |||
return 0; | return 0; | |||
} | } | |||
int | int | |||
refresh_proc_pressure_irq(proc_pressure_t *proc_pressure) | ||||
{ | ||||
char buf[MAXPATHLEN]; | ||||
FILE *fp; | ||||
int sts; | ||||
memset(&proc_pressure->full_irq, 0, sizeof(proc_pressure->full_irq)); | ||||
if (!(fp = linux_statsfile("/proc/pressure/irq", buf, sizeof(buf)))) | ||||
return -oserror(); | ||||
sts = read_pressure(fp, FULL, &proc_pressure->full_irq); | ||||
proc_pressure->full_irq.updated = sts; | ||||
fclose(fp); | ||||
return 0; | ||||
} | ||||
int | ||||
average_proc_pressure(pressure_t *pp, unsigned int inst, pmAtomValue *atom) | average_proc_pressure(pressure_t *pp, unsigned int inst, pmAtomValue *atom) | |||
{ | { | |||
if (inst == 10) | if (inst == 10) | |||
atom->f = pp->avg[0]; | atom->f = pp->avg[0]; | |||
else if (inst == 60) | else if (inst == 60) | |||
atom->f = pp->avg[1]; | atom->f = pp->avg[1]; | |||
else if (inst == 300) | else if (inst == 300) | |||
atom->f = pp->avg[2]; | atom->f = pp->avg[2]; | |||
else | else | |||
return PM_ERR_INST; | return PM_ERR_INST; | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 21 lines changed or added |