Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/include/libnotify/../libcpc.h
Real path: /usr/include/libcpc.h
Zurück
/* * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved. */ #ifndef _LIBCPC_H #define _LIBCPC_H #include <sys/types.h> #include <sys/cpc_impl.h> #include <inttypes.h> #include <libpctx.h> #include <stdarg.h> #include <signal.h> #include <string.h> #include <ucontext.h> #include <sys/processor.h> /* * This library allows hardware performance counters present in * certain processors to be used by applications to monitor their * own statistics, the statistics of others, or the statistics of a given CPU. */ #ifdef __cplusplus extern "C" { #endif typedef struct __cpc cpc_t; typedef struct __cpc_set cpc_set_t; typedef struct __cpc_buf cpc_buf_t; /* * Current library version must be passed to cpc_open(). */ #define CPC_VER_CPC_ONLY 2 #define CPC_VER_CURRENT 3 /* * Initializes the library for use and returns a pointer to an identifier that * must be used as the cpc argument in subsequent libcpc calls. */ extern cpc_t *cpc_open(int __ver); extern int cpc_close(cpc_t *__cpc); /* * Query information about the underlying processor. */ extern uint_t cpc_npic(cpc_t *__cpc); extern uint_t cpc_caps(cpc_t *__cpc); extern const char *cpc_cciname(cpc_t *__cpc); extern const char *cpc_cpuref(cpc_t *__cpc); /* * A vprintf-like error handling routine can be passed to the * library for use by more sophisticated callers. * If specified as NULL, errors are written to stderr. */ typedef void (cpc_errhndlr_t)(const char *fn, int subcode, const char *fmt, va_list ap); extern int cpc_seterrhndlr(cpc_t *__cpc, cpc_errhndlr_t *__fn); extern cpc_set_t *cpc_set_create(cpc_t *__cpc); extern int cpc_set_destroy(cpc_t *__cpc, cpc_set_t *__set); /* * If successful, returns an index for the new request within the set which is * needed later to retrieve the request's data. * Returns -1 if unsuccessful and sets errno to indicate the error. */ extern int cpc_set_add_request(cpc_t *__cpc, cpc_set_t *__set, const char *__event, uint64_t __preset, uint_t __flags, uint_t __nattrs, const cpc_attr_t *__attrs); extern cpc_buf_t *cpc_buf_create(cpc_t *__cpc, cpc_set_t *__set); extern int cpc_buf_destroy(cpc_t *__cpc, cpc_buf_t *__buf); /* * Binds the set to the current LWP. */ extern int cpc_bind_curlwp(cpc_t *__cpc, cpc_set_t *__set, uint_t __flags); /* * Binds the set to the specified LWP in a process controlled via libpctx. */ extern int cpc_bind_pctx(cpc_t *__cpc, pctx_t *__pctx, id_t __id, cpc_set_t *__set, uint_t __flags); /* * Binds the set to the specified CPU. The process must have sufficient * privileges to bind to the CPU via processor_bind(2). An LWP can only * bind to one CPU at a time. To measure more than one CPU simultaneously, * one LWP must be created for each CPU. */ extern int cpc_bind_cpu(cpc_t *__cpc, processorid_t __id, cpc_set_t *__set, uint_t __flags); /* * Valid flag values for calls to cpc_bind_cpu(). */ #define CPC_FLAGS_DEFAULT 0 #define CPC_FLAGS_NORELE 0x01 #define CPC_FLAGS_NOPBIND 0x02 #define CPC_BIND_CPU_VALID_FLAGS(F) \ (((uint_t)F) > (CPC_FLAGS_NORELE|CPC_FLAGS_NOPBIND)) /* * Set the starting value for the indexed counter, and restart counting for a * set that was frozen by a counter overflow. */ extern int cpc_request_preset(cpc_t *__cpc, int __index, uint64_t __preset); extern int cpc_set_restart(cpc_t *__cpc, cpc_set_t *__set); /* * Unbinds the set and frees up associated resources. cpc_buf_t's must be * explicitly freed via cpc_buf_destroy(). */ extern int cpc_unbind(cpc_t *__cpc, cpc_set_t *__set); /* * Samples a set into a cpc_buf_t. The provided set must be bound, and the * buf must have been created with the set being sampled. */ extern int cpc_set_sample(cpc_t *__cpc, cpc_set_t *__set, cpc_buf_t *__buf); extern void cpc_buf_sub(cpc_t *__cpc, cpc_buf_t *__ds, cpc_buf_t *__a, cpc_buf_t *__b); extern void cpc_buf_add(cpc_t *__cpc, cpc_buf_t *__ds, cpc_buf_t *__a, cpc_buf_t *__b); extern void cpc_buf_copy(cpc_t *__cpc, cpc_buf_t *__ds, cpc_buf_t *__src); extern void cpc_buf_zero(cpc_t *__cpc, cpc_buf_t *__buf); /* * Gets or sets the value of the request specified by index. */ extern int cpc_buf_get(cpc_t *__cpc, cpc_buf_t *__buf, int __index, uint64_t *__val); extern int cpc_buf_set(cpc_t *__cpc, cpc_buf_t *__buf, int __index, uint64_t __val); extern hrtime_t cpc_buf_hrtime(cpc_t *__cpc, cpc_buf_t *__buf); extern void cpc_set_hrtime(cpc_t *__cpc, cpc_buf_t *__buf, uint64_t __hrtime); extern uint64_t cpc_buf_tick(cpc_t *__cpc, cpc_buf_t *__buf); extern void cpc_set_tick(cpc_t *__cpc, cpc_buf_t *__buf, uint64_t __ticks); extern void cpc_walk_requests(cpc_t *__cpc, cpc_set_t *__set, void *__arg, void (*action)(void *__arg, int __index, const char *__event, uint64_t __preset, uint_t __flags, int __nattrs, const cpc_attr_t *__attrs)); extern void cpc_walk_events_all(cpc_t *__cpc, void *__arg, void (*__action)(void *__arg, const char *__event)); extern void cpc_walk_generic_events_all(cpc_t *__cpc, void *__arg, void (*__action)(void *__arg, const char *__event)); extern void cpc_walk_events_pic(cpc_t *__cpc, uint_t __picno, void *__arg, void (*__action)(void *__arg, uint_t __picno, const char *__event)); extern void cpc_walk_generic_events_pic(cpc_t *__cpc, uint_t __picno, void *__arg, void (*__action)(void *__arg, uint_t __picno, const char *__event)); extern void cpc_walk_attrs(cpc_t *__cpc, void *__arg, void (*__action)(void *__arg, const char *attr)); extern int cpc_enable(cpc_t *__cpc); extern int cpc_disable(cpc_t *__cpc); extern void cpc_terminate(cpc_t *); /* * SMPL specific functions */ /* * Obtains the number of SMPL records available in the cpc buffer */ extern int cpc_buf_smpl_rec_count(cpc_t *, cpc_buf_t *, int, uint_t *); /* * Retrieves the sampling result of a specified item in the SMPL record in * the cpc buffer for the request. */ extern int cpc_buf_smpl_get_item(cpc_t *, cpc_buf_t *, int, int, int, uint64_t *); /* * Retrieves a specified SMPL record in the cpc buffer for the request * as an array of uint64_t. */ extern uint64_t *cpc_buf_smpl_get_record(cpc_t *, cpc_buf_t *, int, int); /* * Calls the specified function on each element of a global event list for * the specified target. */ extern void cpc_walk_events_all_common(cpc_t *, void *, int, void (*)(void *, const char *)); /* * Calls the specified function with each event supported by the specified * counter for the specified target. */ extern void cpc_walk_events_pic_common(cpc_t *, uint_t, void *, int, void (*)(void *, uint_t, const char *)); /* * Calls the specified function for each attribute name supported for * specified target. */ extern void cpc_walk_attrs_common(cpc_t *, void *, int, void (*)(void *, const char *)); /* * Calls the specified function on each item in the SMPL record. */ extern void cpc_walk_smpl_recitems(cpc_t *, void *, void (*)(void *, const char *, int)); /* * Calls the specified function on each item in the SMPL record * supported for specified counter. */ extern void cpc_walk_smpl_recitems_req(cpc_t *, cpc_set_t *, int, void *, void (*)(void *, cpc_set_t *, int, const char *, int)); /* * Returns the number of performance counters for SMPL */ extern uint_t cpc_smpl_npic(cpc_t *); /* * Returns the HW sampling implementation name. */ extern const char *cpc_smpl_iname(cpc_t *); /* * Returns the maximum number of SMPL record entries per a request, * supported by the system. */ extern int cpc_get_smpl_max_rec_count(cpc_t *, uint_t *); #ifdef __cplusplus } #endif #endif /* _LIBCPC_H */