11/*
2- htop - PCPMetric .c
2+ htop - Metric .c
33(C) 2020-2021 htop dev team
44(C) 2020-2021 Red Hat, Inc.
55Released under the GNU GPLv2+, see the COPYING file
@@ -8,7 +8,7 @@ in the source distribution for its full text.
88
99#include "config.h" // IWYU pragma: keep
1010
11- #include "pcp/PCPMetric .h"
11+ #include "pcp/Metric .h"
1212
1313#include <stddef.h>
1414#include <stdio.h>
@@ -21,15 +21,15 @@ in the source distribution for its full text.
2121
2222extern Platform * pcp ;
2323
24- const pmDesc * PCPMetric_desc ( PCPMetric metric ) {
24+ const pmDesc * Metric_desc ( Metric metric ) {
2525 return & pcp -> descs [metric ];
2626}
2727
28- int PCPMetric_type ( PCPMetric metric ) {
28+ int Metric_type ( Metric metric ) {
2929 return pcp -> descs [metric ].type ;
3030}
3131
32- pmAtomValue * PCPMetric_values ( PCPMetric metric , pmAtomValue * atom , int count , int type ) {
32+ pmAtomValue * Metric_values ( Metric metric , pmAtomValue * atom , int count , int type ) {
3333 if (pcp -> result == NULL )
3434 return NULL ;
3535
@@ -54,14 +54,14 @@ pmAtomValue* PCPMetric_values(PCPMetric metric, pmAtomValue* atom, int count, in
5454 return atom ;
5555}
5656
57- int PCPMetric_instanceCount ( PCPMetric metric ) {
57+ int Metric_instanceCount ( Metric metric ) {
5858 pmValueSet * vset = pcp -> result -> vset [metric ];
5959 if (vset )
6060 return vset -> numval ;
6161 return 0 ;
6262}
6363
64- int PCPMetric_instanceOffset ( PCPMetric metric , int inst ) {
64+ int Metric_instanceOffset ( Metric metric , int inst ) {
6565 pmValueSet * vset = pcp -> result -> vset [metric ];
6666 if (!vset || vset -> numval <= 0 )
6767 return 0 ;
@@ -74,7 +74,7 @@ int PCPMetric_instanceOffset(PCPMetric metric, int inst) {
7474 return 0 ;
7575}
7676
77- static pmAtomValue * PCPMetric_extract ( PCPMetric metric , int inst , int offset , pmValueSet * vset , pmAtomValue * atom , int type ) {
77+ static pmAtomValue * Metric_extract ( Metric metric , int inst , int offset , pmValueSet * vset , pmAtomValue * atom , int type ) {
7878
7979 /* extract value (using requested type) of given metric instance */
8080 const pmDesc * desc = & pcp -> descs [metric ];
@@ -89,20 +89,20 @@ static pmAtomValue* PCPMetric_extract(PCPMetric metric, int inst, int offset, pm
8989 return atom ;
9090}
9191
92- pmAtomValue * PCPMetric_instance ( PCPMetric metric , int inst , int offset , pmAtomValue * atom , int type ) {
92+ pmAtomValue * Metric_instance ( Metric metric , int inst , int offset , pmAtomValue * atom , int type ) {
9393
9494 pmValueSet * vset = pcp -> result -> vset [metric ];
9595 if (!vset || vset -> numval <= 0 )
9696 return NULL ;
9797
9898 /* fast-path using heuristic offset based on expected location */
9999 if (offset >= 0 && offset < vset -> numval && inst == vset -> vlist [offset ].inst )
100- return PCPMetric_extract (metric , inst , offset , vset , atom , type );
100+ return Metric_extract (metric , inst , offset , vset , atom , type );
101101
102102 /* slow-path using a linear search for the requested instance */
103103 for (int i = 0 ; i < vset -> numval ; i ++ ) {
104104 if (inst == vset -> vlist [i ].inst )
105- return PCPMetric_extract (metric , inst , i , vset , atom , type );
105+ return Metric_extract (metric , inst , i , vset , atom , type );
106106 }
107107 return NULL ;
108108}
@@ -113,7 +113,7 @@ pmAtomValue* PCPMetric_instance(PCPMetric metric, int inst, int offset, pmAtomVa
113113 *
114114 * Start it off by passing offset -1 into the routine.
115115 */
116- bool PCPMetric_iterate ( PCPMetric metric , int * instp , int * offsetp ) {
116+ bool Metric_iterate ( Metric metric , int * instp , int * offsetp ) {
117117 if (!pcp -> result )
118118 return false;
119119
@@ -132,15 +132,15 @@ bool PCPMetric_iterate(PCPMetric metric, int* instp, int* offsetp) {
132132}
133133
134134/* Switch on/off a metric for value fetching (sampling) */
135- void PCPMetric_enable ( PCPMetric metric , bool enable ) {
135+ void Metric_enable ( Metric metric , bool enable ) {
136136 pcp -> fetch [metric ] = enable ? pcp -> pmids [metric ] : PM_ID_NULL ;
137137}
138138
139- bool PCPMetric_enabled ( PCPMetric metric ) {
139+ bool Metric_enabled ( Metric metric ) {
140140 return pcp -> fetch [metric ] != PM_ID_NULL ;
141141}
142142
143- void PCPMetric_enableThreads (void ) {
143+ void Metric_enableThreads (void ) {
144144 pmValueSet * vset = xCalloc (1 , sizeof (pmValueSet ));
145145 vset -> vlist [0 ].inst = PM_IN_NULL ;
146146 vset -> vlist [0 ].value .lval = 1 ;
@@ -159,7 +159,7 @@ void PCPMetric_enableThreads(void) {
159159 pmFreeResult (result );
160160}
161161
162- bool PCPMetric_fetch (struct timeval * timestamp ) {
162+ bool Metric_fetch (struct timeval * timestamp ) {
163163 if (pcp -> result ) {
164164 pmFreeResult (pcp -> result );
165165 pcp -> result = NULL ;
@@ -179,12 +179,12 @@ bool PCPMetric_fetch(struct timeval* timestamp) {
179179 return true;
180180}
181181
182- void PCPMetric_externalName ( PCPMetric metric , int inst , char * * externalName ) {
182+ void Metric_externalName ( Metric metric , int inst , char * * externalName ) {
183183 const pmDesc * desc = & pcp -> descs [metric ];
184184 pmNameInDom (desc -> indom , inst , externalName );
185185}
186186
187- int PCPMetric_lookupText (const char * metric , char * * desc ) {
187+ int Metric_lookupText (const char * metric , char * * desc ) {
188188 pmID pmid ;
189189 int sts ;
190190
0 commit comments