X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/c18c124eaa464aaaa5549e99e5a70fc9cbb50944..3e170ce000f1506b7b5d2c5c7faec85ceabb573d:/osfmk/kperf/kperf_kpc.h?ds=sidebyside diff --git a/osfmk/kperf/kperf_kpc.h b/osfmk/kperf/kperf_kpc.h index 91df04c0f..d4dc8d814 100644 --- a/osfmk/kperf/kperf_kpc.h +++ b/osfmk/kperf/kperf_kpc.h @@ -33,6 +33,23 @@ #include /* KPC_MAX_COUNTERS */ #endif +/* controls whether a context-switch handler is invoked */ +extern unsigned kperf_kpc_cswitch_set; + +void kperf_kpc_switch_context(thread_t old, thread_t new); +void kperf_kpc_cswitch_callback_update(void); + +/* for osfmk/platform/pcb.c context switches */ +static inline void +kperf_kpc_cswitch(thread_t old, thread_t new) +{ + if (!kperf_kpc_cswitch_set) { + return; + } + + kperf_kpc_switch_context(old, new); +} + /* KPC sample data */ struct kpcdata { @@ -44,8 +61,9 @@ struct kpcdata uint64_t configv[KPC_MAX_COUNTERS]; }; - -void kperf_kpc_cpu_sample( struct kpcdata *, int ); -void kperf_kpc_cpu_log( struct kpcdata * ); +void kperf_kpc_thread_sample(struct kpcdata *, int); +void kperf_kpc_cpu_sample(struct kpcdata *, int); +void kperf_kpc_thread_log(const struct kpcdata *); +void kperf_kpc_cpu_log(const struct kpcdata *); #endif /* __KPERF_KPC_H__ */