mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
c8238579fb
Historically, we declared pointer type to our types: typedef struct _virXXX virXXX; typedef virXXX *virXXXPtr; But usefulness of such declaration is questionable, at best. Unfortunately, we can't drop every such declaration - we have to carry some over, because they are part of public API (e.g. virDomainPtr). But for internal types - we can do drop them and use what every other C project uses 'virXXX *'. This change was generated by a very ugly shell script that generated sed script which was then called over each file in the repository. For the shell script refer to the cover letter: https://listman.redhat.com/archives/libvir-list/2021-March/msg00537.html Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
83 lines
3.5 KiB
C
83 lines
3.5 KiB
C
/*
|
|
* virperf.h: methods for managing perf events
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "virenum.h"
|
|
|
|
/* Some Intel processor families introduced some RDT (Resource Director
|
|
* Technology) features to monitor or control shared resource based on
|
|
* the perf framework in the linux kernel. */
|
|
typedef enum {
|
|
VIR_PERF_EVENT_CMT, /* Cache Monitoring Technology */
|
|
VIR_PERF_EVENT_MBMT, /* Memory Bandwidth Monitoring Total */
|
|
VIR_PERF_EVENT_MBML, /* Memory Bandwidth Monitor Limit for controller */
|
|
|
|
VIR_PERF_EVENT_CPU_CYCLES, /* Count of CPU Cycles (total/elapsed) */
|
|
VIR_PERF_EVENT_INSTRUCTIONS, /* Count of instructions for application */
|
|
VIR_PERF_EVENT_CACHE_REFERENCES, /* Cache hits by applications */
|
|
VIR_PERF_EVENT_CACHE_MISSES, /* Cache misses by applications */
|
|
VIR_PERF_EVENT_BRANCH_INSTRUCTIONS, /* Count of branch instructions
|
|
for applications */
|
|
VIR_PERF_EVENT_BRANCH_MISSES, /* Count of branch misses for applications */
|
|
VIR_PERF_EVENT_BUS_CYCLES, /* Count of bus cycles for applications */
|
|
VIR_PERF_EVENT_STALLED_CYCLES_FRONTEND, /* Count of stalled cpu cycles in
|
|
the frontend of the instruction
|
|
processor pipeline */
|
|
VIR_PERF_EVENT_STALLED_CYCLES_BACKEND, /* Count of stalled cpu cycles in
|
|
the backend of the instruction
|
|
processor pipeline */
|
|
VIR_PERF_EVENT_REF_CPU_CYCLES, /* Count of ref cpu cycles */
|
|
VIR_PERF_EVENT_CPU_CLOCK, /* Count of cpu clock time */
|
|
VIR_PERF_EVENT_TASK_CLOCK, /* Count of task clock time */
|
|
VIR_PERF_EVENT_PAGE_FAULTS, /* Count of total page faults */
|
|
VIR_PERF_EVENT_CONTEXT_SWITCHES, /* Count of context switches */
|
|
VIR_PERF_EVENT_CPU_MIGRATIONS, /* Count of cpu migrations */
|
|
VIR_PERF_EVENT_PAGE_FAULTS_MIN, /* Count of minor page faults */
|
|
VIR_PERF_EVENT_PAGE_FAULTS_MAJ, /* Count of major page faults */
|
|
VIR_PERF_EVENT_ALIGNMENT_FAULTS, /* Count of alignment faults */
|
|
VIR_PERF_EVENT_EMULATION_FAULTS, /* Count of emulation faults */
|
|
|
|
VIR_PERF_EVENT_LAST
|
|
} virPerfEventType;
|
|
|
|
VIR_ENUM_DECL(virPerfEvent);
|
|
|
|
struct _virPerf;
|
|
typedef struct _virPerf virPerf;
|
|
|
|
virPerf *virPerfNew(void);
|
|
|
|
void virPerfFree(virPerf *perf);
|
|
|
|
int virPerfEventEnable(virPerf *perf,
|
|
virPerfEventType type,
|
|
pid_t pid);
|
|
|
|
int virPerfEventDisable(virPerf *perf,
|
|
virPerfEventType type);
|
|
|
|
bool virPerfEventIsEnabled(virPerf *perf,
|
|
virPerfEventType type);
|
|
|
|
int virPerfReadEvent(virPerf *perf,
|
|
virPerfEventType type,
|
|
uint64_t *value);
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virPerf, virPerfFree);
|